From 2e2bd37883e776319b3f6ae94685d15a0b198ec8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 9 Mar 2022 21:04:09 -0500 Subject: [PATCH] automatically enable intel neighbor list request property for intel pair styles --- src/INTEL/pair_airebo_intel.cpp | 2 -- src/INTEL/pair_buck_coul_cut_intel.cpp | 8 ++------ src/INTEL/pair_buck_coul_long_intel.cpp | 9 ++------- src/INTEL/pair_buck_intel.cpp | 8 ++------ src/INTEL/pair_dpd_intel.cpp | 9 ++------- src/INTEL/pair_eam_intel.cpp | 9 ++------- src/INTEL/pair_gayberne_intel.cpp | 9 ++------- src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp | 9 ++------- src/INTEL/pair_lj_charmm_coul_long_intel.cpp | 9 ++------- src/INTEL/pair_lj_cut_coul_long_intel.cpp | 9 ++------- src/INTEL/pair_lj_cut_intel.cpp | 9 ++------- src/INTEL/pair_lj_long_coul_long_intel.cpp | 1 - src/INTEL/pair_sw_intel.cpp | 2 -- src/INTEL/pair_tersoff_intel.cpp | 6 +----- src/neigh_request.cpp | 6 ++++++ src/neigh_request.h | 1 + src/neighbor.cpp | 6 ++++++ 17 files changed, 34 insertions(+), 78 deletions(-) diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 525d81bd61..5b73ba99d2 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -26,7 +26,6 @@ #include "memory.h" #include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "suffix.h" @@ -181,7 +180,6 @@ PairAIREBOIntel::~PairAIREBOIntel() void PairAIREBOIntel::init_style() { PairAIREBO::init_style(); - neighbor->find_request(this)->intel = 1; if (utils::strmatch(force->pair_style,"^hybrid")) error->all(FLERR, "Cannot yet use airebo/intel with hybrid."); diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index b1e904c800..934c5ec0b2 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -409,12 +409,8 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, void PairBuckCoulCutIntel::init_style() { PairBuckCoulCut::init_style(); - auto request = neighbor->find_request(this); - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index 70c13b42c0..563e3abafc 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -485,13 +485,8 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, void PairBuckCoulLongIntel::init_style() { PairBuckCoulLong::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index 889c039cae..54a4cc0be3 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -376,12 +376,8 @@ void PairBuckIntel::init_style() PairBuck::init_style(); // augment neighbor list request - auto request = neighbor->find_request(this); - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index fca749ee9a..fe76e81a4e 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -484,13 +484,8 @@ void PairDPDIntel::settings(int narg, char **arg) { void PairDPDIntel::init_style() { PairDPD::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index 67d50a7dd6..56188028cf 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -666,13 +666,8 @@ void PairEAMIntel::eval(const int offload, const int vflag, void PairEAMIntel::init_style() { PairEAM::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index d76a4befc4..32f5f2fe78 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -889,13 +889,8 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, void PairGayBerneIntel::init_style() { PairGayBerne::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index 8964dae921..c5035d5f03 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -456,13 +456,8 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, void PairLJCharmmCoulCharmmIntel::init_style() { PairLJCharmmCoulCharmm::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 35cb7a207a..850429cd1b 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -521,13 +521,8 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, void PairLJCharmmCoulLongIntel::init_style() { PairLJCharmmCoulLong::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index 3e48008774..a13cfbc148 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -486,13 +486,8 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, void PairLJCutCoulLongIntel::init_style() { PairLJCutCoulLong::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_lj_cut_intel.cpp b/src/INTEL/pair_lj_cut_intel.cpp index a5d4beb23f..50205cfc49 100644 --- a/src/INTEL/pair_lj_cut_intel.cpp +++ b/src/INTEL/pair_lj_cut_intel.cpp @@ -392,13 +392,8 @@ void PairLJCutIntel::eval(const int offload, const int vflag, void PairLJCutIntel::init_style() { PairLJCut::init_style(); - auto request = neighbor->find_request(this); - - if (force->newton_pair == 0) { - request->half = 0; - request->full = 1; - } - request->intel = 1; + if (force->newton_pair == 0) + neighbor->find_request(this)->enable_full(); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_lj_long_coul_long_intel.cpp b/src/INTEL/pair_lj_long_coul_long_intel.cpp index 614f7c3810..d326e5b839 100644 --- a/src/INTEL/pair_lj_long_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_long_coul_long_intel.cpp @@ -46,7 +46,6 @@ PairLJLongCoulLongIntel::~PairLJLongCoulLongIntel() void PairLJLongCoulLongIntel::init_style() { PairLJLongCoulLong::init_style(); - neighbor->find_request(this)->intel = 1; auto fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index f06ab8af99..f6cf90b1d1 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -25,7 +25,6 @@ #include "memory.h" #include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "suffix.h" @@ -1109,7 +1108,6 @@ void PairSWIntel::allocate() void PairSWIntel::init_style() { PairSW::init_style(); - neighbor->find_request(this)->intel = 1; map[0] = map[1]; diff --git a/src/INTEL/pair_tersoff_intel.cpp b/src/INTEL/pair_tersoff_intel.cpp index 8707b313ab..42378c999c 100644 --- a/src/INTEL/pair_tersoff_intel.cpp +++ b/src/INTEL/pair_tersoff_intel.cpp @@ -23,7 +23,6 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" using namespace LAMMPS_NS; @@ -407,10 +406,7 @@ void PairTersoffIntel::init_style() // need a full neighbor list - int irequest = neighbor->request(this); - neighbor->requests[irequest]->half = 0; - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->intel = 1; + neighbor->add_request(this, NeighConst::REQ_FULL); fix = static_cast(modify->get_fix_by_id("package_intel")); if (!fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index c374861792..68e728be42 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -306,3 +306,9 @@ void NeighRequest::set_skip(int *_iskip, int **_ijskip) iskip = _iskip; ijskip = _ijskip; } + +void NeighRequest::enable_full() +{ + half = 0; + full = 1; +} diff --git a/src/neigh_request.h b/src/neigh_request.h index 428b842116..d8228a59ef 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -127,6 +127,7 @@ class NeighRequest : protected Pointers { void set_kokkos_device(int); void set_kokkos_host(int); void set_skip(int *, int **); + void enable_full(); int get_size() const { return size; } void *get_requestor() const { return requestor; } diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 361663890b..8de67961ae 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -45,6 +45,7 @@ #include "style_npair.h" // IWYU pragma: keep #include "style_nstencil.h" // IWYU pragma: keep #include "style_ntopo.h" // IWYU pragma: keep +#include "suffix.h" #include "tokenizer.h" #include "update.h" @@ -2075,6 +2076,11 @@ NeighRequest *Neighbor::add_request(Pair *requestor, int flags) int irequest = request(requestor, requestor->instance_me); auto req = requests[irequest]; req->apply_flags(flags); + // apply intel flag. omp flag is set globally via set_omp_neighbor() + if (requestor->suffix_flag & Suffix::INTEL) { + req->intel = 1; + req->omp = 0; + } return req; }