Skip to content

CMake installation

Minimal requirements

  • a C++20 compiler (gcc 11 or newer) and CMake 3.22 or newer;
  • an MPI implementation (OpenMPI, MPICH, ...);
  • zlib (compression of the checkpoint files, e.g. sudo apt install zlib1g-dev);
  • CUDA (optional, for the GPU version).

CMake 4.x

yaml-cpp 0.6.3 is not compatible with CMake 4.x (the build fails with a cmake_minimum_required error). If your system ships a newer CMake, install an older one (for example spack install cmake@3.27.9 and spack load cmake@3.27.9) before running the steps below.

yaml-cpp

spack install yaml-cpp@0.6.3
spack load yaml-cpp@0.6.3
sudo apt install libyaml-cpp-dev
1
2
3
4
5
6
7
8
export CURRENT_HOME=$PWD
git clone --depth 1 --branch yaml-cpp-0.6.3 https://github.com/jbeder/yaml-cpp.git
mkdir ${CURRENT_HOME}/build-yaml-cpp && cd ${CURRENT_HOME}/build-yaml-cpp
cmake ../yaml-cpp/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CURRENT_HOME}/install-yaml-cpp \
      -DYAML_BUILD_SHARED_LIBS=ON -DYAML_CPP_BUILD_TESTS=OFF
make install -j 4
cd ${CURRENT_HOME}
export PATH_TO_YAML=$PWD/install-yaml-cpp

After the build, you can remove the source and build directories (yaml-cpp/ and build-yaml-cpp/).

Note

The variable PATH_TO_YAML is now set: append -DCMAKE_PREFIX_PATH=${PATH_TO_YAML} to every subsequent cmake command (onika and hippoLBM). This is not needed with spack or apt-get.

onika

1
2
3
4
5
6
7
8
export CURRENT_HOME=$PWD
git clone --branch v1.1.0 https://github.com/Collab4exaNBody/onika.git
mkdir ${CURRENT_HOME}/build-onika && cd ${CURRENT_HOME}/build-onika
cmake ${CURRENT_HOME}/onika -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CURRENT_HOME}/install-onika \
      -DONIKA_BUILD_CUDA=OFF
make install -j 10
export onika_DIR=${CURRENT_HOME}/install-onika
rm -rf ${CURRENT_HOME}/build-onika

Select the compute capability of your GPU for CMAKE_CUDA_ARCHITECTURES (86 in this example).

1
2
3
4
5
6
7
8
export CURRENT_HOME=$PWD
git clone --branch v1.1.0 https://github.com/Collab4exaNBody/onika.git
mkdir ${CURRENT_HOME}/build-onika && cd ${CURRENT_HOME}/build-onika
cmake ${CURRENT_HOME}/onika -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CURRENT_HOME}/install-onika \
      -DONIKA_BUILD_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86
make install -j 10
export onika_DIR=${CURRENT_HOME}/install-onika
rm -rf ${CURRENT_HOME}/build-onika

Copy the onika repository (v1.1.0) onto TOPAZE first. The yaml-cpp module can be loaded with module load yaml-cpp.

module load gnu/13.2.0 cuda/12.4 mpi/openmpi/4.1.6 cmake/3.29.6
cd $CCCSCRATCHDIR
export CURRENT_HOME=$PWD
# copy onika v1.1.0 into ${CURRENT_HOME}/onika
mkdir ${CURRENT_HOME}/build-onika && cd ${CURRENT_HOME}/build-onika
cmake ${CURRENT_HOME}/onika -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CURRENT_HOME}/install-onika \
      -DONIKA_BUILD_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=80
make install -j 10
export onika_DIR=${CURRENT_HOME}/install-onika
rm -rf ${CURRENT_HOME}/build-onika

hippoLBM

onika_DIR

Make sure the onika_DIR environment variable is set to your onika installation path before running CMake. If you opened a new shell since installing onika, re-export it:

export onika_DIR=/path/to/install-onika
git clone https://github.com/Collab4exaNBody/hippoLBM.git
mkdir build-hippoLBM && cd build-hippoLBM
cmake ../hippoLBM -DCMAKE_BUILD_TYPE=Release
make -j 4

Replace 86 with the compute capability of your GPU (e.g. 80 for A100, 89 for L40).

cmake ../hippoLBM -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=86
make -j 4
CMake options
Option Default Description
CMAKE_BUILD_TYPE — Release for production runs, Debug to debug
CMAKE_CUDA_ARCHITECTURES — compute capability of the target GPU (CUDA builds of onika)
ONIKA_BUILD_hippo_couette ON builds the optional hippo_couette plugin (bgk_couette_relax, macro_variables_couette_relax)

The build directory contains the hippoLBM executable, a wrapper that sets the onika environment (plugins and default configuration files) and runs the deck given on the command line.

Check the installation

The regression tests are run with ctest in the build directory (see Tests):

ctest

Then run a first example, the Poiseuille flow:

./hippoLBM ../hippoLBM/example/lbm_poiseuille.msp

Alias

To call hippoLBM from any directory, add an alias to your ~/.bashrc (replace YOURDIR by your build directory):

alias hippoLBM='~/YOURDIR/build-hippoLBM/hippoLBM'