diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bd33facb..9bc1585a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -24,19 +24,8 @@ set(gmgpolar_test_sources include(GoogleTest) -# Build the test suite twice: once for serial (1 thread) and once for parallel (16 threads). -# GMGPOLAR_TEST_THREADS is passed to Kokkos::InitializationSettings at startup. -foreach(label_threads "Serial;1" "Parallel;16") - list(GET label_threads 0 label) - list(GET label_threads 1 num_threads) - set(test_target gmgpolar_tests_${label}) +add_executable(gmgpolar_tests ${gmgpolar_test_sources}) +target_compile_features(gmgpolar_tests PRIVATE cxx_std_20) +target_link_libraries(gmgpolar_tests GMGPolarLib GMGPolarInterface GTest::gtest) - add_executable(${test_target} ${gmgpolar_test_sources}) - target_compile_features(${test_target} PRIVATE cxx_std_20) - target_compile_definitions(${test_target} PRIVATE GMGPOLAR_TEST_THREADS=${num_threads}) - target_link_libraries(${test_target} GMGPolarLib GMGPolarInterface GTest::gtest) - - gtest_discover_tests(${test_target} - TEST_PREFIX ${label} - DISCOVERY_MODE PRE_TEST) -endforeach() +gtest_discover_tests(gmgpolar_tests DISCOVERY_MODE PRE_TEST) diff --git a/tests/gmgpolar_tests.cpp b/tests/gmgpolar_tests.cpp index a3910150..0c0c1b3a 100644 --- a/tests/gmgpolar_tests.cpp +++ b/tests/gmgpolar_tests.cpp @@ -4,10 +4,7 @@ // Define the main function only once int main(int argc, char* argv[]) { - Kokkos::InitializationSettings settings; - // 8 (CPU) threads - settings.set_num_threads(GMGPOLAR_TEST_THREADS); - Kokkos::ScopeGuard kokkos_scope(settings); + Kokkos::ScopeGuard kokkos_scope(argc, argv); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }