Skip to content

CMake options

Simulation user Operator developer Framework developer

Main options of Onika's CMakeLists.txt, set with -D<OPTION>=<value> when configuring.

GPU and Python

Option Default Effect
ONIKA_BUILD_CUDA OFF Enables GPU acceleration (CUDA, or HIP with the next option).
ONIKA_ENABLE_HIP OFF Uses HIP instead of CUDA. Requires ONIKA_BUILD_CUDA=ON.
CMAKE_CUDA_ARCHITECTURES Target GPU architectures, e.g. 80 (A100), 90 (H100).
ONIKA_CU_ENABLE_KERNEL_BOUNDS OFF Uses launch bounds to restrict GPU kernels.
ONIKA_BUILD_PYTHON OFF Builds the pyonika bindings (see Python bindings). Use with -DPython3_EXECUTABLE=....

OpenMP and profiling

Option Default Effect
ONIKA_HAVE_OPENMP_TOOLS ON if OpenMP ≥ 5 Uses the OpenMP tools interface (OMPT) for profiling.
ONIKA_HAVE_OPENMP_DETACH ON if OpenMP ≥ 5 Uses the OpenMP 5 detach clause.
ONIKA_ENABLE_TASK_PROFILING ON Enables task profiling (needed for execution traces).
ONIKA_ENABLE_EXTERNAL_PROFILER OFF Enables an external profiler interface (only for builds without GPU).
ONIKA_OMP_NUM_THREADS_WORKAROUND ON with Intel compilers Works around an OpenMP num_threads bug.

Memory and data structures

Option Default Effect
ONIKA_MEMORY_ZERO_ALLOC OFF Fills new allocations with zeros.
SOATL_SIZE_TYPE_32BITS ON Uses 32-bit array sizes in SOATL containers (64-bit if OFF).
ONIKA_INTERNAL_UNIT_SYSTEM SI Initial internal unit system, as 8 C++ unit names (see Units).
ONIKA_DEFAULT_DATA_DIRS .:./data:<prefix>/data Default search path for data files (ONIKA_DATA_PATH overrides it). Before Onika main (after 1.1.0) the default was <prefix>/share/data, a directory that is not installed.

Tests, extras and site

Option Default Effect
ONIKA_ENABLE_TESTS ON Builds the test programs of tests/ and registers them in ctest.
SOATL_ENABLE_BENCHMARKS ON Builds SOATL benchmarks (with ONIKA_ENABLE_TESTS); size set by SOATL_BENCHMARKS_SIZE (10000000).
ONIKA_REGRESSION_TEST_ENABLE ON Enables regression tests (ctest).
ONIKA_REGRESSION_TEST_ENABLE_SEQ / _MT / _MPI ON Sequential, multi-threaded and MPI tests.
ONIKA_BUILD_CONTRIBS OFF Builds the contribs directory.
ONIKA_BUILD_<Plugin> ON Builds plugin <Plugin> (one option per plugin, see Plugins).
ONIKA_HAS_CCC_USER OFF Uses the CCC job resource interface (remaining time, for sim_continue).
ONIKA_FUTURE_DEPRECATION OFF Shows warnings for features that will be deprecated.

Advanced variables

Variable Default Effect
ONIKA_ARCH_FLAGS empty (x86-64), -march=armv8-a (ARM64) CPU architecture flags added to Onika and to every code built on it (see Installation).
ONIKA_SETUP_ENV_COMMANDS empty Shell commands added at the top of setup-env.sh (e.g. module load ...), so that onikarun sets up the environment.
ONIKA_HAS_GPU_ATOMIC_MIN_MAX_DOUBLE OFF The GPU supports atomicMin/atomicMax on double natively (used by ONIKA_CU_ATOMIC_MIN/MAX).
ONIKA_CUDA_COMPILE_FLAGS, ONIKA_HIP_COMPILE_FLAGS warnings as errors, --extended-lambda Extra flags for GPU compilation.
ONIKA_ENABLE_KERNEL_DEBUG_INFO OFF Debug information for parallel kernels.
ONIKA_PARFOR_OMPSCHED_DEFAULT, ONIKA_BLKPARFOR_OMPSCHED_DEFAULT OMP_SCHED_GUIDED Default OpenMP schedule of parallel_for / block_parallel_for on CPU (see Options).
ONIKA_OMP_MAX_DEPENDS 10 Maximum number of dynamic OpenMP task dependences.
ONIKA_TASKS_PER_CORE 4 Default of --onika-parallel_task_core_mult: OpenMP tasks per core in task mode.
ONIKA_CU_MAX_THREADS_PER_BLOCK 128 Default of --onika-gpu_block_size: GPU block size (threads) of 1D kernels, also used for launch bounds.
ONIKA_CU_MIN_BLOCKS_PER_SM 4 Default of --onika-gpu_sm_mult: GPU blocks per streaming multiprocessor.
ONIKA_DEFAULT_ALIGNMENT, ONIKA_DEFAULT_CHUNK_SIZE, ONIKA_MINIMUM_CUDA_ALIGNMENT -1 (auto) Force memory alignment and SIMD chunk size (see Memory).
ONIKA_EXTERNAL_PROFILER NVTX With ONIKA_ENABLE_EXTERNAL_PROFILER: NVTX or ROCTX; ONIKA_EXTERNAL_PROFILER_INCLUDE_DIRS / _LIBS locate it.

Dependencies are found with the standard CMake variables, e.g. -Dyaml-cpp_DIR=<prefix>/lib/cmake/yaml-cpp, -DMPI_CXX_COMPILER=mpicxx.

MPI launcher for tests

These variables set how ctest launches MPI tests (useful on clusters with a job launcher such as srun or ccc_mprun); they are exported to codes built on Onika.

Variable Default Effect
ONIKA_MPIRUN_CMD MPIEXEC_EXECUTABLE, else mpirun MPI launcher command.
ONIKA_ALWAYS_USE_MPIRUN OFF Also run sequential and multi-threaded tests through the launcher (needed when programs cannot run outside a job).
MPIEXEC_NUMPROC_FLAG, MPIEXEC_NUMCORE_FLAG from FindMPI Launcher flags giving the number of processes and of cores per process, e.g. -n and -c.
MPIEXEC_PREFLAGS, MPIEXEC_POSTFLAGS, MPIEXEC_MAX_NUMPROCS from FindMPI Extra launcher flags, maximum number of processes.
ONIKA_MPIRUN_CMD_DBG, MPIEXEC_PREFLAGS_DBG, ... same as above _DBG variants used for tests run under a debugger (DEBUGGER_COMMAND, default gdb -ex run --args).

Examples for specific machines are in doc/build-examples.txt of the Onika sources.

Tests

ONIKA_ENABLE_TESTS and the ONIKA_REGRESSION_TEST_* options above build Onika's own tests. To declare tests in your own project (onika_add_test, AddRegressionTestDir), see Testing.