How to compile AmberTools 1.5 and AMBER 11 with Ubuntu 10.04.3 LTS

(V1.03)

This how to assumes:

a) A fresh install of Ubuntu 10.04.3 LTS or an instance of it running from the live CD (the live CD route is possible but will require a lot of ram) on a machine that is connected to the Internet.

b) The presence of AmberTools-1.5.tar.bz2 and Amber11.tar.bz2 source code archives in the user's home directory. AmberTools 1.5 can be downloaded from the AMBER website and AMBER11 is obtained when one orders it. Here are the respective archives’ md5sums:

40c0c2b49a4bcd3916d11b8f014398f5  Amber11.tar.bz2

4bd929969179e8639ff36537e4f83b26  AmberTools-1.5.tar.bz2

OS related preamble

Various tools and libraries are needed to compile AMBER and AmberTools; this preamble ensures that they are all present before the compiling process starts.

1) If not already done, enable the Universe Repository by modifying /etc/apt/sources.list so that additional needed packages are made available to apt. This can be done graphically via System-> Administration->Software Sources and select the 2nd option (Community-maintained Open Source software (universe) ).

Alternatively this can be done in a command line fashion:

cd /etc/apt

sed '/universe$/ s/^.//' sources.list > /tmp/sources.list

sudo mv sources.list sources.list.backup

sudo mv /tmp/sources.list sources.list

cd ~

2) Since you have modified /etc/apt/sources.list you will need to refresh the apt-get cache.

sudo apt-get update

3) Install the following packages that are needed for the entire compile process:

sudo apt-get install gcc g++ libxt-dev libxext-dev flex gfortran tcsh libnetcdf-dev patch csh bison xorg-dev libbz2-dev

   For MPI, the following is needed:

sudo apt-get install mpich2 libmpich2-dev

   If this fails, one may need to try this:

sudo aptitude install mpich2 libmpich2-dev

Serial compilation

The majority of AMBER programs consist of serial code; and these are generally more straight forward to compile and run. The serial compile for both will be carried out first.

AmberTools

1) Extract AmberTools 1.5 from its archive file:

cd ~

tar xfj AmberTools-1.5.tar.bz2

2) Set the AMBER related environment variables and make them "stick":

cd amber11

echo "export AMBERHOME=$PWD" >> ~/.bashrc

echo "export PATH=$PATH:$AMBERHOME/bin" >> ~/.bashrc

source ~/.bashrc

Sometimes, bugs are found with the code after it has been released and these issues are fixed via patches that modify the source code to fix the respective issue. Hence it is wise to apply these before you start to compile; more details about the specific problems that are fixed can be found here.

3) Download and apply the AmberTools bug fixes to the source code before we start to compile:

wget http://ambermd.org/bugfixes/AmberTools/1.5/bugfix.all

patch -p0 < bugfix.all

rm bugfix.all

Ensure that there are no fail messages from the patch command since this may manifest as an obscure problem later on.

4) Configure and build

cd $AMBERHOME/AmberTools/src

./configure gnu

make serial

5) Wait whilst the compiling proceeds; this can take around 25 minutes on a Pentium 4, 3GHz. Any errors during this phase should be investigated. When this step has finished, the $AMBERHOME/bin/ directory should now be populated with the resulting binaries that have just been compiled.

There are many steps and external factors involved in generating the final binaries that one will use to run their simulations and a bug in a compiler or a library may result in the binary giving an incorrect answer. Therefore, it is critical to test that the compiled binaries give the correct answer. This is done by giving known inputs to the binaries and comparing the corresponding outputs against saved, known, “good” outputs.

6) Run the serial AmberTools tests

cd $AMBERHOME/AmberTools/test

./test_at_serial.sh

Any differences in the test outputs from the saved outputs will be written to the file:

$AMBERHOME/AmberTools/test/logs/test_at_serial/{date+time of test execution}.diff

It is a good idea to examine this diff file; minor differences in numerical values (e.g. 6th decimal place) may be ignored; larger ones will need investigation.

AMBER

1) Extract the AMBER source from its archive file:

cd $AMBERHOME

cd ..

tar xfj Amber11.tar.bz2

Ideally, one would follow the patching protocol used for AmberTools: download and apply a patch file here. However, there have been a significant number of changes to the AMBER11 code base since its release (specifically the CUDA code in PMEMD), and as a result, the patching process is significantly more complex and fragile, hence a standalone script (apply_bugfix.x) is required to apply these changes.

2) Apply the AMBER bugfixes:

wget http://ambermd.org/bugfixes/11.0/bugfix.all.tar.bz2

wget http://ambermd.org/bugfixes/11.0/apply_bugfix.x

chmod +x ./apply_bugfix.x

./apply_bugfix.x bugfix.all.tar.bz2

3) Reconfigure to avoid issues with NETCDF headers

cd $AMBERHOME/AmberTools/src

./configure gnu

4) Compile

cd $AMBERHOME/src

make serial

5) Run the serial AMBER tests (takes around 1:30 hours on a P4 3 GHz)

cd $AMBERHOME/test

./test_amber_serial.sh

Any differences in the test outputs from the saved outputs will be written to the file:

$AMBERHOME/test/logs/test_amber_serial/{date+time of test execution}.diff

Parallel Compilation

Some programs within the AMBER distribution have the ability to be run in parallel, utilising either, multiple cores on desktop machines or many CPUs on supercomputer clusters.  Accordingly, these codes need to be compiled in a slightly different manner to ensure they utilise the machine’s MPI implementation. Within this example, we are using the mpich2 MPI implementation that has been installed in the preamble section.

[Note from DAC: you can use instead the "configure_openmpi" or "configure_mpich2" scripts in $AMBERHOME/AmberTools/src to compile MPI from source.  These scripts should provide a correct configuration and not interfere with anything outside the $AMBERHOME tree.]

AmberTools

1) Configure for the MPI build:

cd $AMBERHOME/AmberTools/src

make clean

./configure -mpi gnu

2) Compile:

make parallel

When this step has finished, the $AMBERHOME/bin/ directory should now be populated with extra MPI enabled binaries, which are generally suffixed with “.MPI”. The next few steps pertain to the parallel testing of these.

3) If not already done, create a ~/.mpd.conf in one’s home directory with a random secret:

echo "MPD_SECRETWORD=ewfwfwegw" > ~/.mpd.conf

chmod 600 ~/.mpd.conf

Do not use the example random string used for the secretword here; generate your own.

4) Start the MPI daemon:

        mpd &

5) Set the following environment variable to let the test scripts know what type of MPI invocation is needed. Here, we are going to run over two threads:

        export DO_PARALLEL=”mpirun -np 2”

6) Run the AmberTools parallel tests:

cd $AMBERHOME/AmberTools/test

./test_at_parallel.sh

Any differences in the test outputs from the saved outputs will be written to the file:

$AMBERHOME/AmberTools/test/logs/test_at_parallel/{date+time of test execution}.diff

AMBER

1) Compile parallel AMBER

cd $AMBERHOME/src

make clean

make parallel

2) Test the MPI enabled AMBER. Assuming that one has setup a ~.mpd.conf file, mpd is running and the DO_PARALLEL environment varible is set, run:

cd $AMBERHOME/test

        ./test_amber_parallel.sh

Any differences in the test outputs from the saved outputs will be written to the file:

$AMBERHOME/test/logs/test_amber_parallel/{date+time of test execution}.diff