When KOKKOS has been compiled with GPU support the GPU *must* be used

This commit is contained in:
Axel Kohlmeyer
2024-07-30 10:35:15 -04:00
parent bd2e071ef0
commit a5a0620dca
5 changed files with 93 additions and 14 deletions

View File

@ -3,7 +3,7 @@
add_executable(test_lammps_class test_lammps_class.cpp)
target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain)
add_test(NAME LammpsClass COMMAND test_lammps_class)
set_tests_properties(LammpsClass PROPERTIES ENVIRONMENT "OMP_NUM_THREADS=1")
set_tests_properties(LammpsClass PROPERTIES ENVIRONMENT "OMP_NUM_THREADS=2;OMP_PROC_BIND=false")
add_executable(test_input_class test_input_class.cpp)
target_link_libraries(test_input_class PRIVATE lammps GTest::GTestMain)

View File

@ -253,6 +253,15 @@ protected:
{
LAMMPS::argv args = {"LAMMPS_test", "-log", "none", "-echo", "none", "-screen", "none",
"-k", "on", "t", "1", "-sf", "kk"};
// when GPU support is enabled in KOKKOS, it *must* be used
if (Info::has_accelerator_feature("KOKKOS", "api", "hip") ||
Info::has_accelerator_feature("KOKKOS", "api", "cuda") ||
Info::has_accelerator_feature("KOKKOS", "api", "sycl")) {
args = {"LAMMPS_test", "-log", "none", "-echo", "none", "-screen", "none", "-k",
"on", "t", "1", "g", "1", "-sf", "kk"};
}
if (Info::has_accelerator_feature("KOKKOS", "api", "openmp")) args[10] = "2";
if (LAMMPS::is_installed_pkg("KOKKOS")) {