enforce using a single thread with Kokkos and SNAP or PACE
This commit is contained in:
@ -32,9 +32,9 @@
|
|||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "pair.h"
|
#include "pair.h"
|
||||||
|
#include "platform.h"
|
||||||
#include "universe.h"
|
#include "universe.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -395,7 +395,8 @@ TEST(PairStyle, plain)
|
|||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 3 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
3 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
||||||
@ -552,7 +553,7 @@ TEST(PairStyle, omp)
|
|||||||
run_lammps(lmp);
|
run_lammps(lmp);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 5* epsilon);
|
EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
@ -574,7 +575,8 @@ TEST(PairStyle, omp)
|
|||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, epsilon);
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
||||||
@ -586,7 +588,8 @@ TEST(PairStyle, omp)
|
|||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
id = lmp->modify->find_compute("sum");
|
||||||
@ -625,8 +628,18 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite",
|
const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite",
|
||||||
"-k", "on", "t", "4", "-sf", "kk"};
|
"-k", "on", "t", "4", "-sf", "kk"};
|
||||||
|
|
||||||
// cannot run dpd styles with more than 1 thread due to using multiple pRNGs
|
// 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")) args[9] = "1";
|
if (utils::strmatch(test_config.pair_style, "^dpd") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " dpd"))
|
||||||
|
args[9] = "1";
|
||||||
|
// cannot run snap styles in plain or hybrid with more than 1 thread due to implementation
|
||||||
|
if (utils::strmatch(test_config.pair_style, "^snap") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " snap"))
|
||||||
|
args[9] = "1";
|
||||||
|
// cannot run pace styles in plain or hybrid with more than 1 thread due to implementation
|
||||||
|
if (utils::strmatch(test_config.pair_style, "^pace") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " pace"))
|
||||||
|
args[9] = "1";
|
||||||
|
|
||||||
char **argv = (char **)args;
|
char **argv = (char **)args;
|
||||||
int argc = sizeof(args) / sizeof(char *);
|
int argc = sizeof(args) / sizeof(char *);
|
||||||
@ -688,7 +701,6 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
|
|
||||||
// skip over these tests if newton pair is forced to be on
|
// skip over these tests if newton pair is forced to be on
|
||||||
if (lmp->force->newton_pair == 0) {
|
if (lmp->force->newton_pair == 0) {
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
cleanup_lammps(lmp, test_config);
|
cleanup_lammps(lmp, test_config);
|
||||||
lmp = init_lammps(argc, argv, test_config, false);
|
lmp = init_lammps(argc, argv, test_config, false);
|
||||||
@ -697,7 +709,8 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
||||||
@ -709,7 +722,8 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
id = lmp->modify->find_compute("sum");
|
||||||
|
|||||||
Reference in New Issue
Block a user