Testing
CTest organizes two test types:
- Unit tests (Catch2, C++): individual functions and classes in isolation.
- Regression tests (bash): end-to-end simulations against known configurations using the full
thorexecutable.
CI runs on a self-hosted GitHub Actions runner; build, test, and coverage results are submitted to CDash. See CDash below.
Private Access
The CDash dashboard is non-public. Contact the developer for access.
FP32 kernel audit
Use this audit to find unintended double-precision arithmetic in FP32 GPU kernels.
For AdaptiveCpp CUDA, run with a fresh ACPP_APPDB_DIR and
ACPP_S2_DUMP_IR_FINAL=final.ll, then check the captured transport kernels:
Omit --kernel to scan all modules. Missing or incomplete captures fail.
Inspect reported FP64 operations: preprocessing, diagnostics and SYCL trigonometry
internals may intentionally use FP64.
Unit Tests
Unit tests live in tests/ and use Catch2.
Add cases to thor_tests, or to thor_tests_mpi for MPI behavior. Configuration
contracts that run without device initialization belong in thor_config_tests.
Use Catch2 tags or names for focused runs. Each test source belongs to one suite.
The other test executables have separate runtime requirements: thor_gui_tests
uses ImGui Test Engine, thor_floating_point_smoke checks compiler floating-point
semantics independently of the main harness, and thor_interop_smoke exercises
CUDA/OpenGL/EGL interoperability manually. The latter is built explicitly.
CMake checks executable targets under tests/ and its subdirectories against
the approved list in cmake/ThorTestExecutables.cmake. An unexpected executable
fails configuration, including an EXCLUDE_FROM_ALL target. Optional targets
are checked when enabled. New exceptions require explicit approval and a
requirement the existing runners cannot support.
rng_stdout_generator, bench_point_on_sphere, bench_voronoi, and
diag_pbc_drift are approved tools built explicitly with --target <name>.
CMake gives Catch2-generated functions and fixture classes a source-specific
prefix to prevent Intel SYCL kernel-name collisions. Write normal Catch2 tests;
thor_tests '[kernel-identity]' checks the workaround across two files and several test forms.
If a kernel lives in a separate helper function, put that helper in a named
namespace unique to its source file: Catch2 prefixes do not cover helper names.
Tags
Tests are grouped with specific tags for granular control:
[cpu]- CPU-only tests (for benchmarks)[gpu]- GPU-required tests (for benchmarks)[.benchmark]- Performance benchmarks (hidden by default)[.LongRunning]- Long-running tests (hidden by default)[accumulator-stress]- Ionizing summation stress tests (hidden by default).
Running Unit Tests
First, build the thor_tests target. Afterwards, you can run the tests from your build directory:
You can also run specific tests using tags or names:
# Specific test categories
./tests/thor_tests "[cpu]"
./tests/thor_tests "[gpu]"
./tests/thor_tests "[.benchmark]" # Explicit for hidden tags
# Specific test names
./tests/thor_tests "UniformGrid*"
Temporary directories created with the TempDirectory default policy are removed
when their owner is destroyed. Set THOR_TEST_KEEP_TMP=1 when running a test to
retain these directories for debugging; other values keep automatic cleanup.
An explicit cleanup argument on a fixture overrides this default.
CTest unit tests default to two OpenMP threads per process, configured with
-DTHOR_UNIT_TEST_THREADS=2. CTest reserves the same number of slots per test;
ctest -j16 therefore runs up to eight single-process unit tests concurrently.
MPI unit tests reserve ranks × THOR_UNIT_TEST_THREADS slots and disable Open MPI
rank binding so their threads can use the available CPUs. Direct calls to
thor_tests use the caller's OMP_NUM_THREADS. Simulation regressions keep
their separate REGTEST_THREADS setting and serial scheduling.
MPI tests
Build thor_tests_mpi and run the registered suites with:
ThorTestsMPI_2ranks runs the full MPI suite. ThorTestsMPI_4ranks repeats only
cases tagged [mpi-rank-count]: representative scalar/array reductions,
gathers, all-to-all exchanges, nonblocking ring/request handling, and communicator
splitting. These exercise different peer relationships, buffer offsets, or
subcommunicator sizes. Environment checks, timers, the barrier smoke test,
remaining reduction variants, and vector datatype tests run only at two ranks.
Add the tag when a new test benefits from checking both communicator sizes.
[AI-Codex]
Voronoi tessellation equivalence
The existing MPI export and single-rank import tests can compare a distributed tessellation with an independent serial construction. For the small periodic fixture, retain the producer output and pass its directory to the importer:
ACPP_VISIBILITY_MASK=omp OMP_NUM_THREADS=2 \
THOR_GLOBAL_CACHE_TEST_OUTPUT=/tmp/thor-global-cache-check \
mpiexec --bind-to none -n 2 <build_directory>/tests/thor_tests_mpi \
'MPI Voronoi export certifies and finalizes a complete periodic graph'
ACPP_VISIBILITY_MASK=omp OMP_NUM_THREADS=2 \
THOR_GLOBAL_CACHE_TEST_INPUT=/tmp/thor-global-cache-check \
<build_directory>/tests/thor_tests '[global-mesh-cache-import]'
Repeat with four ranks and a separate output directory. Each producer rank must load fewer than all cells. The import test constructs a fresh serial reference and compares every neighbor list after loading the MPI cache with a different ordering.
For a full periodic Gadget snapshot, set THOR_GLOBAL_CACHE_TEST_CONFIG to a
producer YAML instead of using the small fixture. It must provide
pointcloud_voronoi.mesh_save_path; the MPI test selects global save mode and
exits after certification and export. For the single-rank check, supply a
consumer YAML with mesh_load_path and an independently constructed serial
global cache:
ACPP_VISIBILITY_MASK=omp OMP_NUM_THREADS=2 \
THOR_GLOBAL_CACHE_TEST_CONFIG=consumer.yaml \
THOR_GLOBAL_CACHE_TEST_REFERENCE=/path/to/serial-global.bin \
<build_directory>/tests/thor_tests '[global-mesh-cache-import]'
This check compares the graph loaded by THOR, including its remapped indices, with every reference row. It checks the periodic domain, precision, position fingerprints, and complete neighbor lists without running transport. Reuse the serial reference while its input and construction settings remain unchanged. For large CGAL runs, give each rank a disjoint CPU allocation; limiting OpenMP threads alone does not limit CGAL's TBB workers.
Regression Tests
Regression tests are bash scripts under regression_tests/CI that run thor with specific configurations and validate the output. Scripts named test_*.sh are auto-registered with CTest and must accept the path to the thor executable as an optional argument.
Running Regression Tests
Manually
You can run a regression test script directly:
With CTest
CTest is the recommended way to run the entire test suite. From your build directory:
This will automatically discover and run all registered tests, including regression tests.
You can also run specific tests or use other CTest options:
# Run tests with names matching a regex
ctest -R <test_name_regex>
# See verbose output from tests
ctest --verbose
CDash
CI submits build, test, and coverage results to Kitware's my.cdash.org via the .github/workflows/cmake-cdash.yml workflow.
To trigger a submission manually with gh act:
Requires gh, act, and a .env_cdash file containing CDASH_AUTH_TOKEN.