Compiling AMS from Sources¶
THIS INFO IS ONLY RELEVANT FOR PEOPLE WITH A SOURCE CODE LICENSE! If you are unsure what this means, you can most likely skip reading this page!
Compiling AMS from sources by end users is not supported on Windows. The following instructions apply to Linux/Unix and Mac OS X only. Compiling AMS2019 from sources is supported for ifort version 18.0.2 with MKL and IntelMPI on linux.
Unpacking the distribution¶
Installing AMS with recompilation in mind is somewhat different from the binary-only installation. The downloaded source and binary tarballs must be unpacked in the following order (using IntelMPI on x86_64-linux in this example):
# First sources tar xzf adf2019.101.src.tgz # Then binaries tar xzf adf2019.101.pc64_linux.intelmpi.bin.tgz
The result will be a adf2019.101 directory containing both binaries (for your platform) and sources.
Note that for Mac OS X, the downloading of the binaries is different. Follow the instructions for downloading and installation of the binaries. Copy the binaries from the downladed disk image to the directory adf2019.101 that was created from the source code. Depending oin where you have put the binaries it could be something like:
cp -r /Applications/ADF2019.101.app/Contents/MacOS/ADF.app/Contents/Resources/adfhome/* adf2019.101
Setting up environment¶
In addition to the standard environment variables discussed in the Installation manual, you may need to set additional ones depending on your platform:
- I_MPI_ROOT: this variable must be set if compiling with IntelMPI on linux (the default)
- MPIDIR: may be needed in the case of compiling AMS with non-default MPI, for example OpenMPI on linux.
- MATHDIR: this should be set to the the MKL root folder. If MKLROOT is defined and MATHDIR is not, then MKLROOT will be used.
After unpacking everything and setting up your environment properly, you need to run the configure script. This script is located in the $ADFHOME/Install directory, and it must be executed from the $ADFHOME directory. The script replaces some files in the bin directory with versions specifically targeted for your system. Further, configure creates the buildinfo file that you will need to compile AMS.
To see what options the configure script supports, use configure -h:
cd $ADFHOME Install/configure -h
Configure can set up multiple build targets with different configuration options using the -b flag. The options regarding your build target should be wrapped in quotes following a -b flag, starting with the build name. The -b flag can be used multiple times to create different build targets. For example, to create a target with all current release build options:
cd $ADFHOME Install/configure -b "release -p intelmpi -meadshared -dynamicmkl -plumed"
If a different MPI version is needed (for example OpenMPI) as well as a defaults target, simply run:
cd $ADFHOME Install/configure -b "mydefaulttarget" -b "myompitarget -p openmpi"
Next, you need to compile the sources by executing foray located in $ADFBIN. Foray supports parallel compilation to make things faster, use -j N to tell foray you want it to use N processes (for example: -j 4 on a quadcore machine):
cd $ADFHOME bin/foray -j 4
After a while, depending on the speed of your computer, everything should be ready to use, just as if you had installed the precompiled executables but now with your modifications included. Use bin/foray -h to get a list of all foray options.