Installation

Dependencies

SLIM4 relies on the following external libraries:

  • PROJ for coordinate transformations.

  • METIS for mesh partitioning.

Both libraries must be installed on the system prior to building slim4.

Python Dependencies

Slim4 requires the following Python packages for core functionality:

The following packages are additionally required for preprocessing and post-processing utilities:

Some examples may require additional Python packages depending on the specific workflow or external data formats used.

Basic Installation

By default, slim4 compiles for the CPU using double-precision scalars and MPI for parallelism. The standard installation procedure is:

git clone https://git.immc.ucl.ac.be/slim/slim4.git
mkdir build
cd build
cmake ..

Add slim4 to your PYTHONPATH:

export PYTHONPATH=$PYTHONPATH:/path/to/slim4/build

Advanced Installation

The default configuration prioritizes portability, often at the cost of performance. The following options are available:

Compilation Targets

SLIM currently supports CPUs and NVIDIA/AMD GPUs through ava. Support for SYCL may be added in the future. The default target is the CPU. To change it, use DAVA_TARGET:

cmake .. -DAVA_TARGET=cpu
cmake .. -DAVA_TARGET=cuda
cmake .. -DAVA_TARGET=hip
cmake .. -DAVA_TARGET=hipcpp

hipcpp should be used when the HIP compiler also serves as the host C++ compiler (i.e. no separate hipcc executable), for example on the LUMI supercomputer.

Target Architecture

Specify the target architecture. This is passed to the compiler via:

  • -march=... for CPU

  • -arch=... for CUDA

  • -offload-arch=... for HIP

The default is native. Examples:

cmake .. -DAVA_ARCH=native   # default
cmake .. -DAVA_ARCH=OFF      # let the compiler decide
cmake .. -DAVA_ARCH=sm_80    # NVIDIA A100
cmake .. -DAVA_ARCH=...

Scalar precision

Slim4 uses 64-bit precision (double) by default. Select the scalar type with:

cmake .. -DSCALAR=double   # 64-bit (default)
cmake .. -DSCALAR=float    # 32-bit

Index Type

Slim4 uses 32-bit indexing by default. Enable 64-bit indexing for large domains with:

cmake .. -DINDEX64=OFF   # default
cmake .. -DINDEX64=ON    # 64-bit indexing

MPI and Distributed Parallelism

Slim4 supports several MPI communication modes, selected via COMM_TYPE:

cmake .. -DCOMM_TYPE=OFF            # disable MPI
cmake .. -DCOMM_TYPE=MPI            # standard MPI (CPU copy)
cmake .. -DCOMM_TYPE=GPU_AWARE_MPI  # GPU-aware MPI
cmake .. -DCOMM_TYPE=XCCL           # NCCL/RCCL backend

MPI is the default and works on all systems. GPU_AWARE_MPI is generally preferred when available. XCCL uses NCCL (NVIDIA) or RCCL (AMD), but is not actively maintained.

OFF disables MPI entirely.

For GPU builds, slim4 uses one GPU per MPI rank. Multiple GPUs therefore require MPI. Sharing a GPU across ranks is strongly discouraged due to performance degradation.

For CPU builds, slim4 uses TBB for parallelism by default. If needed, disable it with:

cmake .. -DAVA_ENABLE_TBB=OFF

Implicit Support

Slim4 can be compiled with optional support for implicit time integration:

cmake .. -DIMPLICIT=ON
cmake .. -DIMPLICIT=OFF

This requires either PETSc or CUDSS.

For PETSc, you may need to set the PETSC_DIR and PETSC_ARCH environment variables. Enable solvers with:

cmake .. -DENABLE_PETSC=ON
cmake .. -DENABLE_CUDSS=ON

If both are enabled, Slim selects CUDSS for single-GPU runs and PETSc otherwise.

PETSc must be compiled with the same precision as slim4.

C++ Backtrace

Slim4 uses cpptrace to provide C++ stack traces for improved error reporting and debugging.

Enable or disable support with:

cmake .. -DENABLE_CPPTRACE=ON
cmake .. -DENABLE_CPPTRACE=OFF

Cpptrace support is enabled by default. If cpptrace is not found on the system, it is downloaded automatically during the build process.

Array Bounds Checking

Enable runtime array bounds checking with:

cmake .. -DAVA_ENABLE_ARRAY_CHECK=ON
cmake .. -DAVA_ENABLE_ARRAY_CHECK=OFF

This is disabled by default (except in debug builds) and significantly impacts performance.

Debugging Options

Enable AddressSanitizer (ASAN) with:

cmake .. -DENABLE_ASAN=ON

You may need to preload the ASAN library:

LD_PRELOAD=/usr/lib/libasan.so

Recommended ASAN options:

export ASAN_OPTIONS=protect_shadow_gap=0:replace_intrin=0:detect_leaks=0

protect_shadow_gap=0 is required when using CUDA.