Automate machine config for CMake
On HPC's, CMake often can't set parameters properly since HPC's have their special features: location of compilers, libraries, headers; flags of compilers, linkers ... etc.
So when you compile ALPS, you might have to set parameters by yourself with many command line options.
$ cmake -DALPS_ .... -DCMAKE_CXX_COMPILER=....
To reduce your effort, please make a machine-config file in which proper parameters for your machine are assigned. And it will benefit to other users. Once you write it, then you just type as below.
$ cmake -DALPS_USE_MACHINE=your-machine-name
$ cmake -DALPS_USE_MACHINE=/full/path/to/your/configfile.cmake
- Write in CMake language, Not in CMakeCache.txt style.
- Filename must have the suffix ".cmake".
- If you set only your-machine-name, place your configure files in the directory 'alps/config', and the filename must be "your-machine-name.cmake".
- When you use full-path filename, you can locate your config file in anywhere you want.
List of available machine configs
There are no machine config files for Brutus, simply because it's not necessary if you follow the instructions below. I have two configurations for Brutus; both based on gcc, one with, one without MPI. Boost has to be downloaded and unpacked by the user; as usual, no need to do anything beyond unpacking! If you load the correct modules, everything is recognized automatically except and lp_solve which is not installed on Brutus.
The modules are:
module load mkl cmake gsl hdf5 python/2.6.5 module load mkl cmake gsl hdf5 python/2.6.5 open_mpi
If Python fails on importing numpy, you may need to also load the module goto2.
To build alps on rosa run, download Boost and execute:
module load hdf5 PrgEnv-gnu export PATH=/apps/ela/cmake/2.8.0/gnu_4.4.2/bin:$PATH cmake -DALPS_USE_MACHINE=rosa -DCMAKE_INSTALL_PREFIX:PATH=<path/to/alps-install-dir> -DBoost_ROOT_DIR:PATH=<path/to/boost-source-dir> <path/to/alps-source-dir>
Comments on writing config files
Initialization process of CMake seems not so clear since there is not detailed document on it.
For example, project() command clears compiler flags defined by CMAKE_CXX_FLAGS. If you want to reflect the flags assigned in your configure file, you have to set it as CACHE variable with FORCE option.
set (CMAKE_CXX_FLAGS CACHE STRING "some comments" FORCE)
Probably, this is because flags can be different for each targets.
ALPS on the HPC of the RWTH-Aachen
As a first step you have to install cmake to a directory within your home directory (first untar then boostrap --prefix /home/.../cmakebin). Write a small scipt e.g. 'load_alps.sh' containing:
module switch intel gcc/4.3 module load intelmpi/3.1 module load LIBRARIES module load acml module load python/2.5.2 module load intelmkl
execute it with make it with:
make a build directory and execute from there:
/home/../cmakebin/cmake -D Boost_ROOT_DIR:PATH=/home/path-to-boost -DCMAKE_INSTALL_PREFIX=/home/.../alpsbin /home/../path-to-alps-source/ -DBUILD_SHARED_LIBS=OFF
when submitting a job load the same module in the submitting script then for installation e.g.
#$ -N DMFT_SQ #$ -l h_rt=09:59:00 #$ -l h_vmem=1024M #$ -pe mpi* 2 #$ -cwd #$ -M firstname.lastname@example.org #$ -m e module switch intel gcc/4.3 module load intelmpi/3.1 module load LIBRARIES module load acml module load python/2.5.2 module load intelmkl $MPIEXEC $FLAGS_MPI_BATCH dmft DMFT1