Installation
Requirements
The project currently requires:
A C++23 compiler. The code is tested with GCC 14 and newer, and with Clang 19.
CMake 3.24 or newer. Recent CMake is needed in order to use the shipped presets directly.
Conan 2 is optional, but convenient if you want CMake to install dependencies through the Conan-based presets or through DMRG_PACKAGE_MANAGER=conan. A minimal setup is:
python -m pip install conan
conan profile detect
conan remote add conan-dmrg https://neumann.theophys.kth.se/artifactory/api/conan/conan-dmrg
The conan-dmrg remote is needed in order to fetch the current version of h5pp.
Dependencies
xDMRG++ depends on a number of external libraries for dense and sparse linear algebra, tensor operations, file I/O, and command-line parsing.
Some BLAS, LAPACK and Lapacke implementation. Typical choices are FlexiBLAS, Intel MKL, or OpenBLAS. The CMake variable
BLA_VENDORcan be used to guide detection.Eigen for matrix algebra and tensor operations.
TBLIS for selected tensor contractions.
Arpack for iterative eigenvalue problems.
Arpackpp as a C++ front-end to Arpack.
PRIMME for iterative eigenvalue calculations.
h5pp as the HDF5 wrapper used for simulation output.
CLI11 for command-line parsing.
Backward-cpp for stack traces.
If you use the find dependency mode, these libraries must already be visible to CMake through your environment, your package manager, or explicit hints such as <PackageName>_ROOT.
Quick start with CMake Presets
The recommended way to configure the project is with CMake presets. A preset gives a name to a complete CMake configuration, including the build directory, build type, dependency provider, and toolchain-related settings.
A typical example is release-cmake-flexiblas-native:
git clone git@github.com:DavidAce/xDMRGpp.git
cd xDMRGpp
cmake --list-presets
cmake --preset release-cmake-flexiblas-native
cmake --build --preset release-cmake-flexiblas-native
./build/release-cmake-flexiblas-native/xDMRG++ --config input/default.cfg
The configure step creates the build tree under build/release-cmake-flexiblas-native. After the executable has been built, you can edit input/default.cfg or point --config to another file under input/.
For most users this is the least error-prone way to build the project, because the preset already fixes the generator, build directory, and several toolchain choices.
Automatic Dependency Installation
The CMake variable DMRG_PACKAGE_MANAGER selects how dependencies are found or installed:
Option |
Description |
|---|---|
|
Use CMake’s |
|
Use the CMake dependency provider to download and install dependencies during configure. |
|
Use Conan-based dependency resolution. The presets with |
The find mode is usually the right choice when you manage dependencies with your operating system, Conda, Spack, a site installation on a cluster, or a manually maintained environment. The cmake and conan modes are useful when you want a more self-contained setup.
CMake Options
Pass CMake options as -D<OPTION>=<VALUE> during configure.
Var |
Default |
Description |
|---|---|---|
|
|
Select the automatic dependency manager: |
|
|
Enable |
|
|
Enable |
|
|
Build explicit instantiations for |
|
|
Build explicit instantiations for |
|
|
Build explicit instantiations for the |
|
|
Build explicit instantiations for |
|
|
Build explicit instantiations for |
|
|
Build explicit instantiations for the |
|
|
Use TBLIS for selected tensor contractions instead of Eigen. |
|
|
Enable unit tests and CTest targets. |
|
|
Build example programs. |
|
|
Build auxiliary tools. |
|
|
Build the documentation. |
|
|
Print extra information during CMake configuration. |
|
|
Enable threaded Eigen tensor operations. |
In addition, variables such as <PackageName>_ROOT and <PackageName>_DIR can be used to help CMake locate dependencies when DMRG_PACKAGE_MANAGER=find.