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.
=== Usage: ===
$ cmake -DALPS_USE_MACHINE=your-machine-name
$ cmake -DALPS_USE_MACHINE=/full/path/to/your/configfile.cmake
=== Requirements: === - 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
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! Everything else is recognized automatically.
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
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.