Difference between revisions of "NAMD"

From Tau Wiki
Jump to: navigation, search
(Guide to building and running NAMD 2.6 with TAU)
(Background)
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Guide to building and running NAMD 2.6 with TAU =
+
[[Category:Applications]]
Currently this guide is for building NAMD and charm++ from source on x86 64-bit architecture. One would follow similar step on other machines but we have experienced additional difficulties.
+
[[Category:Showcase]]
  
==Manual Instrumentation==
+
= Background =
Because NAMD uses charm++ threading library with need to manual instrument some portion of NAMD and charm++ to let TAU know when threads are being create, etc. You should be able to apply this patch to NAMD to insert the instrumentation:
+
 
<pre>
+
{|
%> tar xzf NAMD_2.6_Source.tar.gz
+
!Link
%> cd NAMD_2.6_Source
+
!Code
%> tar xf charm-5.9.tar
+
!Version
%> patch -R -p0 < NAMD2.6-TAU.patch
+
!Machine
</pre>
+
!Date
 +
|-
 +
|[http://www.ks.uiuc.edu/Research/namd/ NAMD homepage]
 +
|[http://www.ks.uiuc.edu/Development/Download/download.cgi?PackageName=NAMD Download Page]
 +
|2.6
 +
|Linux x86_64
 +
|February 2009
 +
|}
 +
 
 +
== Background ==
 +
 
 +
Currently this guide is for building NAMD and charm++ from source on x86 64-bit architecture. One would follow similar step on other machines but some of the file names would be changed.
  
 
==Building Charm++==
 
==Building Charm++==
 
+
Automatic instrumentation of charm applications using TAU is available in the unreleased version of Charm++ which you can download here: http://charm.cs.uiuc.edu/download/ (click on the nightly CVS source archive). To compile Charm++:
After downloading '''NAMD_2.6_Source.tar.gz''' do the following:
 
 
<pre>
 
<pre>
%> cd NAMD_2.6_Source/charm-5.9
+
%> cd charm
%> ./build charm++ net-linux-amd64
+
%> ./build charm++ mpi-linux-x86_64 mpicxx ifort -O3
 +
...
 +
%> ./build Tau mpi-linux-x86_64 mpicxx ifort --tau-makefile=<tau_dir>/x86_64/lib/Makefile.tau-icpc-mpi --no-build-shared -O3
 
</pre>
 
</pre>
Wait for charm to finish building then test the configuration by:
+
As always the TAU Makefile you specify determines what profiling/tracing options are set. Wait for charm to finish building then test the configuration by:
 
<pre>
 
<pre>
%> cd net-linux-amd64/tests/charm++/simplearrayhello
+
%> cd mpi-linux-x86_64-ifort-mpicx/tests/charm++/simplearrayhello
%> make
+
%> make OPTS='-tracemode Tau -no-trace-mpi'
%> ./hello
+
%> ./charmrun ./hello +p4
%> ./charmrun ++local ./hello
+
</pre>
 +
Verify that this program runs without any errors and that you get a profile file for each processor.
 +
 
 +
==Building NAMD==
 +
 
 +
Begin in NAMD's home directory:
 +
<pre>
 +
%> cd NAMD_2.6_Source
 +
%> ./config Linux-x86_64-icc --charm-base $CHARMROOT --with-cuda --cuda-prefix $CUDAROOT --with-fftw --with-fftw3 --fftw-prefix $FFTW
 
</pre>
 
</pre>
Verify that this program runs without any errors before continuing.
 
  
==Building TAU==
+
Now set NAMD to use TAU, edit '''arch/Linux-x86_64-icc.arch''' adding this line:
Make sure to have the latest version of TAU installed on your system. To configure TAU to work with charm++ do the following:
 
 
<pre>
 
<pre>
%> cd tau2
+
CHARMOPTS = -tracemode Tau
%> ./configure -pdt=<path to pdt> -charm=<path to the NAMD_2.6_Source/charm-5.9>
 
...
 
%> make clean install
 
 
</pre>
 
</pre>
To confirm TAU is working properly with charm++ try running this example program:
+
 
 +
Then build NAMD
 
<pre>
 
<pre>
%> cd examples/charm
+
%> cd Linux-x86_64-icc
%> export PATH=<path to NAMD/charm-5.9/bin>
 
 
%> make
 
%> make
%> ./charmrun ++local ./pgm
 
 
</pre>
 
</pre>
Verify that profile files have been generated in this directory.
 
  
 +
== NAMD with CUDA ==
  
 +
To profile NAMD's CUDA kernel I few modifications need to be made to the build steps:
  
==Preparing NAMD 2.6==
+
in charm, do:
  
1. First edit Make.charm in NAMD's home so that CHARMBASE is set to the directory where charm-5.9 resides.
+
%> ./build Tau mpi-linux-x86_64 mpicxx ifort --tau-makefile=<tau_dir>/x86_64/lib/Makefile.tau-icpc-mpi-cupti --no-build-shared -O3
2. Next create a selective instrumentation file with these commands:
+
(change TAU makefile)
<pre>
 
BEGIN_EXCLUDE_LIST
 
void Sequencer::thread#
 
void Controller::thread#
 
int NAMD_read_int#
 
void PDBDATA::scan#
 
Real PDBAtom::zcoor#
 
Real PDBAtom::ycoor#
 
Real PDBAtom::xcoor#
 
Bool Molocule::is_hydrogen#
 
END_EXCLUDE_LIST
 
  
BEGIN_FILE_EXCLUDE_LIST
+
rebuild NAMD.
*mainfunc.C
 
*memusage.C
 
*BackEnd.C
 
END_FILE_EXCLUDE_LIST
 
</pre>
 
And save this file in the NAMD home directory.
 
  
3. lastly edit arch/Linux-amd64-g++.arch so that it resembles:
+
and run NAMD by doing:
<pre>
 
include /share/home/00968/tg802155/tau2/include/Makefile
 
NAMD_ARCH = Linux-amd64
 
CHARMARCH = net-linux-amd64
 
  
TAU_SELECT_FILE=/share/home/00968/tg802155/NAMD_2.6_Source/select.tau
+
mpirun -np 3 tau_exec -T icpc,mpi,cupti -cupti ./namd2 src/apoa1/apoa1.namd
  
CXX = $(TAU_COMPILER) -optTauSelectFile=$(TAU_SELECT_FILE) g++
+
(have the '-T' options match the TAU makefile)
CXXOPTS = -O3 -m64 -fexpensive-optimizations -ffast-math
 
CC = $(TAU_COMPILER) -optTauSelectFile=$(TAU_SELECT_FILE) gcc
 
COPTS = -O3 -m64 -fexpensive-optimizations -ffast-math
 
</pre>
 
  
==Building NAMD 2.6==
+
== Running NAMD ==
  
Begin in NAMD's home directory:
+
If everything works properly you should now have a '''namd2''' executable. Test by running:
 
<pre>
 
<pre>
%> cd NAMD_2.6_Source
+
%> ./charmrun ./namd2 +p4 src/alanin
%> ./config Linux-amd64-g++
 
%> cd Linux-amd64-g++
 
 
</pre>
 
</pre>
  
 +
== Performance Data ==
  
Make one final modification to the Makefile in Linux-amd64-g++ directory, find this line:
+
Mean profile of a run with the performance benchmark ALANIN:
<pre>
+
 
namd2: $(INCDIR) $(DSTDIR) $(OBJS) $(LIBS)
+
[[Image:NAMD-mean-profile.png|750px]]
  $(MAKEBUILDINFO)
+
 
  $(CHARMC) -verbose -ld++-option \
+
Histogram of the enqueueWorkA routine across 32 processors:
  "$(COPTI)$(CHARMINC) $(COPTI)$(INCDIR) $(COPTI)$(SRCDIR) $(CXXOPTS)" \
+
 
  -module NeighborLB -module commlib -language charm++ \
+
[[Image:NAMD-work-profile.png|750px]]
</pre>
+
 
change the file to be:
+
A comparison of Timestep per second between two different MPI implementations on Ranger:
<pre>
 
namd2: $(INCDIR) $(DSTDIR) $(OBJS) $(LIBS)
 
  $(MAKEBUILDINFO)
 
  $(CHARMC) -L$(TAU_LIB_DIR) -ltau$(TAU_CONFIG) -verbose -ld++-option \
 
  "$(COPTI)$(CHARMINC) $(COPTI)$(INCDIR) $(COPTI)$(SRCDIR) $(CXXOPTS)" \
 
  -module NeighborLB -module commlib -language charm++ \
 
</pre>
 
  
Now run:
+
[[Image:NAMD-mpi-comparison.png|750px]]
<pre>
 
%> make
 
</pre>
 
  
If everything works properly you should now have a '''namd2''' executable. Test by running:
+
[[Image:namd-apoa1.ppk]]
<pre>
 
%> ./charmrun ++local ./namd2 src/alanin
 
</pre>
 
You should have a generated performance file profile.0.0.0.
 

Latest revision as of 19:20, 10 May 2012


Background

Link Code Version Machine Date
NAMD homepage Download Page 2.6 Linux x86_64 February 2009

Background

Currently this guide is for building NAMD and charm++ from source on x86 64-bit architecture. One would follow similar step on other machines but some of the file names would be changed.

Building Charm++

Automatic instrumentation of charm applications using TAU is available in the unreleased version of Charm++ which you can download here: http://charm.cs.uiuc.edu/download/ (click on the nightly CVS source archive). To compile Charm++:

%> cd charm
%> ./build charm++ mpi-linux-x86_64 mpicxx ifort -O3
...
%> ./build Tau mpi-linux-x86_64 mpicxx ifort --tau-makefile=<tau_dir>/x86_64/lib/Makefile.tau-icpc-mpi --no-build-shared -O3 

As always the TAU Makefile you specify determines what profiling/tracing options are set. Wait for charm to finish building then test the configuration by:

%> cd mpi-linux-x86_64-ifort-mpicx/tests/charm++/simplearrayhello
%> make OPTS='-tracemode Tau -no-trace-mpi'
%> ./charmrun ./hello +p4

Verify that this program runs without any errors and that you get a profile file for each processor.

Building NAMD

Begin in NAMD's home directory:

%> cd NAMD_2.6_Source
%> ./config Linux-x86_64-icc --charm-base $CHARMROOT --with-cuda --cuda-prefix $CUDAROOT --with-fftw --with-fftw3 --fftw-prefix $FFTW

Now set NAMD to use TAU, edit arch/Linux-x86_64-icc.arch adding this line:

CHARMOPTS = -tracemode Tau

Then build NAMD

%> cd Linux-x86_64-icc
%> make

NAMD with CUDA

To profile NAMD's CUDA kernel I few modifications need to be made to the build steps:

in charm, do:

%> ./build Tau mpi-linux-x86_64 mpicxx ifort --tau-makefile=<tau_dir>/x86_64/lib/Makefile.tau-icpc-mpi-cupti --no-build-shared -O3

(change TAU makefile)

rebuild NAMD.

and run NAMD by doing:

mpirun -np 3 tau_exec -T icpc,mpi,cupti -cupti ./namd2 src/apoa1/apoa1.namd

(have the '-T' options match the TAU makefile)

Running NAMD

If everything works properly you should now have a namd2 executable. Test by running:

%> ./charmrun ./namd2 +p4 src/alanin

Performance Data

Mean profile of a run with the performance benchmark ALANIN:

NAMD-mean-profile.png

Histogram of the enqueueWorkA routine across 32 processors:

NAMD-work-profile.png

A comparison of Timestep per second between two different MPI implementations on Ranger:

NAMD-mpi-comparison.png

File:Namd-apoa1.ppk