the cross-platform, open-source build system
To build the package, move to build directory, run cmake and make:
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.
Always 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.
In 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.
This 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,
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.
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.
Several 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):
MPI is automatically enabled if
One of these actions will disable MPI
OpenMP is enabled by default in CMakeLists.txt.
One of these actions will disable OpenMP
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
so 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