run KOKKOS force style unit tests with serial when OpenMP is not available
This commit is contained in:
@ -569,7 +569,10 @@ TEST(DihedralStyle, kokkos_omp)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP();
|
||||
// test either OpenMP or Serial
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "serial") &&
|
||||
!Info::has_accelerator_feature("KOKKOS", "api", "openmp"))
|
||||
GTEST_SKIP();
|
||||
// if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only.
|
||||
if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") ||
|
||||
Info::has_accelerator_feature("KOKKOS", "api", "hip") ||
|
||||
@ -579,6 +582,8 @@ TEST(DihedralStyle, kokkos_omp)
|
||||
LAMMPS::argv args = {"DihedralStyle", "-log", "none", "-echo", "screen",
|
||||
"-nocite", "-k", "on", "t", "4",
|
||||
"-sf", "kk"};
|
||||
// fall back to serial if openmp is not available
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) args[9] = "1";
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = nullptr;
|
||||
@ -773,8 +778,8 @@ TEST(DihedralStyle, extract)
|
||||
}
|
||||
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = dihedral->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user