Skip to content

CMake options

Urs Hähner edited this page Aug 27, 2019 · 12 revisions

CMake options can either be specified with the -D flag:

$ cmake /path/to/source -D<variable1>=<value1> -D<variable2>=<value2> ...

or using the ccmake interface, which is launched in the exisiting build directory (after cmake was called) with:

$ ccmake .

Build type

Option Default value Description
CMAKE_BUILD_TYPE The build type.
Options are: [empty], Debug, Release, RelWithDebInfo, MinSizeRel.

According to the build type CMake sets different optimization and debug compiler flags.
Release is recommended for production runs.

FFTW3

Option Default value Description
FFTW_INCLUDE_DIR Path to fftw3.h.
FFTW_LIBRARY The FFTW3(-compatible) library.

If the -D flag is used, multiple libraries have to be separated by semicolons and enclosed by double quotes:

-DFFTW_LIBRARY="/path/to/lib1.a;/path/to/lib2.a"

BLAS and LAPACK

If you use a compiler wrapper that automatically links against BLAS and LAPACK libraries, you can prevent CMake from searching for these libraries by adding the following option to the cmake command:

-DDCA_HAVE_LAPACK=TRUE

MPI

Option Default value Description
DCA_WITH_MPI ON Enable MPI.

If MPI is enabled, CMAKE_CXX_COMPILER must be set to the MPI compiler wrapper.

APPLICATIONS

Option Default value Description
DCA_BUILD_DCA ON Build main_dca.cpp.
DCA_BUILD_ANALYSIS ON Build main_analysis.cpp.
DCA_BUILD_CLUSTER_SOLVER_CHECK OFF Build cluster_solver_check.cpp.

TESTS

Option Default value Description
DCA_WITH_TESTS_FAST OFF Build DCA++'s fast tests.
DCA_WITH_TESTS_EXTENSIVE OFF Build DCA++'s extensive tests.
DCA_WITH_TESTS_PERFORMANCE OFF Build DCA++'s performance tests. (Only in Release mode.)
TEST_RUNNER Command for executing (MPI) programs. Required if MPI is enabled or on systems that use a command for launching executables (e.g. aprun or srun).
MPIEXEC_NUMPROC_FLAG -n Flag used by TEST_RUNNER to specify the number of processes.
MPIEXEC_PREFLAGS Flags to pass to TEST_RUNNER directly before the executable to run.

GPU

Option Default value Description
DCA_WITH_CUDA OFF Enable GPU support.
DCA_WITH_PINNED_HOST_MEMORY OFF Enable pinned host memory. (advanced)
CUDA_GPU_ARCH sm_60 Name of the real architecture to build for.
CUDA_TOOLKIT_ROOT_DIR Path to the CUDA Toolkit. Determined by CMake.
Set it manually, if CMake cannot find it.
MAGMA_DIR Path to the MAGMA installation directory. Hint for CMake to find MAGMA.

In some cases it is necessary to set the environment variable CUDA_LIB_PATH in order for CMake to find CUDA.

Further options

Option Default value Description
DCA_CLUSTER_SOLVER CT-AUX The cluster solver for the DCA(+) loop. Options are: CT-AUX, SS-CT-HYB.
DCA_WITH_THREADED_SOLVER ON Use multiple walker and accumulator threads in the cluster solver.
DCA_LATTICE square Lattice type, options are: bilayer, square, triangular, twoband_chain, singleband_chain.
DCA_POINT_GROUP D4 Point group symmetry, options are: C6, D4.
DCA_MODEL tight-binding Model type, options are: tight-binding.
DCA_RNG std::mt19937_64 Random number generator, options are: std::mt19937_64, std::ranlux48, custom.
See Random number generator for details.
DCA_RNG_CLASS Class name including namespaces of the custom random number generator.
DCA_RNG_HEADER Header file of the custom random number generator.
DCA_RNG_LIBRARY Custom random number generator library.
DCA_PROFILER None Profiler type, options are: None, Counting, PAPI.
DCA_WITH_AUTOTUNING OFF Enable auto-tuning. Needs a profiler type other than 'None'. (advanced)
DCA_WITH_GNUPLOT OFF Enable Gnuplot.
DCA_WITH_SINGLE_PRECISION
_MEASUREMENTS
OFF Measure in single precision.
DCA_WITH_SINGLE_PRECISION
_COARSEGRAINING
OFF Coarsegrain in single precision. (advanced)
DCA_WITH_QMC_BIT OFF Enable QMC solver built-in tests. (advanced)

Examples

All examples assume the directory tree:

	|____build (current working directory)
	|____dca_source
  1. Builds main_dca, main_analysis (default) and the fast tests. MPI is disabled.

     $ cmake ../dca_source \
     	-DFFTW_INCLUDE_DIR=/opt/local/include \
     	-DFFTW_LIBRARY=/opt/local/lib/libfftw3.a \
     	-DDCA_WITH_MPI=OFF \
     	-DDCA_WITH_TESTS_FAST=ON
    
  2. Builds main_dca, main_analysis (default) and both fast and extensive tests with MPI enabled (default) and debug flags. TEST_RUNNER is set to the mpirun command corresponding to the MPI compiler wrapper, that has been assigned to CXX in the first line.

     $ CXX=/opt/local/bin/mpicxx-mpich-clang36 cmake ../dca_source \
     	-DCMAKE_BUILD_TYPE=Debug \
     	-DFFTW_INCLUDE_DIR=/opt/local/include \
     	-DFFTW_LIBRARY=/opt/local/lib/libfftw3.a \
     	-DDCA_WITH_TESTS_FAST=ON \
     	-DDCA_WITH_TESTS_EXTENSIVE=ON \
     	-DTEST_RUNNER=/opt/local/bin/mpirun-mpich-clang36
    
  3. CSCS Piz Daint [Cray XC40 (multi-core)]
    Builds main_dca and main_analysis (default) with MPI enabled (default) and optimization flags. BLAS and LAPACK are automatically linked by the compiler wrapper CC. TEST_RUNNER is set to the system's command to launch applications, srun.

     $ cmake ../dca_source/ \
     	-DCMAKE_BUILD_TYPE=Release \
     	-DDCA_HAVE_LAPACK=TRUE \
     	-DTEST_RUNNER=srun
    
  4. CSCS Piz Daint [Cray XC50 (hybrid CPU-GPU)]
    Builds main_dca and main_analysis (default) with MPI (default) and GPU support enabled and optimization flags. The path to the CUDA toolkit is set and the directory to the MAGMA installation directory speficied (MAGMA is assumed to be installed with EasyBuild). BLAS and LAPACK are automatically linked by the compiler wrapper CC. TEST_RUNNER is set to the system's command to launch applications, srun.

     $ cmake ../dca_source/ \
     	-DCMAKE_BUILD_TYPE=Release \
     	-DDCA_HAVE_LAPACK=TRUE \
     	-DTEST_RUNNER=srun \
     	-DDCA_WITH_CUDA=ON \
     	-DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/cudatoolkit8.0/8.0.44_GA_2.2.7_g4a6c213-2.1 \
     	-DMAGMA_DIR=$EBROOTMAGMA