update class instantiation unit test for kokkos to adapt to thread availability
This commit is contained in:
@ -236,7 +236,7 @@ TEST_F(LAMMPS_omp, InitMembers)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// test fixture for Kokkos tests
|
// test fixture for Kokkos using 2 threads if threading is available
|
||||||
class LAMMPS_kokkos : public ::testing::Test {
|
class LAMMPS_kokkos : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
LAMMPS *lmp;
|
LAMMPS *lmp;
|
||||||
@ -256,18 +256,15 @@ protected:
|
|||||||
void SetUp() override
|
void SetUp() override
|
||||||
{
|
{
|
||||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "none", "-screen", "none",
|
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "none", "-screen", "none",
|
||||||
"-k", "on", "t", "2", "-sf", "kk"};
|
"-k", "on", "t", "1", "-sf", "kk"};
|
||||||
|
if (Info::has_accelerator_feature("KOKKOS", "api", "openmp")) args[10] = "2";
|
||||||
char **argv = (char **)args;
|
char **argv = (char **)args;
|
||||||
int argc = sizeof(args) / sizeof(char *);
|
int argc = sizeof(args) / sizeof(char *);
|
||||||
|
|
||||||
// only run this test fixture with kk suffix if KOKKOS package is installed
|
|
||||||
|
|
||||||
if (LAMMPS::is_installed_pkg("KOKKOS")) {
|
if (LAMMPS::is_installed_pkg("KOKKOS")) {
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||||
std::string output = ::testing::internal::GetCapturedStdout();
|
::testing::internal::GetCapturedStdout();
|
||||||
if (Info::has_accelerator_feature("KOKKOS", "api", "openmp"))
|
|
||||||
EXPECT_THAT(output, StartsWith("Kokkos::OpenMP::"));
|
|
||||||
} else
|
} else
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
}
|
}
|
||||||
@ -307,6 +304,10 @@ TEST_F(LAMMPS_kokkos, InitMembers)
|
|||||||
EXPECT_EQ(lmp->num_package, 0);
|
EXPECT_EQ(lmp->num_package, 0);
|
||||||
EXPECT_EQ(lmp->clientserver, 0);
|
EXPECT_EQ(lmp->clientserver, 0);
|
||||||
|
|
||||||
|
if (Info::has_accelerator_feature("KOKKOS", "api", "openmp"))
|
||||||
|
EXPECT_EQ(lmp->comm->nthreads, 2);
|
||||||
|
else
|
||||||
|
EXPECT_EQ(lmp->comm->nthreads, 1);
|
||||||
EXPECT_NE(lmp->kokkos, nullptr);
|
EXPECT_NE(lmp->kokkos, nullptr);
|
||||||
EXPECT_NE(lmp->atomKK, nullptr);
|
EXPECT_NE(lmp->atomKK, nullptr);
|
||||||
EXPECT_NE(lmp->memoryKK, nullptr);
|
EXPECT_NE(lmp->memoryKK, nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user