NAMD: Building charm++
From Debian Clusters
This is part two of a four-part tutorial on building and testing NAMD and charm++. The full tutorial includes
- Installing support packages
- Building and testing charm++
- Building namd
- Building vmd
There is also a troubleshooting page:
Contents |
Getting the NAMD and Charm++ Source
Now that fftw and tcl have been installed, it's time to move onto NAMD and Charm++. Visit http://www.ks.uiuc.edu/Research/namd/2.6/download/732581/ and copy the location for the source file (in case there's a more recent one than the time of this writing). You'll want to do all your work on this in a place that's accessible from every worker node, such as an NFS mount, because the binaries will still need access to some of the original untarred directories.
For instance, I normally keep my source code in /usr/local/src, but that's only when I only need the source code accessible to the head node. This time, I'm keeping the source code on my NFS mount, /shared, under /shared/usr/local/src. Make sure the source code is available to all the worker nodes. From the directory you're selecting, run
wget http://www.ks.uiuc.edu/Research/namd/2.6/download/732581/NAMD_2.6_Source.tar.gz
Untar the file with
tar xvzf NAMD*.tar.gz
and then move into the directory that was created. You should see the source code for Charm++ in the new directory; untar it as well.
tar xvf charm*.tar.gz
Symlinking Compilers
Before going into building charm++, there's one potential hiccup that needs to be moved out of the way. Apparently, charm++ doesn't like being compiled with 4.x GNU compilers. The fix for this is relatively easy. First, make sure you have an older version of gcc and g++ with
apt-get install g++-3.4 gcc-3.4
This will put the binaries in /usr/bin. If you do ls -al | grep gcc, you should see that gcc is just a symlink to the binary with the version information. Both the symlinks for gcc and g++ need to temporarily changed to point to the 3.4 versions. To do this, cd into /usr/bin and remove the old symlinks with
rm gcc g++
Then, create new ones with
ln -s gcc-3.4 gccln -s g++-3.4 g++
Now you're ready to proceed with building charm++. Afterward, to reverse the process, remove the existing symlinks again, and then recreate the previous ones using
ln -s gcc-4.3 gccln -s g++-4.3 g++
Building Charm++...
Charm should be installed before NAMD, since NAMD will use it. Move into the new charm directory (cd charm*). Unlike most scientific packages, Charm doesn't follow the traditional source installation paradigm; there's no ./configure script. Instead, all of the action happens with ./build.
./build --help
will show all of the options. A few important ones include
charm++- you just want the base installation of Charm++mpi-linux- use Linux and MPI as the platform, assuming you have it installed, otherwise use net-linux--base-dir=- use this to point to where your MPICH libraries are. For instance, mine are on my NFS mount.gcc- compiler to use-O- use optimization
You'll need to modify this based on your system - for instance, if you're using a 64-bit architecture. The line I ran was
./build charm++ mpi-linux --basedir=/shared gcc -O
Once it finishes (and it may take a while), you'll see this message:
------------------------------------------------- charm++ built successfully. Next, try out a sample program like tests/charm++/simplearrayhello
Testing the Charm++ Build
Now you're ready to test the installation. The test I'm using is the same as "notes.txt" provided in the NAMD tarball. Before testing, however, open up charm-5.9/include/conv-mach.sh and find the line that starts with CMK_LIBS. Add -pthread it to look like this:
CMK_LIBS='-lckqt -lmpich -pthread'
Let's finally test the build. You should see a new directory created in /charm-5.9 after the installation finishes, named after the type of installation you just finished. For instance, my directory is called mpi-linux-gcc. Cd into the new directory, then into tests/charm++/megatest/, and run
make pgm
Then, make sure you have an mpd daemon running (mpd --daemon to run it as a daemon), and run the binary that was created with
./charmrun -np 2 ./pgm
It may take quite awhile. With two processes, mine takes about ten minutes, and an especially long amount of time on the "immediatering (gengbin)" steps. If it finishes successfully, you'll see
All tests completed, exiting End of program
and then charm++ should be good to go. Clean up your tracks by killing the mpd with mpdallexit and you can continue on to building NAMD.

