Skip to content

Build Unit Tests

Sam Reeve edited this page Jun 8, 2023 · 2 revisions

In order to run unit tests, GTest must be available; if in a non-standard location, pass the location to CMake in addition to Kokkos (and any other optional libraries): -DCMAKE_PREFIX_PATH="$KOKKOS_PATH;$GTEST_PATH"

If tests are enabled you can run the Cabana unit test suite by running ctest. A successful test output should look something like this (with different tests depending on the version of Cabana and your configuration options):

   bash$ ctest
Test project /build/Cabana/release
      Start  1: Version_test
 1/48 Test  #1: Version_test ......................   Passed    0.07 sec
      Start  2: Index_test
 2/48 Test  #2: Index_test ........................   Passed    0.01 sec
      Start  3: CartesianGrid_test
 3/48 Test  #3: CartesianGrid_test ................   Passed    0.01 sec
      Start  4: SoA_test
 4/48 Test  #4: SoA_test ..........................   Passed    0.01 sec
      Start  5: AoSoA_test_SERIAL
 5/48 Test  #5: AoSoA_test_SERIAL .................   Passed    0.01 sec
      Start  6: Slice_test_SERIAL
 6/48 Test  #6: Slice_test_SERIAL .................   Passed    0.01 sec
      Start  7: DeepCopy_test_SERIAL
 7/48 Test  #7: DeepCopy_test_SERIAL ..............   Passed    0.03 sec
      Start  8: Tuple_test_SERIAL
 8/48 Test  #8: Tuple_test_SERIAL .................   Passed    0.01 sec
      Start  9: Sort_test_SERIAL
 9/48 Test  #9: Sort_test_SERIAL ..................   Passed    0.04 sec
      Start 10: LinkedCellList_test_SERIAL
10/48 Test #10: LinkedCellList_test_SERIAL ........   Passed    0.01 sec
      Start 11: NeighborList_test_SERIAL
11/48 Test #11: NeighborList_test_SERIAL ..........   Passed    0.27 sec
      Start 12: Parallel_test_SERIAL
12/48 Test #12: Parallel_test_SERIAL ..............   Passed    0.02 sec
      Start 13: AoSoA_test_OPENMP_1
13/48 Test #13: AoSoA_test_OPENMP_1 ...............   Passed    0.02 sec
      Start 14: AoSoA_test_OPENMP_2
14/48 Test #14: AoSoA_test_OPENMP_2 ...............   Passed    0.01 sec
      Start 15: Slice_test_OPENMP_1
15/48 Test #15: Slice_test_OPENMP_1 ...............   Passed    0.02 sec
      Start 16: Slice_test_OPENMP_2
16/48 Test #16: Slice_test_OPENMP_2 ...............   Passed    0.01 sec
      Start 17: DeepCopy_test_OPENMP_1
17/48 Test #17: DeepCopy_test_OPENMP_1 ............   Passed    0.02 sec
      Start 18: DeepCopy_test_OPENMP_2
18/48 Test #18: DeepCopy_test_OPENMP_2 ............   Passed    0.01 sec
      Start 19: Tuple_test_OPENMP_1
19/48 Test #19: Tuple_test_OPENMP_1 ...............   Passed    0.03 sec
      Start 20: Tuple_test_OPENMP_2
20/48 Test #20: Tuple_test_OPENMP_2 ...............   Passed    0.01 sec
      Start 21: Sort_test_OPENMP_1
21/48 Test #21: Sort_test_OPENMP_1 ................   Passed    0.02 sec
      Start 22: Sort_test_OPENMP_2
22/48 Test #22: Sort_test_OPENMP_2 ................   Passed    0.01 sec
      Start 23: LinkedCellList_test_OPENMP_1
23/48 Test #23: LinkedCellList_test_OPENMP_1 ......   Passed    0.01 sec
      Start 24: LinkedCellList_test_OPENMP_2
24/48 Test #24: LinkedCellList_test_OPENMP_2 ......   Passed    0.01 sec
      Start 25: NeighborList_test_OPENMP_1
25/48 Test #25: NeighborList_test_OPENMP_1 ........   Passed    0.28 sec
      Start 26: NeighborList_test_OPENMP_2
26/48 Test #26: NeighborList_test_OPENMP_2 ........   Passed    0.14 sec
      Start 27: Parallel_test_OPENMP_1
27/48 Test #27: Parallel_test_OPENMP_1 ............   Passed    0.01 sec
      Start 28: Parallel_test_OPENMP_2
28/48 Test #28: Parallel_test_OPENMP_2 ............   Passed    0.01 sec
      Start 29: CommunicationPlan_test_SERIAL_1
29/48 Test #29: CommunicationPlan_test_SERIAL_1 ...   Passed    1.09 sec
      Start 30: Distributor_test_SERIAL_1
30/48 Test #30: Distributor_test_SERIAL_1 .........   Passed    0.72 sec
      Start 31: Halo_test_SERIAL_1
31/48 Test #31: Halo_test_SERIAL_1 ................   Passed    0.71 sec
      Start 32: CommunicationPlan_test_OPENMP_1
32/48 Test #32: CommunicationPlan_test_OPENMP_1 ...   Passed    0.84 sec
      Start 33: Distributor_test_OPENMP_1
33/48 Test #33: Distributor_test_OPENMP_1 .........   Passed    0.81 sec
      Start 34: Halo_test_OPENMP_1
34/48 Test #34: Halo_test_OPENMP_1 ................   Passed    0.71 sec
      Start 35: Core_tutorial_01
35/48 Test #35: Core_tutorial_01 ..................   Passed    0.01 sec
      Start 36: Core_tutorial_02
36/48 Test #36: Core_tutorial_02 ..................   Passed    0.01 sec
      Start 37: Core_tutorial_03
37/48 Test #37: Core_tutorial_03 ..................   Passed    0.01 sec
      Start 38: Core_tutorial_04_unmanaged
38/48 Test #38: Core_tutorial_04_unmanaged ........   Passed    0.02 sec
      Start 39: Core_tutorial_04
39/48 Test #39: Core_tutorial_04 ..................   Passed    0.01 sec
      Start 40: Core_tutorial_05
40/48 Test #40: Core_tutorial_05 ..................   Passed    0.01 sec
      Start 41: Core_tutorial_07
41/48 Test #41: Core_tutorial_07 ..................   Passed    0.01 sec
      Start 42: Core_tutorial_08
42/48 Test #42: Core_tutorial_08 ..................   Passed    0.01 sec
      Start 43: Core_tutorial_09
43/48 Test #43: Core_tutorial_09 ..................   Passed    0.01 sec
      Start 44: Core_tutorial_11
44/48 Test #44: Core_tutorial_11 ..................   Passed    0.67 sec
      Start 45: Core_tutorial_12
45/48 Test #45: Core_tutorial_12 ..................   Passed    0.69 sec
      Start 46: Core_tutorial_05_openmp
46/48 Test #46: Core_tutorial_05_openmp ...........   Passed    0.01 sec
      Start 47: Core_tutorial_10_neighbor
47/48 Test #47: Core_tutorial_10_neighbor .........   Passed    0.01 sec
      Start 48: Core_tutorial_10_simd
48/48 Test #48: Core_tutorial_10_simd .............   Passed    0.01 sec

100% tests passed, 0 tests failed out of 48

Total Test time (real) =   7.60 sec

If any tests fail, start by checking your configuration to ensure proper installation of each back-end implementation. Individual tests my be run with more detailed output as well to help with checking configuration issues. For example, if all of the CUDA tests are failing they can be run with more verbose output for diagnostics as:

   bash$ ctest -VV -R Cuda
   UpdateCTestConfiguration  from :/home/uy7/build/Cabana/release/DartConfiguration.tcl
   Parse Config file:/home/uy7/build/Cabana/release/DartConfiguration.tcl
   UpdateCTestConfiguration  from :/home/uy7/build/Cabana/release/DartConfiguration.tcl
   Parse Config file:/home/uy7/build/Cabana/release/DartConfiguration.tcl
   Test project /home/uy7/build/Cabana/release
   Constructing a list of tests
   Done constructing a list of tests
   Checking test dependency graph...
   Checking test dependency graph end
   test 10
       Start 10: Core_AoSoA_test_CudaUVM

   10: Test command: /home/uy7/build/Cabana/release/core/unit_test/Core_AoSoA_test_CudaUVM.exe
   10: Test timeout computed to be: 1500
   10: Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
   10:   In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
   10:   For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
   10:   For unit testing set OMP_PROC_BIND=false
   10: Running 2 test cases...
   10:
   10: *** No errors detected
   1/3 Test #10: Core_AoSoA_test_CudaUVM ..........   Passed    0.12 sec
   test 11
       Start 11: Core_MemberSlice_test_CudaUVM

   11: Test command: /home/uy7/build/Cabana/release/core/unit_test/Core_MemberSlice_test_CudaUVM.exe
   11: Test timeout computed to be: 1500
   11: Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
   11:   In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
   11:   For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
   11:   For unit testing set OMP_PROC_BIND=false
   11: Running 1 test case...
   11:
   11: *** No errors detected
   2/3 Test #11: Core_MemberSlice_test_CudaUVM ....   Passed    0.07 sec
   test 12
       Start 12: Core_Parallel_test_CudaUVM

   12: Test command: /home/uy7/build/Cabana/release/core/unit_test/Core_Parallel_test_CudaUVM.exe
   12: Test timeout computed to be: 1500
   12: Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
   12:   In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
   12:   For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
   12:   For unit testing set OMP_PROC_BIND=false
   12: Running 1 test case...
   12:
   12: *** No errors detected
   3/3 Test #12: Core_Parallel_test_CudaUVM .......   Passed    0.11 sec

   The following tests passed:
        Core_AoSoA_test_CudaUVM
        Core_MemberSlice_test_CudaUVM
        Core_Parallel_test_CudaUVM

   100% tests passed, 0 tests failed out of 3

   Label Time Summary:
   Core    =   0.30 sec (3 tests)

   Total Test time (real) =   0.30 sec

If test failures still persist please contact the Cabana developers.

Clone this wiki locally