run KOKKOS force style unit tests with serial when OpenMP is not available
This commit is contained in:
@ -550,7 +550,10 @@ TEST(AngleStyle, 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") ||
|
||||
@ -559,6 +562,8 @@ TEST(AngleStyle, kokkos_omp)
|
||||
|
||||
LAMMPS::argv args = {"AngleStyle", "-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;
|
||||
|
||||
@ -553,7 +553,10 @@ TEST(BondStyle, 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") ||
|
||||
@ -562,6 +565,8 @@ TEST(BondStyle, kokkos_omp)
|
||||
|
||||
LAMMPS::argv args = {"BondStyle", "-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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -894,7 +894,10 @@ TEST(FixTimestep, 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") ||
|
||||
@ -903,6 +906,8 @@ TEST(FixTimestep, kokkos_omp)
|
||||
}
|
||||
LAMMPS::argv args = {"FixTimestep", "-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;
|
||||
|
||||
@ -547,6 +547,10 @@ TEST(ImproperStyle, kokkos_omp)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) 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") ||
|
||||
@ -556,6 +560,8 @@ TEST(ImproperStyle, kokkos_omp)
|
||||
LAMMPS::argv args = {"ImproperStyle", "-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;
|
||||
@ -747,8 +753,8 @@ TEST(ImproperStyle, extract)
|
||||
}
|
||||
|
||||
auto *improper = lmp->force->improper;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = improper->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
@ -114,10 +114,14 @@ TEST(MliapUnified, VersusLJMeltGhost)
|
||||
lammps_close(ljmelt);
|
||||
lammps_close(mliap);
|
||||
}
|
||||
|
||||
TEST(MliapUnified, VersusLJMeltKokkos)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("KOKKOS")) 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") ||
|
||||
@ -127,7 +131,9 @@ TEST(MliapUnified, VersusLJMeltKokkos)
|
||||
|
||||
const char *lmpargv[] = {"melt", "-log", "none", "-echo", "screen", "-nocite",
|
||||
"-k", "on", "t", "4", "-sf", "kk"};
|
||||
int lmpargc = sizeof(lmpargv) / sizeof(const char *);
|
||||
// fall back to serial if openmp is not available
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) lmpargv[9] = "1";
|
||||
int lmpargc = sizeof(lmpargv) / sizeof(const char *);
|
||||
|
||||
void *ljmelt = lammps_open_no_mpi(lmpargc, (char **)lmpargv, nullptr);
|
||||
void *mliap = lammps_open_no_mpi(lmpargc, (char **)lmpargv, nullptr);
|
||||
@ -159,10 +165,14 @@ TEST(MliapUnified, VersusLJMeltKokkos)
|
||||
lammps_close(ljmelt);
|
||||
lammps_close(mliap);
|
||||
}
|
||||
|
||||
TEST(MliapUnified, VersusLJMeltGhostKokkos)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP();
|
||||
// test either OpenMP or Serial
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp") &&
|
||||
!Info::has_accelerator_feature("KOKKOS", "api", "serial"))
|
||||
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") ||
|
||||
@ -172,7 +182,10 @@ TEST(MliapUnified, VersusLJMeltGhostKokkos)
|
||||
|
||||
const char *lmpargv[] = {"melt", "-log", "none", "-echo", "screen", "-nocite",
|
||||
"-k", "on", "t", "4", "-sf", "kk"};
|
||||
int lmpargc = sizeof(lmpargv) / sizeof(const char *);
|
||||
// fall back to serial if openmp is not available
|
||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) lmpargv[9] = "1";
|
||||
|
||||
int lmpargc = sizeof(lmpargv) / sizeof(const char *);
|
||||
|
||||
void *ljmelt = lammps_open_no_mpi(lmpargc, (char **)lmpargv, nullptr);
|
||||
void *mliap = lammps_open_no_mpi(lmpargc, (char **)lmpargv, nullptr);
|
||||
|
||||
@ -650,7 +650,10 @@ TEST(PairStyle, 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") ||
|
||||
@ -660,6 +663,8 @@ TEST(PairStyle, kokkos_omp)
|
||||
|
||||
LAMMPS::argv args = {"PairStyle", "-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";
|
||||
|
||||
// cannot run dpd styles in plain or hybrid with more than 1 thread due to using multiple pRNGs
|
||||
if (utils::strmatch(test_config.pair_style, "^dpd") ||
|
||||
@ -854,8 +859,8 @@ TEST(PairStyle, gpu)
|
||||
epsilon *= 5.0e8;
|
||||
else
|
||||
epsilon *= 1.0e10;
|
||||
// relax test precision when using pppm and single precision FFTs, but only when also
|
||||
// running with double precision
|
||||
// relax test precision when using pppm and single precision FFTs, but only when also
|
||||
// running with double precision
|
||||
#if defined(FFT_SINGLE)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag &&
|
||||
Info::has_accelerator_feature("GPU", "precision", "double"))
|
||||
|
||||
Reference in New Issue
Block a user