Table of Contents
- Modern C and Fortran compilers (GCC v4.7+ and Intel v11.1+ are known to work).
- Optimised libraries implementing the BLAS, LAPACK and fftw3 specifications.
- Python v2.6+ (https://www.python.org)
- ninja v1.7+ (https://ninja-build.org)
- libxc v2.2+ (http://octopus-code.org/wiki/Libxc) MPI, BLACS, SCALAPACK etc.. are optional.
First of all, clone the repository to your local machine using for example the command below (remember to change ‘
git clone https://<username>@bitbucket.org/lmto/lm.git
In an empty folder, create flags.mk file containing the necessary variables. A working starting example with annotations can be produced with the included genflags.py utility e.g.:
mkdir lm/build cd lm/build ../genflags.py intel opt > flags.mk # if using intel compilers
Due to the wide ranging variability of software environments on compute clusters we are not attempting to fully autoconfigure a complation. We only provide simple example configurations which can be easily customised to any particular environment. If MPI is to be enabled the relevant variables in the file have to be set to the appropriate compiler wrappers or alternatively the MPI header paths and libraries need to be specified, together with the necessary preprocessing flags. An MPI enabled example of flags.mk can be obtained by appending ‘intelmpi’ or ‘openmpi’ to the genflags.py command line arguments above.
In the folder where flags.mk resides, generate a build file with the build.py utility from the source path. Following our example, this amounts to:
The ninja build tool uses the generated build file to compile and link all executables as quickly as possible.
will build target ‘all’ using N+2 (where N == all virtual cores) simultaneous compilation/linking processes. On a well configured system, autocompleting after ‘ninja’ shall list all available targets.
It is advisable to test the build. Each module has a related set of tests which can be invoked with the following command after replacing ‘<modulename>’ with one of the modules: lm, fp, gf, pgf, sx, gwd, optics, tb, mol, dmft, gw.
The following convenience command will start most of the tests:
If compiler optimisations cause erroneous results one may wish to set lower level of optimisations for certain sensitive files only or have a number of different flags applying to different groups of files. If such is the case the flags.mk file may be modified to contain the the special flags for a group of files in a variable beginning with the prefix ‘lessflags’ and ending in a word of one’s choosing. Then a variable beginning with ‘lessfiles’ and ending in the word chosen for the ‘lessflags’ variable, must be defined containing the questionable file names relative to the lm/ path. Many pairs of special flags/sensitive files groups are allowed so long as the contents of the lesserfiles variables do not overlap.
To obtain an example containing special flags try
genflags.py intel opt
On CRAY installations it is advisable to use cray’s compiler wrappers ‘cc’, ‘ftn’ and ‘CC’ with the intel backend. Assuming the default backend is cray
module swap PrgEnv-cray PrgEnv-intel
will switch your environment to intel. The wrappers bundle pretty much all standard system libs (BLAS, LAPACK, SCALAPACK, FFTW3, MPI etc..) except libxc.
genflags.py cray opt
will give a reasonable starting point for such an endeavour.
The executables (and possibly other files in future) can be installed in a path defined in a variable named ‘prefix’ in the flags.mk file. Subsequent ‘ninja install’ will copy only the binaries already build, without introducing any additional dependencies.
Workarounds for problematic systems
- The standard functions diff, zdiff and awk are less versatile than their GNU couterparts. Some of the testing scripts make use of the extra versatility of GNU versions. Before running the standard checks, please install the GNU versions of diff and awk, e.g. using macports. Also copy zdiff from a linux system and park it in the directory where diff is located.
- The BLAS library has some bugs. Some of them have been worked around, but zdotc needs to be replaced. Pick up a distribution of zdotc from here for example. Put it into the slatsm directory, and update SConscript (or Makefile if you are using the old installation)
If FFTW is installed through homebrew, ensure the ‘with-fortran’ option is included
brew install fftw --with-fortran
A similar option is probably required if using, for example, macports.
Intel’s Math Kernel Library (MKL):
- fftw3 is buggy for some special cases, at least in some of the older versions of the library. You can download the fftw3 library from here and install it yourself. The bugs seem to have been corrected in v15 of the library.
Edit This Page