Tests
The plugin’s correctness tests compare its results with stock OpenMM. They are available in the cuPotential repository and the source tarball. For performance measurements, see Benchmarks.
Run the tests
Run ./run_test from the repository root. It starts the Docker container
through ./run_docker and builds the plugin before running the selected tests.
For a short energy check on DHFR in double precision, run:
After the build, this check takes a few seconds. The -k option filters tests
by name, as it does in pytest. Without -k, openmm_unit runs the full
correctness suite, which takes a few hours on one GPU.
Run ./run_test --list-stages to see the available stages.
Run export NV_GPU=0 before ./run_test to select the first host GPU. GPU indices
start at 0. If NV_GPU is unset, all GPUs are available to the Docker container.
Tests fail immediately if another process is using the selected GPU.
If the GPU disappears in the middle of the tests, with “Failed to initialize NVML:
Unknown Error” or “No compatible CUDA device is available”, the host probably ran
systemctl daemon-reload. Set CUPO_DOCKER_ADD_DEVICE_NODES=1 to have
./run_docker also pass the GPUs’ device nodes, which keeps them. See
The GPUs the container gets.
Test an installed plugin
By default, the tests use the plugin built from source. Set
CUPO_TEST_INSTALLED=1 to test a pip or conda installation instead. Install the
plugin and run the tests in the same ./run_docker bash session.
The examples below install the plugin and run a short test in one session. Replace the placeholders with the wheel URL or unpacked conda channel from the installation guide.
For pip, the tests use the Docker environment’s Python, which already includes pytest:
For conda, install pytest in the cupotential environment and use
micromamba run to run the tests there:
-k test_unit_conversion selects a test module that runs in under a minute.
Outside Docker, install pytest in the same environment as the plugin.
The session header identifies the plugin being tested and lists its module,
library, and version. If CUPO_TEST_INSTALLED=1 is set but no plugin is installed,
the tests fail immediately. Tests that require the source build are skipped
with a message naming the variable.
See the test README for details.