You need:
Optional:
To build DBCSR's GPU backend:
opencl-headers), generic loader "ocl-icd" (ocl-icd-opencl-dev),DEFAULT (nvidia-smi -c DEFAULT) if MPI puts multiple ranks onto a single GPU;
MPS daemon with GPU mode EXCLUSIVE_PROCESS is not an optionclinfo (can be useful to show available devices)DBCSR is tested against GNU and Intel compilers on Linux systems, and GNU compiler on MacOS systems. See a list of supported compilers here.
Download either a release tarball or clone the latest version from Git using:
git clone --recursive https://github.com/cp2k/dbcsr.git
DBCSR can be compiled in four main variants: * Serial, i.e., no OpenMP and no MPI * OpenMP * MPI * OpenMP+MPI In addition, the variants can support accelerators.
Run inside the dbcsr directory:
mkdir build
cd build
cmake ..
make
The configuration flags for the CMake command are (default first):
-DUSE_MPI=<ON|OFF>
-DUSE_OPENMP=<ON|OFF>
-DUSE_LIBXS=<ON|OFF>
-DLIBXSROOT=<path>
-DUSE_LIBXSMM=<ON|OFF>
-DLIBXSMMROOT=<path>
-DUSE_ACCEL=<opencl|cuda|hip>
-DLIBXSTREAMROOT=<path>
-DWITH_CUDA_PROFILING=<OFF|ON>
-DWITH_HIP_PROFILING=<OFF|ON>
-DWITH_C_API=<ON|OFF>
-DWITH_EXAMPLES=<ON|OFF>
-DWITH_GPU=<P100|K20X|K40|K80|V100|Mi50|Mi100|Mi250|Mi300|Mi350>
-DCMAKE_BUILD_TYPE=<Release|Debug|Coverage>
-DBUILD_TESTING=<ON|OFF>
-DTEST_MPI_RANKS=<2|auto|N>
-DTEST_OMP_THREADS=<2|N>
When providing prebuilt LIBXS or LIBXSTREAM installations, either set LIBXSROOT and LIBXSTREAMROOT explicitly or make sure their lib directories are available to pkg-config before running cmake. For example, if LIBXS and LIBXSTREAM were checked out and built in your home folder:
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${HOME}/libxs/lib:${HOME}/libxstream/lib"
LIBXSMM is still useful as an optional CPU JIT kernel provider through LIBXS. If a prebuilt LIBXSMM should be used, set LIBXSMMROOT or make its pkg-config metadata visible in the same way.
For build recipes on different platforms, make sure to also read the CMake Build Recipes.
DBCSR and its dependencies can be built with the spack package manager:
spack install dbcsr +openmp +mpi +cuda cuda_arch=70
spack install dbcsr +openmp +mpi +rocm amdgpu_target=gfx906
spack install dbcsr +openmp +mpi +opencl ^cuda
See spack info dbcsr for all supported variants.
If MPI support is enabled (the default), the C API is automatically built.