diff --git a/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp index e73f6d39a6..0b890ae4e5 100644 --- a/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp @@ -64,17 +64,12 @@ void ComputeAveSphereAtomKokkos::init() { ComputeAveSphereAtom::init(); - // need an occasional full neighbor list + // adjust neighbor list request for KOKKOS - // irequest = neigh request made by parent class - - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/compute_coord_atom_kokkos.cpp b/src/KOKKOS/compute_coord_atom_kokkos.cpp index 443e9a89eb..e877400028 100644 --- a/src/KOKKOS/compute_coord_atom_kokkos.cpp +++ b/src/KOKKOS/compute_coord_atom_kokkos.cpp @@ -74,17 +74,12 @@ void ComputeCoordAtomKokkos::init() { ComputeCoordAtom::init(); - // need an occasional full neighbor list + // adjust neighbor list request for KOKKOS - // irequest = neigh request made by parent class - - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp index b131cc2be1..037a9a5943 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp @@ -96,26 +96,13 @@ void FixACKS2ReaxFFKokkos::init() FixACKS2ReaxFF::init(); - neighflag = lmp->kokkos->neighflag_qeq; - int irequest = neighbor->nrequest - 1; + // adjust neighbor list request for KOKKOS - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->fix = 1; - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else { //if (neighflag == HALF || neighflag == HALFTHREAD) - neighbor->requests[irequest]->fix = 1; - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag_qeq == FULL) request->enable_full(); int ntypes = atom->ntypes; k_params = Kokkos::DualView diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp index ba4c85e98c..3d2534044f 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp @@ -98,26 +98,13 @@ void FixQEqReaxFFKokkos::init() FixQEqReaxFF::init(); - neighflag = lmp->kokkos->neighflag_qeq; - int irequest = neighbor->nrequest - 1; + // adjust neighbor list request for KOKKOS - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->fix = 1; - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else { //if (neighflag == HALF || neighflag == HALFTHREAD) - neighbor->requests[irequest]->fix = 1; - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag_qeq == FULL) request->enable_full(); int ntypes = atom->ntypes; k_params = Kokkos::DualView diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index ed76540f87..265661d410 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -113,11 +113,6 @@ void FixRxKokkos::post_constructor() template void FixRxKokkos::init() { - //printf("Inside FixRxKokkos::init\n"); - - // Call the parent's version. - //FixRX::init(); - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); @@ -137,30 +132,14 @@ void FixRxKokkos::init() if (update_kinetics_data) create_kinetics_data(); - // From FixRX::init() // need a half neighbor list // built whenever re-neighboring occurs - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->fix = 1; - - // Update the neighbor data for Kokkos. - int neighflag = lmp->kokkos->neighflag; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else { //if (neighflag == HALF || neighflag == HALFTHREAD) - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } + auto request = neighbor->add_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 1ec94adfb6..035a2ffbb8 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -35,22 +35,23 @@ ------------------------------------------------------------------------- */ #include "fix_shardlow_kokkos.h" -#include #include "atom.h" -#include "atom_masks.h" #include "atom_kokkos.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include "atom_masks.h" #include "comm.h" -#include "neighbor.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" #include "neigh_list_kokkos.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "domain.h" -#include "pair_dpd_fdt_energy_kokkos.h" +#include "neighbor.h" #include "npair_ssa_kokkos.h" +#include "pair_dpd_fdt_energy_kokkos.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -59,7 +60,6 @@ using namespace random_external_state; #define EPSILON 1.0e-10 #define EPSILON_SQUARED ((EPSILON) * (EPSILON)) - /* ---------------------------------------------------------------------- */ template @@ -125,18 +125,12 @@ void FixShardlowKokkos::init() { FixShardlow::init(); - int irequest = neighbor->nrequest - 1; + // adjust neighbor list request for KOKKOS - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - -// neighbor->requests[irequest]->pair = 0; -// neighbor->requests[irequest]->fix = 1; -// neighbor->requests[irequest]->ghost= 1; -// neighbor->requests[irequest]->ssa = 1; + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); int ntypes = atom->ntypes; k_params = Kokkos::DualView diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index 6fe8922a96..725756038c 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -17,20 +17,22 @@ ------------------------------------------------------------------------- */ #include "pair_buck_coul_cut_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -286,26 +288,13 @@ void PairBuckCoulCutKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with buck/coul/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index 01ad5c7ad8..872ca20074 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_buck_coul_long_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -433,26 +435,13 @@ void PairBuckCoulLongKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with buck/coul/long/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 2f7a486997..c5f19d003c 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_buck_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -211,26 +213,13 @@ void PairBuckKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with buck/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 89390576e7..ea2d425767 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -13,16 +13,18 @@ ------------------------------------------------------------------------- */ #include "pair_coul_cut_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; @@ -209,26 +211,13 @@ void PairCoulCutKokkos::init_style() { PairCoulCut::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with coul/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index 55d0754328..30d849332f 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_coul_debye_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -243,26 +245,13 @@ void PairCoulDebyeKokkos::init_style() { PairCoulDebye::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with coul/debye/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_coul_dsf_kokkos.cpp index 8cfdb709f5..4bf13aaa38 100644 --- a/src/KOKKOS/pair_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_dsf_kokkos.cpp @@ -17,17 +17,19 @@ ------------------------------------------------------------------------- */ #include "pair_coul_dsf_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "math_const.h" +#include "memory_kokkos.h" #include "neigh_list_kokkos.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "math_const.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -198,26 +200,13 @@ void PairCoulDSFKokkos::init_style() { PairCoulDSF::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with coul/dsf/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index f45366df22..2f0c9908c8 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_coul_long_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -397,26 +399,13 @@ void PairCoulLongKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with buck/coul/long/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.cpp b/src/KOKKOS/pair_coul_wolf_kokkos.cpp index e652c50a39..1841a1fb3e 100644 --- a/src/KOKKOS/pair_coul_wolf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_wolf_kokkos.cpp @@ -17,17 +17,19 @@ ------------------------------------------------------------------------- */ #include "pair_coul_wolf_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list_kokkos.h" -#include "neigh_request.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -199,26 +201,13 @@ void PairCoulWolfKokkos::init_style() { PairCoulWolf::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with coul/wolf/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp index b905ec5e67..ad9aff343d 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp @@ -17,18 +17,20 @@ ------------------------------------------------------------------------- */ #include "pair_dpd_fdt_energy_kokkos.h" -#include + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" -#include "update.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "kokkos.h" +#include "neighbor.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -83,26 +85,13 @@ void PairDPDfdtEnergyKokkos::init_style() { PairDPDfdtEnergy::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with dpd/fdt/energy/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); #ifdef DPD_USE_RAN_MARS rand_pool.init(random,seed); @@ -121,26 +110,13 @@ void PairDPDfdtEnergyKokkos::init_style() { PairDPDfdtEnergy::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with dpd/fdt/energy/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); #ifdef DPD_USE_RAN_MARS rand_pool.init(random,seed); diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index e08daf2ff7..eb5e29f09f 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -299,27 +299,13 @@ void PairEAMAlloyKokkos::init_style() PairEAM::init_style(); - // irequest = neigh request made by parent class - - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with pair eam/kk/alloy"); - } + // adjust neighbor list request for KOKKOS + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 88380a834d..208b473f3d 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -299,27 +299,13 @@ void PairEAMFSKokkos::init_style() PairEAM::init_style(); - // irequest = neigh request made by parent class - - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with pair eam/kk/fs"); - } + // adjust neighbor list request for KOKKOS + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index daa9b38252..ef2aada268 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -294,27 +294,13 @@ void PairEAMKokkos::init_style() PairEAM::init_style(); - // irequest = neigh request made by parent class - - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with pair eam/kk"); - } + // adjust neighbor list request for KOKKOS + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index d96e9f3f65..94d1333dfd 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -99,26 +99,13 @@ void PairExp6rxKokkos::init_style() { PairExp6rx::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with exp6/rx/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index b47b5f5a47..f72c97e6f6 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -81,23 +81,14 @@ void PairGranHookeHistoryKokkos::init_style() PairGranHookeHistory::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) error->all(FLERR,"Must use half neighbor list with gran/hooke/history/kk"); - } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index ab49237f4e..a5479e2edb 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -17,18 +17,20 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmm_coul_charmm_implicit_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -432,26 +434,13 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/charmm/coul/charmm/implicit/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index 982ec9d99e..efb8ab4c0b 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmm_coul_charmm_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -433,26 +435,13 @@ void PairLJCharmmCoulCharmmKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/charmm/coul/charmm/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index 0a650e30e1..f33a8803f8 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmm_coul_long_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -441,26 +443,13 @@ void PairLJCharmmCoulLongKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/charmm/coul/long/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index eb9baa0e92..37182aecee 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -13,8 +13,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_cut_kokkos.h" -#include -#include + #include "kokkos.h" #include "atom_kokkos.h" #include "comm.h" @@ -28,6 +27,9 @@ #include "error.h" #include "atom_masks.h" +#include +#include + using namespace LAMMPS_NS; #define KOKKOS_CUDA_MAX_THREADS 256 @@ -283,26 +285,13 @@ void PairLJClass2CoulCutKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/class2/coul/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index 3606b979c6..5b6715433b 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -13,19 +13,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_long_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -441,26 +443,13 @@ void PairLJClass2CoulLongKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/class2/coul/long/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index c1a16a0078..52f484d873 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -222,26 +224,13 @@ void PairLJClass2Kokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/class2/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index 9a2a5ce673..298984d099 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -13,19 +13,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_cut_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -274,26 +276,13 @@ void PairLJCutCoulCutKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/coul/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 9673796205..d150097473 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_debye_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -303,26 +305,13 @@ void PairLJCutCoulDebyeKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/coul/debye/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index 8f25ee45dc..3e72580e11 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -17,20 +17,22 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_dsf_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -298,26 +300,13 @@ void PairLJCutCoulDSFKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/coul/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index 2d4833843c..47a5dbd734 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -13,20 +13,22 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_long_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -434,26 +436,13 @@ void PairLJCutCoulLongKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/coul/long/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 5a5edcab76..0ca85d84c7 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -13,18 +13,20 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -214,26 +216,13 @@ void PairLJCutKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 14342357ec..52bfe36536 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_expand_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -226,26 +228,13 @@ void PairLJExpandKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/expand/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 069b4068e8..a25cc6fb76 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -17,8 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_gromacs_coul_gromacs_kokkos.h" -#include -#include + #include "kokkos.h" #include "atom_kokkos.h" #include "force.h" @@ -31,6 +30,9 @@ #include "error.h" #include "atom_masks.h" +#include +#include + using namespace LAMMPS_NS; #define KOKKOS_CUDA_MAX_THREADS 256 @@ -418,26 +420,13 @@ void PairLJGromacsCoulGromacsKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/gromacs/coul/gromacs/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index 4647b14ade..8af57aacbd 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -17,19 +17,21 @@ ------------------------------------------------------------------------- */ #include "pair_lj_gromacs_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -261,26 +263,13 @@ void PairLJGromacsKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/gromacs/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index 79452765c5..8e2064949b 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -13,23 +13,24 @@ ------------------------------------------------------------------------- */ #include "pair_lj_sdk_kokkos.h" -#include -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" -#include "memory_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "kokkos.h" +#include "memory_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" #include "lj_sdk_common.h" +#include +#include + using namespace LAMMPS_NS; using namespace LJSDKParms; @@ -254,26 +255,13 @@ void PairLJSDKKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/sdk/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index d6663608fb..0a8a7ffb03 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -17,20 +17,22 @@ ------------------------------------------------------------------------- */ #include "pair_morse_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -229,26 +231,13 @@ void PairMorseKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with morse/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index 8c558db32c..d38cb437d8 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -23,18 +23,20 @@ ------------------------------------------------------------------------------------------- */ #include "pair_multi_lucy_rx_kokkos.h" + +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "kokkos.h" +#include "math_const.h" +#include "memory_kokkos.h" +#include "neigh_list.h" +#include "neigh_request.h" + #include #include -#include "math_const.h" -#include "atom_kokkos.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "neigh_request.h" -#include "kokkos.h" using namespace LAMMPS_NS; @@ -95,26 +97,13 @@ void PairMultiLucyRXKokkos::init_style() { PairMultiLucyRX::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with multi/lucy/rx/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index 876654e628..d649558a31 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -166,24 +166,14 @@ void PairReaxFFKokkos::init_style() } } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - neighbor->requests[irequest]->ghost = 1; - } else { + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) error->all(FLERR,"Must use half neighbor list with pair style reaxff/kk"); - } allocate(); setup(); diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index dec7d12ebb..ae3bbb72f2 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -17,20 +17,22 @@ ------------------------------------------------------------------------- */ #include "pair_sw_kokkos.h" -#include -#include "kokkos.h" -#include "pair_kokkos.h" + #include "atom_kokkos.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory_kokkos.h" -#include "neighbor.h" -#include "neigh_list_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "kokkos.h" #include "math_const.h" +#include "memory_kokkos.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "neighbor.h" +#include "pair_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -604,29 +606,15 @@ void PairSWKokkos::init_style() { PairSW::init_style(); - // irequest = neigh request made by parent class - - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; + // adjust neighbor list request for KOKKOS + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); // always request a full neighbor list - - if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - if (neighflag == FULL) - neighbor->requests[irequest]->ghost = 1; - else - neighbor->requests[irequest]->ghost = 0; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with pair sw/kk"); - } + request->enable_full(); + if (lmp->kokkos->neighflag == FULL) request->enable_ghost(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index 158af4ed70..a4dbc1e249 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -17,16 +17,18 @@ ------------------------------------------------------------------------- */ #include "pair_table_kokkos.h" -#include -#include "kokkos.h" + #include "atom.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; @@ -510,25 +512,11 @@ void PairTableKokkos::compute_table(Table *tb) template void PairTableKokkos::init_style() { - neighbor->request(this,instance_me); - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/kk"); - } + auto request = neighbor->add_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index b7b9560bc1..e1dde642ae 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -18,24 +18,24 @@ #include "pair_table_rx_kokkos.h" -#include -#include -#include "kokkos.h" #include "atom.h" -#include "force.h" +#include "atom_masks.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "kokkos.h" +#include "kokkos.h" +#include "kokkos_few.h" +#include "memory_kokkos.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "fix.h" -#include "kokkos_few.h" -#include "kokkos.h" -#include "modify.h" +#include "neighbor.h" #include +#include +#include using namespace LAMMPS_NS; @@ -1265,25 +1265,11 @@ void PairTableRXKokkos::compute_table(Table *tb) template void PairTableRXKokkos::init_style() { - neighbor->request(this,instance_me); - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/kk"); - } + auto request = neighbor->add_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index c40efef8fa..d1bab2fd0f 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -27,20 +27,22 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list_kokkos.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" #include "suffix.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; @@ -96,31 +98,15 @@ void PairTersoffKokkos::init_style() { PairTersoff::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + request->enable_full(); + if (lmp->kokkos->neighflag == FULL) error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/kk"); - - if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) { - //if (neighflag == FULL || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - if (neighflag == FULL) - neighbor->requests[irequest]->ghost = 1; - else - neighbor->requests[irequest]->ghost = 0; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with tersoff/kk"); - } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 388e216a41..d648bd6d87 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -17,20 +17,22 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_mod_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list_kokkos.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" #include "suffix.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; @@ -86,30 +88,14 @@ void PairTersoffMODKokkos::init_style() { PairTersoffMOD::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/mod/kk"); - - if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - if (neighflag == FULL) - neighbor->requests[irequest]->ghost = 1; - else - neighbor->requests[irequest]->ghost = 0; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with tersoff/mod/kk"); - } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 9dc82be8c0..58033d7e0d 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -17,21 +17,23 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_zbl_kokkos.h" -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list_kokkos.h" -#include "update.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" #include "suffix.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -99,30 +101,15 @@ void PairTersoffZBLKokkos::init_style() { PairTersoffZBL::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + request->enable_full(); + if (lmp->kokkos->neighflag == FULL) error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/zbl/kk"); - - if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - if (neighflag == FULL) - neighbor->requests[irequest]->ghost = 1; - else - neighbor->requests[irequest]->ghost = 0; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with tersoff/zbl/kk"); - } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index 58ec9ca82f..d37cbd4a52 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -580,29 +580,14 @@ void PairVashishtaKokkos::init_style() { PairVashishta::init_style(); - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - // always request a full neighbor list - - if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - if (neighflag == FULL) - neighbor->requests[irequest]->ghost = 1; - else - neighbor->requests[irequest]->ghost = 0; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with pair vashishta/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + request->enable_full(); + if (lmp->kokkos->neighflag == FULL) request->enable_ghost(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 9654185b73..1bfefdfb47 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -17,18 +17,20 @@ ------------------------------------------------------------------------- */ #include "pair_yukawa_kokkos.h" -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -102,26 +104,13 @@ void PairYukawaKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with yukawa/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index 87a0f5d353..0a5d45d34a 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -17,22 +17,24 @@ ------------------------------------------------------------------------- */ #include "pair_zbl_kokkos.h" -#include -#include + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "update.h" +#include "neighbor.h" #include "respa.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "kokkos.h" +#include "update.h" #include "pair_zbl_const.h" +#include +#include + // From J.F. Zeigler, J. P. Biersack and U. Littmark, // "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. @@ -88,26 +90,13 @@ void PairZBLKokkos::init_style() error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } - // irequest = neigh request made by parent class + // adjust neighbor list request for KOKKOS - neighflag = lmp->kokkos->neighflag; - int irequest = neighbor->nrequest - 1; - - neighbor->requests[irequest]-> - kokkos_host = std::is_same::value && - !std::is_same::value; - neighbor->requests[irequest]-> - kokkos_device = std::is_same::value; - - if (neighflag == FULL) { - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->half = 0; - } else if (neighflag == HALF || neighflag == HALFTHREAD) { - neighbor->requests[irequest]->full = 0; - neighbor->requests[irequest]->half = 1; - } else { - error->all(FLERR,"Cannot use chosen neighbor list style with lj/cut/kk"); - } + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + if (lmp->kokkos->neighflag == FULL) request->enable_full(); } /* ---------------------------------------------------------------------- */ diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 68e728be42..9d4adfbd96 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -312,3 +312,8 @@ void NeighRequest::enable_full() half = 0; full = 1; } + +void NeighRequest::enable_ghost() +{ + ghost = 1; +} diff --git a/src/neigh_request.h b/src/neigh_request.h index d8228a59ef..321d0bfef5 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -128,6 +128,7 @@ class NeighRequest : protected Pointers { void set_kokkos_host(int); void set_skip(int *, int **); void enable_full(); + void enable_ghost(); int get_size() const { return size; } void *get_requestor() const { return requestor; }