What is cmakethe cross-platform, open-source build system Build QMCPACK with cmakeTo build the package, move to build directory, run cmake and make:
How it works
topdir/CMakeLists.txt is the main file which
The current default build uses
cmake files (CMakeLists.txt, CMakeCache.txt and those with cmake extension) are text files; you can read them, make sense out of them and modify them. Our-of-source compilationAlways use out-of-source compilation with cmake. The procedure above, using build directory (empty) and running camke in build, is an example. We can further separate the source (development) and build. Let's assume that the QMCPACK topdir is /home/foo/src/qmcpack. Then, one can build multiple executables in different locations by creating new directories and build QMCPACK in each directory. /home/foo/build/gcc-real/home/foo/build/gcc-complex/home/foo/build/mpi-realIn each directory, e.g., /home/foo/build/gcc-real (after setting the environments properly), execute
There is no need to change sources or cmake files. cmake .. in the main procedure uses .. because the source tree resides in the parent directory. If something did not work, simply remove the directory (e.g., rm -rf gcc-real) and start again. Building with environment variablesThis method works with GNU, Intel, and IBM XLC compilers. When the libraries are installed in standard locations, e.g., /usr, /usr/local, there is no need to set the XYZ_HOME for XYZ package. Set the environments (the examples below assume bash, Intel compilers and MKL library) How to overwrite the default build CMakeLists.txt can be edited before cmake step.
Several variables can be overwritten at cmake step by passing arguments to cmake. For example To disable MPI, cmake -DQMC_MPI=0 ..
In addition to QMCPACK-defined variables, there are many cmake variables that can be manipulated the same way. Check out cmake wiki. During cmake step, CMakeCache.txt file is created in the build directory. As the name implies, it contains cached variables that are used during the build stage. This file can be edited to modify the cached variables above. Selecting compilers
Development and testing are done mostly on LINUX systems using Intel 10.x or GNU 4.2 and higher compilers. Older compilers will work but supports for OpenMP both at the compiler and run time may not be good. We strongly encourage people to move on to new compilers whenever possible: they are usually getting better with few exceptions, which will be posted on this wiki whenever such cases are encountered. Building with a toolchain fileSeveral toolchain files used by the developers are available in config directory. They are used on large-scale parallel machines where setting up all the necessary packages can be tricky.
Check CMakeToolchain for the descriptions of the toolchain file and cmake variables. Once a suitable toolchain file is found, follow these step (example on abe.ncsa.uiuc.edu): cd buildcmake -DCMAKE_TOOLCHAIN_FILE=../config/AbeMvapich2.cmake -DCMAKE_VERBOSE_MAKEFILE=TRUE ..cmake -DCMAKE_TOOLCHAIN_FILE=../config/AbeMvapich2.cmake -DCMAKE_VERBOSE_MAKEFILE=TRUE ..makeEnabling MPI and/or OpenMPMPIMPI is automatically enabled if
One of these actions will disable MPI
export QMC_MPI=0
SET(QMC_MPI 0) OpenMPOpenMP is enabled by default in CMakeLists.txt.
One of these actions will disable OpenMP
export QMC_OMP=0
If your machine has multiple cores, there is no need to disable OpenMP. However, make sure to set the environment variables which control OpenMP runs. Especially with MKL, set MKL_NUM_THREADS=1MKL_SERIAL=YESso that the blas/lapack calls DO NOT USE threaded version. Note that the default number of threads on your machine may be set to the number of cores (or CPU units). It is always safe to set the number of threads yourself as export OMP_NUM_THREADS=1 |