Compiling ADF from Sources¶
Compiling ADF from sources by end users is not supported on Windows. The following instructions apply to Linux/Unix and Mac OS X only. Compiling ADF2017 from sources is supported for ifort version 15.0.6 with MKL, and IntelMPI on linux. It is possible to compile with gfortran 4.8 and OpenMPI, but this option is not supported.
Unpacking the distribution¶
Installing ADF 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 adf2017.101.src.tgz # Then binaries tar xzf adf2017.101.pc64_linux.intelmpi.bin.tgz
The result will be a adf2017.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 adf2017.101 that was created from the source code. Depending oin where you have put the binaries it could be something like:
cp -r /Applications/ADF2017.101.app/Contents/MacOS/ADF.app/Contents/Resources/adfhome/* adf2017.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 ADF 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 ADF.
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, but by default it only creates two targets: release and debug. The easiest way to configure is to use all default options (ifort/MKL/OpenMPI on OSX, ifort/MKL/IntelMPI on linux):
cd $ADFHOME Install/configure
If a different MPI version is needed (for example OpenMPI), simply run:
cd $ADFHOME Install/configure -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.