Test VMC
Run the test suite after building on a new compiler or system and after changing the simulation, wavefunction, energy, optimizer, or output code.
Run all tests
Section titled “Run all tests”From the repository root:
./scripts/test.shThe script creates build-tests, configures a Debug FP64 CPU build, builds
vmc_tests, and runs CTest with --output-on-failure. It always configures
VMC_ENABLE_CUDA=OFF; this script does not test the CUDA backend.
On a clean build, CMake fetches Catch2 3.8.1 from GitHub, so the first configuration needs network access. The final portion of a successful run was:
85/94 Test #85: Finite-size convergence: N=7 and N=19 agree at r_s=5 ............................................. Passed 3.27 sec Start 86: Blocking analysis produces finite standard error86/94 Test #86: Blocking analysis produces finite standard error ................................................. Passed 1.31 sec Start 87: Warmup produces reasonable acceptance rate87/94 Test #87: Warmup produces reasonable acceptance rate ....................................................... Passed 0.95 sec Start 88: Energy per particle at r_s=1 is positive and bounded88/94 Test #88: Energy per particle at r_s=1 is positive and bounded ............................................. Passed 1.72 sec Start 89: Standard error is small relative to energy scale89/94 Test #89: Standard error is small relative to energy scale ................................................. Passed 1.75 sec Start 90: Same seed produces identical energy90/94 Test #90: Same seed produces identical energy .............................................................. Passed 0.73 sec Start 91: Independent seeds produce consistent energies91/94 Test #91: Independent seeds produce consistent energies .................................................... Passed 2.89 sec Start 92: WaveFunction evaluateDerivatives clears buffers and delegates to Jastrow92/94 Test #92: WaveFunction evaluateDerivatives clears buffers and delegates to Jastrow ......................... Passed 0.01 sec Start 93: WaveFunction evaluate_log_psi returns finite for N=193/94 Test #93: WaveFunction evaluate_log_psi returns finite for N=1 .............................................. Passed 0.01 sec Start 94: WaveFunction default Jastrow parameter matches fully polarized cusp choice94/94 Test #94: WaveFunction default Jastrow parameter matches fully polarized cusp choice ....................... Passed 0.01 sec
100% tests passed, 0 tests failed out of 94
Total Test time (real) = 52.82 secRun a group of tests
Section titled “Run a group of tests”CTest discovers individual Catch2 test cases. The test executable also accepts Catch2 tag filters. For example:
./build-tests/vmc_tests '[config]'./build-tests/vmc_tests '[energy]'./build-tests/vmc_tests '[validation]'To list the available tags:
./build-tests/vmc_tests --list-tagsObserved output:
All available tags: 3 [aligned_soa] 3 [blocking] 11 [config] 6 [energy] 10 [interacting] 6 [jastrow] 3 [matrix] 3 [optimizer] 2 [output_writer] 2 [particles] 8 [published] 9 [rigorous] 7 [simulation] 19 [slater] 7 [validation] 4 [wavefunction]16 tagsTest another precision mode
Section titled “Test another precision mode”The test script accepts the same precision-related flags as the build script:
./scripts/test.sh --fp32./scripts/test.sh --vmc-fast-mathYou may also provide a build type as a positional argument, such as
./scripts/test.sh Release.
Source of truth
Section titled “Source of truth”The test workflow is defined by scripts/test.sh and the testing section of
CMakeLists.txt. Test cases are under tests/.