diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index 546f204de6..1dd6240ec3 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -60,11 +60,13 @@ FixLangevinKokkos::FixLangevinKokkos(LAMMPS *lmp, int narg, char **a // optional args for (int i = 1; i <= ntypes; i++) ratio[i] = 1.0; - k_ratio.template modify(); + k_ratio.modify_host(); if (gjfflag) { grow_arrays(atomKK->nmax); atom->add_callback(Atom::GROW); + k_franprev.sync_host(); + k_lv.sync_host(); // initialize franprev to zero for (int i = 0; i < atomKK->nlocal; i++) { franprev[i][0] = 0.0; @@ -74,8 +76,8 @@ FixLangevinKokkos::FixLangevinKokkos(LAMMPS *lmp, int narg, char **a lv[i][1] = 0.0; lv[i][2] = 0.0; } - k_franprev.template modify(); - k_lv.template modify(); + k_franprev.modify_host(); + k_lv.modify_host(); } if (zeroflag) { k_fsumall = tdual_double_1d_3n("langevin:fsumall"); @@ -118,8 +120,8 @@ void FixLangevinKokkos::init() error->warning(FLERR,"Fix langevin gjf + kokkos is not implemented with random gaussians"); // prefactors are modified in the init - k_gfactor1.template modify(); - k_gfactor2.template modify(); + k_gfactor1.modify_host(); + k_gfactor2.modify_host(); } /* ---------------------------------------------------------------------- */ @@ -550,7 +552,7 @@ void FixLangevinKokkos::post_force(int /*vflag*/) h_fsumall(0) = fsumall[0]/count; h_fsumall(1) = fsumall[1]/count; h_fsumall(2) = fsumall[2]/count; - k_fsumall.template modify(); + k_fsumall.modify_host(); k_fsumall.template sync(); // set total force zero in parallel on the device FixLangevinKokkosZeroForceFunctor zero_functor(this); @@ -740,7 +742,7 @@ void FixLangevinKokkos::reset_dt() force->ftm2v; h_gfactor2[i] *= 1.0/sqrt(h_ratio[i]); } - k_gfactor2.template modify(); + k_gfactor2.modify_host(); } } @@ -891,6 +893,9 @@ void FixLangevinKokkos::end_of_step_rmass_item(int i) const template void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) { + k_franprev.sync_host(); + k_lv.sync_host(); + h_franprev(j,0) = h_franprev(i,0); h_franprev(j,1) = h_franprev(i,1); h_franprev(j,2) = h_franprev(i,2); @@ -898,8 +903,8 @@ void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) h_lv(j,1) = h_lv(i,1); h_lv(j,2) = h_lv(i,2); - k_franprev.template modify(); - k_lv.template modify(); + k_franprev.modify_host(); + k_lv.modify_host(); } diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 0d1c250b3d..f785eb10e4 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -1859,7 +1859,7 @@ void FixRxKokkos::computeLocalTemperature() // loop over neighbors of my atoms #if 0 - Kokkos::parallel_for ( inum, + Kokkos::parallel_for ( Kokkos::RangePolicy(0,inum), LAMMPS_LAMBDA(const int ii) { // Create an atomic view of sumWeights and dpdThetaLocal. Only needed @@ -1939,7 +1939,7 @@ void FixRxKokkos::computeLocalTemperature() // self-interaction for local temperature #if 0 - Kokkos::parallel_for ( nlocal, + Kokkos::parallel_for ( Kokkos::RangePolicy(0,nlocal), LAMMPS_LAMBDA(const int i) { double wij = 0.0; diff --git a/src/KOKKOS/fix_spring_self_kokkos.cpp b/src/KOKKOS/fix_spring_self_kokkos.cpp index 9ba796b1ab..df5db9eb1b 100644 --- a/src/KOKKOS/fix_spring_self_kokkos.cpp +++ b/src/KOKKOS/fix_spring_self_kokkos.cpp @@ -120,7 +120,7 @@ void FixSpringSelfKokkos::post_force(int /*vflag*/) auto l_yflag = yflag; auto l_zflag = zflag; - Kokkos::parallel_reduce(nlocal, LAMMPS_LAMBDA(const int& i, double& espring_kk) { + Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal), LAMMPS_LAMBDA(const int& i, double& espring_kk) { if (l_mask[i] & l_groupbit) { Few x_i; x_i[0] = l_x(i,0); diff --git a/src/KOKKOS/mliap_data_kokkos.cpp b/src/KOKKOS/mliap_data_kokkos.cpp index fd5a852114..fd2859f802 100644 --- a/src/KOKKOS/mliap_data_kokkos.cpp +++ b/src/KOKKOS/mliap_data_kokkos.cpp @@ -145,13 +145,13 @@ void MLIAPDataKokkos::generate_neighdata(class NeighList *list_in, i auto type = atomKK->k_type.view(); auto map=k_pairmliap->k_map.template view(); - Kokkos::parallel_scan(natomneigh, KOKKOS_LAMBDA (int ii, int &update, const bool final) { + Kokkos::parallel_scan(Kokkos::RangePolicy(0,natomneigh), KOKKOS_LAMBDA (int ii, int &update, const bool final) { if (final) d_ij(ii) = update; update += d_numneighs(ii); }); - Kokkos::parallel_for(natomneigh, KOKKOS_LAMBDA (int ii) { + Kokkos::parallel_for(Kokkos::RangePolicy(0,natomneigh), KOKKOS_LAMBDA (int ii) { int ij = d_ij(ii); const int i = d_ilist[ii]; const double xtmp = x(i, 0); @@ -183,7 +183,7 @@ void MLIAPDataKokkos::generate_neighdata(class NeighList *list_in, i d_ielems[ii] = ielem; }); - Kokkos::parallel_for(nmax, KOKKOS_LAMBDA (int i) { + Kokkos::parallel_for(Kokkos::RangePolicy(0,nmax), KOKKOS_LAMBDA (int i) { const int itype = type(i); d_elems(i) = map(itype); }); @@ -225,7 +225,7 @@ void MLIAPDataKokkos::grow_neigharrays() { auto d_cutsq=k_pairmliap->k_cutsq.template view(); auto h_cutsq=k_pairmliap->k_cutsq.template view(); auto d_numneighs = k_numneighs.template view(); - Kokkos::parallel_reduce(natomneigh, KOKKOS_LAMBDA (int ii, int &contrib) { + Kokkos::parallel_reduce(Kokkos::RangePolicy(0,natomneigh), KOKKOS_LAMBDA (int ii, int &contrib) { const int i = d_ilist[ii]; int count=0; const double xtmp = x(i, 0); diff --git a/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp b/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp index 1cf368e952..9f18078ac6 100644 --- a/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp +++ b/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp @@ -75,7 +75,7 @@ void MLIAPDescriptorSO3Kokkos::compute_forces(class MLIAPData *data_ Kokkos::View virial("virial"); data->k_pairmliap->k_vatom.template modify(); data->k_pairmliap->k_vatom.template sync(); - Kokkos::parallel_for(data->nlistatoms, KOKKOS_LAMBDA(int ii) { + Kokkos::parallel_for(Kokkos::RangePolicy(0,data->nlistatoms), KOKKOS_LAMBDA(int ii) { double fij[3]; const int i = d_iatoms(ii); @@ -187,7 +187,7 @@ void MLIAPDescriptorSO3Kokkos::compute_force_gradients(class MLIAPDa auto yoffset = data->yoffset, zoffset = data->zoffset, gamma_nnz = data->gamma_nnz; - Kokkos::parallel_for (data->nlistatoms, KOKKOS_LAMBDA (int ii) { + Kokkos::parallel_for (Kokkos::RangePolicy(0,data->nlistatoms), KOKKOS_LAMBDA (int ii) { const int i = d_iatoms(ii); // ensure rij, inside, wj, and rcutij are of size jnum diff --git a/src/KOKKOS/pair_meam_kokkos.cpp b/src/KOKKOS/pair_meam_kokkos.cpp index 9082c410e0..9852727855 100644 --- a/src/KOKKOS/pair_meam_kokkos.cpp +++ b/src/KOKKOS/pair_meam_kokkos.cpp @@ -147,7 +147,7 @@ void PairMEAMKokkos::compute(int eflag_in, int vflag_in) auto l_numneigh_half = d_numneigh_half; auto l_offset = d_offset; - Kokkos::parallel_scan(inum_half, LAMMPS_LAMBDA(int ii, int &m_fill, bool final) { + Kokkos::parallel_scan(Kokkos::RangePolicy(0,inum_half), LAMMPS_LAMBDA(int ii, int &m_fill, bool final) { int i = l_ilist_half[ii]; m_fill += l_numneigh_half[i]; if (final) diff --git a/src/KOKKOS/pair_mliap_kokkos.cpp b/src/KOKKOS/pair_mliap_kokkos.cpp index 5739a8ea2e..3c5bb7d910 100644 --- a/src/KOKKOS/pair_mliap_kokkos.cpp +++ b/src/KOKKOS/pair_mliap_kokkos.cpp @@ -302,7 +302,7 @@ void PairMLIAPKokkos::e_tally(MLIAPData* data) auto d_iatoms = k_data->k_iatoms.template view(); auto d_eatoms = k_data->k_eatoms.template view(); auto d_eatom = k_eatom.template view(); - Kokkos::parallel_for(data->nlistatoms, KOKKOS_LAMBDA (int ii) { + Kokkos::parallel_for(Kokkos::RangePolicy(0,data->nlistatoms), KOKKOS_LAMBDA (int ii) { d_eatom(d_iatoms(ii)) = d_eatoms(ii); }); k_eatom.modify(); diff --git a/src/KOKKOS/pair_pod_kokkos.cpp b/src/KOKKOS/pair_pod_kokkos.cpp index b0cab5a1df..85b9802034 100644 --- a/src/KOKKOS/pair_pod_kokkos.cpp +++ b/src/KOKKOS/pair_pod_kokkos.cpp @@ -532,7 +532,7 @@ int PairPODKokkos::NeighborCount(t_pod_1i l_numij, double l_rcutsq, auto l_neighbors = d_neighbors; // compute number of pairs for each atom i - Kokkos::parallel_for("NeighborCount", Kokkos::TeamPolicy<>(Ni, Kokkos::AUTO), KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type& team) { + Kokkos::parallel_for("NeighborCount", typename Kokkos::TeamPolicy(Ni, Kokkos::AUTO), KOKKOS_LAMBDA(const typename Kokkos::TeamPolicy::member_type& team) { int i = team.league_rank(); int gi = l_ilist(gi1 + i); double xi0 = l_x(gi, 0); @@ -555,7 +555,7 @@ int PairPODKokkos::NeighborCount(t_pod_1i l_numij, double l_rcutsq, }); // accumalative sum - Kokkos::parallel_scan("InclusivePrefixSum", Ni + 1, KOKKOS_LAMBDA(int i, int& update, const bool final) { + Kokkos::parallel_scan("InclusivePrefixSum", Kokkos::RangePolicy(0,Ni + 1), KOKKOS_LAMBDA(int i, int& update, const bool final) { if (i > 0) { update += l_numij(i); if (final) { @@ -582,7 +582,7 @@ void PairPODKokkos::NeighborList(t_pod_1d l_rij, t_pod_1i l_numij, auto l_map = d_map; auto l_type = type; - Kokkos::parallel_for("NeighborList", Kokkos::TeamPolicy<>(Ni, Kokkos::AUTO), KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type& team) { + Kokkos::parallel_for("NeighborList", typename Kokkos::TeamPolicy(Ni, Kokkos::AUTO), KOKKOS_LAMBDA(const typename Kokkos::TeamPolicy::member_type& team) { int i = team.league_rank(); int gi = l_ilist(gi1 + i); double xi0 = l_x(gi, 0); @@ -622,7 +622,7 @@ void PairPODKokkos::radialbasis(t_pod_1d rbft, t_pod_1d rbftx, t_pod t_pod_1d l_rij, t_pod_1d l_besselparams, double l_rin, double l_rmax, int l_besseldegree, int l_inversedegree, int l_nbesselpars, int Nij) { - Kokkos::parallel_for("ComputeRadialBasis", Nij, KOKKOS_LAMBDA(int n) { + Kokkos::parallel_for("ComputeRadialBasis", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int n) { double xij1 = l_rij(0+3*n); double xij2 = l_rij(1+3*n); double xij3 = l_rij(2+3*n); @@ -722,7 +722,7 @@ void PairPODKokkos::radialbasis(t_pod_1d rbft, t_pod_1d rbftx, t_pod template void PairPODKokkos::matrixMultiply(t_pod_1d a, t_pod_1d b, t_pod_1d c, int r1, int c1, int c2) { - Kokkos::parallel_for("MatrixMultiply", r1 * c2, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("MatrixMultiply", Kokkos::RangePolicy(0,r1 * c2), KOKKOS_LAMBDA(int idx) { int j = idx / r1; // Calculate column index int i = idx % r1; // Calculate row index double sum = 0.0; @@ -737,7 +737,7 @@ template void PairPODKokkos::angularbasis(t_pod_1d l_abf, t_pod_1d l_abfx, t_pod_1d l_abfy, t_pod_1d l_abfz, t_pod_1d l_rij, t_pod_1i l_pq3, int l_K3, int N) { - Kokkos::parallel_for("AngularBasis", N, KOKKOS_LAMBDA(int j) { + Kokkos::parallel_for("AngularBasis", Kokkos::RangePolicy(0,N), KOKKOS_LAMBDA(int j) { double x = l_rij(j*3 + 0); double y = l_rij(j*3 + 1); double z = l_rij(j*3 + 2); @@ -817,7 +817,7 @@ void PairPODKokkos::radialangularsum(t_pod_1d l_sumU, t_pod_1d l_rbf { int totalIterations = l_nrbf3 * l_K3 * Ni; if (l_nelements==1) { - Kokkos::parallel_for("RadialAngularSum", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("RadialAngularSum", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int k = idx % l_K3; int temp = idx / l_K3; int m = temp % l_nrbf3; @@ -835,7 +835,7 @@ void PairPODKokkos::radialangularsum(t_pod_1d l_sumU, t_pod_1d l_rbf }); } else { - Kokkos::parallel_for("RadialAngularSum", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("RadialAngularSum", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int k = idx % l_K3; int temp = idx / l_K3; int m = temp % l_nrbf3; @@ -863,7 +863,7 @@ void PairPODKokkos::twobodydesc(t_pod_1d d2, t_pod_1d l_rbf, t_pod_ int l_nrbf2, const int Ni, const int Nij) { int totalIterations = l_nrbf2 * Nij; - Kokkos::parallel_for("twobodydesc", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("twobodydesc", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx / l_nrbf2; // pair index int m = idx % l_nrbf2; // rbd index int i2 = n + Nij * m; // Index of the radial basis function for atom n and RBF m @@ -876,7 +876,7 @@ void PairPODKokkos::twobody_forces(t_pod_1d fij, t_pod_1d cb2, t_pod t_pod_1d l_rbfz, t_pod_1i l_idxi, t_pod_1i l_tj, int l_nrbf2, const int Ni, const int Nij) { int totalIterations = l_nrbf2 * Nij; - Kokkos::parallel_for("twobody_forces", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("twobody_forces", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx / l_nrbf2; // pair index int m = idx % l_nrbf2; // rbd index int i2 = n + Nij * m; // Index of the radial basis function for atom n and RBF m @@ -893,7 +893,7 @@ void PairPODKokkos::threebodydesc(t_pod_1d d3, t_pod_1d l_sumU, t_po int l_nelements, int l_nrbf3, int l_nabf3, int l_K3, const int Ni) { int totalIterations = l_nrbf3 * Ni; - Kokkos::parallel_for("ThreeBodyDesc", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("ThreeBodyDesc", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int m = idx % l_nrbf3; int i = idx / l_nrbf3; int nmi = l_nelements * l_K3 * m + l_nelements * l_K3 * l_nrbf3*i; @@ -925,7 +925,7 @@ void PairPODKokkos::threebody_forces(t_pod_1d fij, t_pod_1d cb3, t_p { int totalIterations = l_nrbf3 * Nij; if (l_nelements==1) { - Kokkos::parallel_for("threebody_forces1", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("threebody_forces1", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int j = idx / l_nrbf3; // Calculate j using integer division int m = idx % l_nrbf3; // Calculate m using modulo operation int idxR = j + Nij * m; // Pre-compute the index for rbf @@ -961,7 +961,7 @@ void PairPODKokkos::threebody_forces(t_pod_1d fij, t_pod_1d cb3, t_p } else { int N3 = Ni * l_nabf3 * l_nrbf3; - Kokkos::parallel_for("threebody_forces2", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("threebody_forces2", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int j = idx / l_nrbf3; // Derive the original j value int m = idx % l_nrbf3; // Derive the original m value int i2 = l_tj(j) - 1; @@ -1007,7 +1007,7 @@ void PairPODKokkos::threebody_forcecoeff(t_pod_1d fb3, t_pod_1d cb3, { int totalIterations = l_nrbf3 * Ni; if (l_nelements==1) { - Kokkos::parallel_for("threebody_forcecoeff1", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("threebody_forcecoeff1", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx / l_nrbf3; // Calculate j using integer division int m = idx % l_nrbf3; // Calculate m using modulo operation for (int p = 0; p < l_nabf3; p++) { @@ -1024,7 +1024,7 @@ void PairPODKokkos::threebody_forcecoeff(t_pod_1d fb3, t_pod_1d cb3, } else { int N3 = Ni * l_nabf3 * l_nrbf3; - Kokkos::parallel_for("threebody_forcecoeff2", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("threebody_forcecoeff2", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx / l_nrbf3; // Derive the original j value int m = idx % l_nrbf3; // Derive the original m value for (int p = 0; p < l_nabf3; p++) { @@ -1054,7 +1054,7 @@ void PairPODKokkos::fourbodydesc(t_pod_1d d4, t_pod_1d l_sumU, t_po t_pod_1i l_pc4, int l_nelements, int l_nrbf3, int l_nrbf4, int l_nabf4, int l_K3, int l_Q4, int Ni) { int totalIterations = l_nrbf4 * Ni; - Kokkos::parallel_for("fourbodydesc", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("fourbodydesc", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int m = idx % l_nrbf4; int i = idx / l_nrbf4; int idxU = l_nelements * l_K3 * m + l_nelements * l_K3 * l_nrbf3 * i; @@ -1092,7 +1092,7 @@ void PairPODKokkos::fourbody_forces(t_pod_1d fij, t_pod_1d cb4, t_po { int totalIterations = l_nrbf4 * Nij; if (l_nelements==1) { - Kokkos::parallel_for("fourbody_forces1", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("fourbody_forces1", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int j = idx / l_nrbf4; // Derive the original j value int m = idx % l_nrbf4; // Derive the original m value int idxU = l_K3 * m + l_K3*l_nrbf3*l_idxi(j); @@ -1151,7 +1151,7 @@ void PairPODKokkos::fourbody_forces(t_pod_1d fij, t_pod_1d cb4, t_po } else { int N3 = Ni * l_nabf4 * l_nrbf4; - Kokkos::parallel_for("fourbody_forces2", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("fourbody_forces2", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int j = idx / l_nrbf4; // Derive the original j value int m = idx % l_nrbf4; // Derive the original m value int idxM = j + Nij * m; @@ -1241,7 +1241,7 @@ void PairPODKokkos::fourbody_forcecoeff(t_pod_1d fb4, t_pod_1d cb4, { int totalIterations = l_nrbf4 * Ni; if (l_nelements==1) { - Kokkos::parallel_for("fourbody_forcecoeff1", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("fourbody_forcecoeff1", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx / l_nrbf4; // Derive the original j value int m = idx % l_nrbf4; // Derive the original m value int idxU = l_K3 * m + l_K3*l_nrbf3*i; @@ -1268,7 +1268,7 @@ void PairPODKokkos::fourbody_forcecoeff(t_pod_1d fb4, t_pod_1d cb4, } else { int N3 = Ni * l_nabf4 * l_nrbf4; - Kokkos::parallel_for("fourbody_forcecoeff2", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("fourbody_forcecoeff2", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx / l_nrbf4; // Derive the original j value int m = idx % l_nrbf4; // Derive the original m value for (int p = 0; p < l_nabf4; p++) { @@ -1311,7 +1311,7 @@ void PairPODKokkos::allbody_forces(t_pod_1d fij, t_pod_1d l_forcecoe t_pod_1i l_idxi, t_pod_1i l_tj, int l_nelements, int l_nrbf3, int l_K3, int Nij) { int totalIterations = l_nrbf3 * Nij; - Kokkos::parallel_for("allbody_forces", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("allbody_forces", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int j = idx / l_nrbf3; // Calculate j using integer division int m = idx % l_nrbf3; // Calculate m using modulo operation int i2 = l_tj(j) - 1; @@ -1346,7 +1346,7 @@ template void PairPODKokkos::crossdesc(t_pod_1d d12, t_pod_1d d1, t_pod_1d d2, t_pod_1i ind1, t_pod_1i ind2, int n12, int Ni) { int totalIterations = n12 * Ni; - Kokkos::parallel_for("crossdesc", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("crossdesc", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx % Ni; int i = idx / Ni; @@ -1359,7 +1359,7 @@ void PairPODKokkos::crossdesc_reduction(t_pod_1d cb1, t_pod_1d cb2, t_pod_1d d2, t_pod_1i ind1, t_pod_1i ind2, int n12, int Ni) { int totalIterations = n12 * Ni; - Kokkos::parallel_for("crossdesc_reduction", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("crossdesc_reduction", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx % Ni; // Ni int m = idx / Ni; // n12 int k1 = ind1(m); // dd1 @@ -1375,7 +1375,7 @@ void PairPODKokkos::crossdesc_reduction(t_pod_1d cb1, t_pod_1d cb2, template void PairPODKokkos::set_array_to_zero(t_pod_1d a, int N) { - Kokkos::parallel_for("initialize_array", N, KOKKOS_LAMBDA(int i) { + Kokkos::parallel_for("initialize_array", Kokkos::RangePolicy(0,N), KOKKOS_LAMBDA(int i) { a(i) = 0.0; }); } @@ -1480,7 +1480,7 @@ void PairPODKokkos::blockatom_base_coefficients(t_pod_1d ei, t_pod_1 int nDes = Mdesc; int nCoeff = nCoeffPerElement; - Kokkos::parallel_for("atomic_energies", Ni, KOKKOS_LAMBDA(int n) { + Kokkos::parallel_for("atomic_energies", Kokkos::RangePolicy(0,Ni), KOKKOS_LAMBDA(int n) { int nc = nCoeff*(tyai[n]-1); ei[n] = cefs[0 + nc]; for (int m=0; m::blockatom_base_coefficients(t_pod_1d ei, t_pod_1 }); int totalIterations = Ni*nDes; - Kokkos::parallel_for("base_coefficients", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("base_coefficients", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx % Ni; int m = idx / Ni; int nc = nCoeff*(tyai[n]-1); @@ -1516,7 +1516,7 @@ void PairPODKokkos::blockatom_environment_descriptors(t_pod_1d ei, t int nCoeff = nCoeffPerElement; int totalIterations = Ni*nCom; - Kokkos::parallel_for("pca", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("pca", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx % Ni; int k = idx / Ni; double sum = 0.0; @@ -1528,7 +1528,7 @@ void PairPODKokkos::blockatom_environment_descriptors(t_pod_1d ei, t }); totalIterations = Ni*nCls; - Kokkos::parallel_for("inverse_square_distances", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("inverse_square_distances", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx % Ni; int j = idx / Ni; int typei = tyai[i]-1; @@ -1541,14 +1541,14 @@ void PairPODKokkos::blockatom_environment_descriptors(t_pod_1d ei, t D[i + Ni*j] = 1.0 / sum; }); - Kokkos::parallel_for("Probabilities", Ni, KOKKOS_LAMBDA(int i) { + Kokkos::parallel_for("Probabilities", Kokkos::RangePolicy(0,Ni), KOKKOS_LAMBDA(int i) { double sum = 0; for (int j = 0; j < nCls; j++) sum += D[i + Ni*j]; sumD[i] = sum; for (int j = 0; j < nCls; j++) P[i + Ni*j] = D[i + Ni*j]/sum; }); - Kokkos::parallel_for("atomic_energies", Ni, KOKKOS_LAMBDA(int n) { + Kokkos::parallel_for("atomic_energies", Kokkos::RangePolicy(0,Ni), KOKKOS_LAMBDA(int n) { int nc = nCoeff*(tyai[n]-1); ei[n] = cefs[0 + nc]; for (int k = 0; k::blockatom_environment_descriptors(t_pod_1d ei, t ei[n] += cefs[1 + m + nDes*k + nc]*B[n + Ni*m]*P[n + Ni*k]; }); - Kokkos::parallel_for("env_coefficients", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("env_coefficients", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx % Ni; int k = idx / Ni; int nc = nCoeff*(tyai[n]-1); @@ -1567,7 +1567,7 @@ void PairPODKokkos::blockatom_environment_descriptors(t_pod_1d ei, t }); totalIterations = Ni*nDes; - Kokkos::parallel_for("base_coefficients", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("base_coefficients", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int n = idx % Ni; int m = idx / Ni; int nc = nCoeff*(tyai[n]-1); @@ -1577,7 +1577,7 @@ void PairPODKokkos::blockatom_environment_descriptors(t_pod_1d ei, t cb[n + Ni*m] = sum; }); - Kokkos::parallel_for("base_env_coefficients", totalIterations, KOKKOS_LAMBDA(int idx) { + Kokkos::parallel_for("base_env_coefficients", Kokkos::RangePolicy(0,totalIterations), KOKKOS_LAMBDA(int idx) { int i = idx % Ni; int m = idx / Ni; int typei = tyai[i]-1; @@ -1670,7 +1670,7 @@ template void PairPODKokkos::tallyforce(t_pod_1d l_fij, t_pod_1i l_ai, t_pod_1i l_aj, int Nij) { auto l_f = f; - Kokkos::parallel_for("TallyForce", Nij, KOKKOS_LAMBDA(int n) { + Kokkos::parallel_for("TallyForce", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int n) { int im = l_ai(n); int jm = l_aj(n); int n3 = 3*n; @@ -1694,7 +1694,7 @@ void PairPODKokkos::tallyenergy(t_pod_1d l_ei, int istart, int Ni) // For global energy tally if (eflag_global) { double local_eng_vdwl = 0.0; - Kokkos::parallel_reduce("GlobalEnergyTally", Ni, KOKKOS_LAMBDA(int k, E_FLOAT& update) { + Kokkos::parallel_reduce("GlobalEnergyTally", Kokkos::RangePolicy(0,Ni), KOKKOS_LAMBDA(int k, E_FLOAT& update) { update += l_ei(k); }, local_eng_vdwl); @@ -1704,7 +1704,7 @@ void PairPODKokkos::tallyenergy(t_pod_1d l_ei, int istart, int Ni) // For per-atom energy tally if (eflag_atom) { - Kokkos::parallel_for("PerAtomEnergyTally", Ni, KOKKOS_LAMBDA(int k) { + Kokkos::parallel_for("PerAtomEnergyTally", Kokkos::RangePolicy(0,Ni), KOKKOS_LAMBDA(int k) { l_eatom(istart + k) += l_ei(k); }); } @@ -1718,7 +1718,7 @@ void PairPODKokkos::tallystress(t_pod_1d l_fij, t_pod_1d l_rij, t_po if (vflag_global) { for (int j=0; j<3; j++) { F_FLOAT sum = 0.0; - Kokkos::parallel_reduce("GlobalStressTally", Nij, KOKKOS_LAMBDA(int k, F_FLOAT& update) { + Kokkos::parallel_reduce("GlobalStressTally", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int k, F_FLOAT& update) { int k3 = 3*k; update += l_rij(j + k3) * l_fij(j + k3); }, sum); @@ -1726,21 +1726,21 @@ void PairPODKokkos::tallystress(t_pod_1d l_fij, t_pod_1d l_rij, t_po } F_FLOAT sum = 0.0; - Kokkos::parallel_reduce("GlobalStressTally", Nij, KOKKOS_LAMBDA(int k, F_FLOAT& update) { + Kokkos::parallel_reduce("GlobalStressTally", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int k, F_FLOAT& update) { int k3 = 3*k; update += l_rij(k3) * l_fij(1 + k3); }, sum); virial[3] -= sum; sum = 0.0; - Kokkos::parallel_reduce("GlobalStressTally", Nij, KOKKOS_LAMBDA(int k, F_FLOAT& update) { + Kokkos::parallel_reduce("GlobalStressTally", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int k, F_FLOAT& update) { int k3 = 3*k; update += l_rij(k3) * l_fij(2 + k3); }, sum); virial[4] -= sum; sum = 0.0; - Kokkos::parallel_reduce("GlobalStressTally", Nij, KOKKOS_LAMBDA(int k, F_FLOAT& update) { + Kokkos::parallel_reduce("GlobalStressTally", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int k, F_FLOAT& update) { int k3 = 3*k; update += l_rij(1+k3) * l_fij(2+k3); }, sum); @@ -1748,7 +1748,7 @@ void PairPODKokkos::tallystress(t_pod_1d l_fij, t_pod_1d l_rij, t_po } if (vflag_atom) { - Kokkos::parallel_for("PerAtomStressTally", Nij, KOKKOS_LAMBDA(int k) { + Kokkos::parallel_for("PerAtomStressTally", Kokkos::RangePolicy(0,Nij), KOKKOS_LAMBDA(int k) { int i = l_ai(k); int j = l_aj(k); int k3 = 3*k;