From c8260af37cc01975ec00d8a5c228ea6ccec77922 Mon Sep 17 00:00:00 2001 From: Christopher Stone Date: Mon, 23 Jan 2017 13:34:51 -0500 Subject: [PATCH 01/16] Possible uninitialized variable in USER-DPD/pair_exp6_rx.cpp bugfix. Added explicit initialization (to zero) for several variables inside the inner j-loop to avoid using them uninitialized or from prior iterations within rmOldij_12 == 0. --- src/USER-DPD/pair_exp6_rx.cpp | 59 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index bf038dd3d7..1a07fb9d38 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -297,6 +297,13 @@ void PairExp6rx::compute(int eflag, int vflag) rm21_ij = 0.5*(rm2_i + rm1_j); epsilon21_ij = sqrt(epsilon2_i*epsilon1_j); + evdwlOldEXP6_12 = 0.0; + evdwlOldEXP6_21 = 0.0; + evdwlEXP6_12 = 0.0; + evdwlEXP6_21 = 0.0; + fpairOldEXP6_12 = 0.0; + fpairOldEXP6_21 = 0.0; + if(rmOld12_ij!=0.0 && rmOld21_ij!=0.0){ if(alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0) error->all(FLERR,"alpha_ij is 6.0 in pair exp6"); @@ -459,33 +466,33 @@ void PairExp6rx::compute(int eflag, int vflag) } else { evdwlEXP6_21 = buck1*(6.0*rexp - alpha21_ij*rm6ij*r6inv) - urc - durc*(r-rCut); } - - // - // Apply Mixing Rule to get the overall force for the CG pair - // - if (isite1 == isite2) fpair = sqrt(mixWtSite1old_i*mixWtSite2old_j)*fpairOldEXP6_12; - else fpair = sqrt(mixWtSite1old_i*mixWtSite2old_j)*fpairOldEXP6_12 + sqrt(mixWtSite2old_i*mixWtSite1old_j)*fpairOldEXP6_21; - - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; - if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; - } - - if (isite1 == isite2) evdwl = sqrt(mixWtSite1_i*mixWtSite2_j)*evdwlEXP6_12; - else evdwl = sqrt(mixWtSite1_i*mixWtSite2_j)*evdwlEXP6_12 + sqrt(mixWtSite2_i*mixWtSite1_j)*evdwlEXP6_21; - evdwl *= factor_lj; - - uCGnew[i] += 0.5*evdwl; - if (newton_pair || j < nlocal) - uCGnew[j] += 0.5*evdwl; - evdwl = evdwlOld; - if (evflag) ev_tally(i,j,nlocal,newton_pair, - evdwl,0.0,fpair,delx,dely,delz); } + + // + // Apply Mixing Rule to get the overall force for the CG pair + // + if (isite1 == isite2) fpair = sqrt(mixWtSite1old_i*mixWtSite2old_j)*fpairOldEXP6_12; + else fpair = sqrt(mixWtSite1old_i*mixWtSite2old_j)*fpairOldEXP6_12 + sqrt(mixWtSite2old_i*mixWtSite1old_j)*fpairOldEXP6_21; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (isite1 == isite2) evdwl = sqrt(mixWtSite1_i*mixWtSite2_j)*evdwlEXP6_12; + else evdwl = sqrt(mixWtSite1_i*mixWtSite2_j)*evdwlEXP6_12 + sqrt(mixWtSite2_i*mixWtSite1_j)*evdwlEXP6_21; + evdwl *= factor_lj; + + uCGnew[i] += 0.5*evdwl; + if (newton_pair || j < nlocal) + uCGnew[j] += 0.5*evdwl; + evdwl = evdwlOld; + if (evflag) ev_tally(i,j,nlocal,newton_pair, + evdwl,0.0,fpair,delx,dely,delz); } } } From 31976d1dee2dcbbacddd97e0a5f194d8cefe8814 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 23 Jan 2017 19:20:05 -0500 Subject: [PATCH 02/16] skip list definition was missing NP_HALFFULL flag --- src/USER-OMP/npair_skip_omp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/USER-OMP/npair_skip_omp.h b/src/USER-OMP/npair_skip_omp.h index b909dd7e12..5085aee7bc 100644 --- a/src/USER-OMP/npair_skip_omp.h +++ b/src/USER-OMP/npair_skip_omp.h @@ -18,7 +18,8 @@ NPairStyle(skip/omp, NPairSkip, - NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | + NP_SKIP | NP_HALF | NP_FULL | NP_HALFFULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) NPairStyle(skip/half/respa/omp, From b5cb74bd3343ea232f738a0f424e5b3019ecb251 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 23 Jan 2017 19:21:48 -0500 Subject: [PATCH 03/16] skip list build is compatible with NP_GHOST --- src/USER-OMP/npair_skip_omp.h | 6 ++++++ src/npair_skip.h | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/USER-OMP/npair_skip_omp.h b/src/USER-OMP/npair_skip_omp.h index 5085aee7bc..d3bc9b75ca 100644 --- a/src/USER-OMP/npair_skip_omp.h +++ b/src/USER-OMP/npair_skip_omp.h @@ -45,6 +45,12 @@ NPairStyle(skip/size/off2on/oneside/omp, NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) +NPairStyle(skip/ghost/omp, + NPairSkip, + NP_SKIP | NP_HALF | NP_FULL | NP_HALFFULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP | NP_GHOST) + #endif /* ERROR/WARNING messages: diff --git a/src/npair_skip.h b/src/npair_skip.h index f4cbdbcc6e..5dfa3b2bf0 100644 --- a/src/npair_skip.h +++ b/src/npair_skip.h @@ -16,9 +16,15 @@ NPairStyle(skip, NPairSkip, NP_SKIP | NP_HALF | NP_FULL | NP_HALFFULL | - NP_NSQ | NP_BIN | NP_MULTI | + NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) +NPairStyle(skip/ghost, + NPairSkip, + NP_SKIP | NP_HALF | NP_FULL | NP_HALFFULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST) + #else #ifndef LMP_NPAIR_SKIP_H From 73177d650de37716b9551138e9f43d8d58dfbf7b Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 25 Jan 2017 11:18:03 -0700 Subject: [PATCH 04/16] Fixing GPU memory issue in domain_kokkos --- src/KOKKOS/domain_kokkos.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 5c1f1a60b9..9742dc36b0 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -402,7 +402,6 @@ void DomainKokkos::pbc() void DomainKokkos::remap_all() { atomKK->sync(Device,X_MASK | IMAGE_MASK); - atomKK->modified(Device,X_MASK | IMAGE_MASK); x = atomKK->k_x.view(); image = atomKK->k_image.view(); @@ -428,6 +427,8 @@ void DomainKokkos::remap_all() LMPDeviceType::fence(); copymode = 0; + atomKK->modified(Device,X_MASK | IMAGE_MASK); + if (triclinic) lamda2x(nlocal); } @@ -521,7 +522,6 @@ void DomainKokkos::image_flip(int m_in, int n_in, int p_in) p_flip = p_in; atomKK->sync(Device,IMAGE_MASK); - atomKK->modified(Device,IMAGE_MASK); image = atomKK->k_image.view(); int nlocal = atomKK->nlocal; @@ -530,6 +530,8 @@ void DomainKokkos::image_flip(int m_in, int n_in, int p_in) Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); LMPDeviceType::fence(); copymode = 0; + + atomKK->modified(Device,IMAGE_MASK); } KOKKOS_INLINE_FUNCTION @@ -554,7 +556,6 @@ void DomainKokkos::operator()(TagDomain_image_flip, const int &i) const { void DomainKokkos::lamda2x(int n) { atomKK->sync(Device,X_MASK); - atomKK->modified(Device,X_MASK); x = atomKK->k_x.view(); @@ -562,6 +563,8 @@ void DomainKokkos::lamda2x(int n) Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); LMPDeviceType::fence(); copymode = 0; + + atomKK->modified(Device,X_MASK); } KOKKOS_INLINE_FUNCTION @@ -579,7 +582,6 @@ void DomainKokkos::operator()(TagDomain_lamda2x, const int &i) const { void DomainKokkos::x2lamda(int n) { atomKK->sync(Device,X_MASK); - atomKK->modified(Device,X_MASK); x = atomKK->k_x.view(); @@ -587,6 +589,8 @@ void DomainKokkos::x2lamda(int n) Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); LMPDeviceType::fence(); copymode = 0; + + atomKK->modified(Device,X_MASK); } KOKKOS_INLINE_FUNCTION From 26c8d3d98f478075f35da08e7cd722899c18cec2 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 25 Jan 2017 12:53:55 -0700 Subject: [PATCH 05/16] Fixing GPU memory issue in fix_langevin_kokkos --- src/KOKKOS/fix_langevin_kokkos.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index b51c934c3e..0572dcedbe 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -177,11 +177,12 @@ void FixLangevinKokkos::post_force(int vflag) // account for bias velocity if(tbiasflag == BIAS){ + atomKK->sync(temperature->execution_space,temperature->datamask_read); temperature->compute_scalar(); temperature->remove_bias_all(); // modifies velocities // if temeprature compute is kokkosized host-devcie comm won't be needed - atomKK->modified(Host,V_MASK); - atomKK->sync(execution_space,V_MASK); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); + atomKK->sync(execution_space,temperature->datamask_modify); } // compute langevin force in parallel on the device @@ -508,8 +509,10 @@ void FixLangevinKokkos::post_force(int vflag) DeviceType::fence(); if(tbiasflag == BIAS){ + atomKK->sync(temperature->execution_space,temperature->datamask_read); temperature->restore_bias_all(); // modifies velocities - atomKK->modified(Host,V_MASK); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); + atomKK->sync(execution_space,temperature->datamask_modify); } // set modify flags for the views modified in post_force functor From 6328beb7d791cea640993dd44167a41855c1cb37 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:22:42 -0700 Subject: [PATCH 06/16] fix double-return warning this #ifdef adds a return statement for little endian machines, but leaves the old one, which the compiler comlains is unreachable. this commit combines the conditionals so we can use #else --- src/KOKKOS/math_special_kokkos.h | 7 +++---- src/math_special.h | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/KOKKOS/math_special_kokkos.h b/src/KOKKOS/math_special_kokkos.h index c177e88574..88008312bf 100644 --- a/src/KOKKOS/math_special_kokkos.h +++ b/src/KOKKOS/math_special_kokkos.h @@ -42,12 +42,11 @@ namespace MathSpecialKokkos { { x *= x; x *= 1.4426950408889634074; // log_2(e) -#if defined(__BYTE_ORDER__) -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ return (x < 1023.0) ? exp2_x86(-x) : 0.0; -#endif -#endif +#else return (x < 1023.0) ? exp2(-x) : 0.0; +#endif } // x**2, use instead of pow(x,2.0) diff --git a/src/math_special.h b/src/math_special.h index 059ef5d3c7..e4b4998d54 100644 --- a/src/math_special.h +++ b/src/math_special.h @@ -41,12 +41,11 @@ namespace MathSpecial { { x *= x; x *= 1.4426950408889634074; // log_2(e) -#if defined(__BYTE_ORDER__) -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ return (x < 1023.0) ? exp2_x86(-x) : 0.0; -#endif -#endif +#else return (x < 1023.0) ? exp2(-x) : 0.0; +#endif } // x**2, use instead of pow(x,2.0) From effbe18c466f050b895d20426579630a99e4305c Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:24:01 -0700 Subject: [PATCH 07/16] fix domain boundary indexing the compiler pointed out that boundary[2][2] doesn't exist. If I understand this correctly, those checks should be against boundary[*][0]. --- src/domain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/domain.cpp b/src/domain.cpp index 52ac9d3d1b..1dede69729 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1600,10 +1600,10 @@ int Domain::ownatom(int id, double *x, imageint *image, int shrinkexceed) if (coord[0] < blo[0] && boundary[0][0] > 1) newcoord[0] = blo[0]; else if (coord[0] >= bhi[0] && boundary[0][1] > 1) newcoord[0] = bhi[0]; else newcoord[0] = coord[0]; - if (coord[1] < blo[1] && boundary[1][1] > 1) newcoord[1] = blo[1]; + if (coord[1] < blo[1] && boundary[1][0] > 1) newcoord[1] = blo[1]; else if (coord[1] >= bhi[1] && boundary[1][1] > 1) newcoord[1] = bhi[1]; else newcoord[1] = coord[1]; - if (coord[2] < blo[2] && boundary[2][2] > 1) newcoord[2] = blo[2]; + if (coord[2] < blo[2] && boundary[2][0] > 1) newcoord[2] = blo[2]; else if (coord[2] >= bhi[2] && boundary[2][1] > 1) newcoord[2] = bhi[2]; else newcoord[2] = coord[2]; From 3d40b517086823086e6a0733cc05d00a160190a3 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:24:52 -0700 Subject: [PATCH 08/16] remove unused variable --- src/library.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index eac8e059ee..992b8ba100 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -317,8 +317,6 @@ void lammps_free(void *ptr) int lammps_extract_setting(void *ptr, char *name) { - LAMMPS *lmp = (LAMMPS *) ptr; - if (strcmp(name,"bigint") == 0) return sizeof(bigint); if (strcmp(name,"tagint") == 0) return sizeof(tagint); if (strcmp(name,"imageint") == 0) return sizeof(imageint); From 60b48c9d661f547b6f24f4e6caf42b25c2ddb70d Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:36:24 -0700 Subject: [PATCH 09/16] add missing KOKKOS_INLINE_FUNCTION attributes this structure gets put inside a DualView, so these members need to be able to execute on the GPU --- src/KOKKOS/pair_buck_coul_cut_kokkos.h | 2 ++ src/KOKKOS/pair_buck_coul_long_kokkos.h | 2 ++ src/KOKKOS/pair_buck_kokkos.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.h b/src/KOKKOS/pair_buck_coul_cut_kokkos.h index 8bccabf8de..0b6aba5e92 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.h @@ -44,7 +44,9 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut { double init_one(int, int); struct params_buck_coul{ + KOKKOS_INLINE_FUNCTION params_buck_coul(){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; + KOKKOS_INLINE_FUNCTION params_buck_coul(int i){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; F_FLOAT cut_ljsq,cut_coulsq,a,c,rhoinv,buck1,buck2,offset; }; diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.h b/src/KOKKOS/pair_buck_coul_long_kokkos.h index c4af7e19f3..fe63a2c124 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.h @@ -45,7 +45,9 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong { double init_one(int, int); struct params_buck_coul{ + KOKKOS_INLINE_FUNCTION params_buck_coul(){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; + KOKKOS_INLINE_FUNCTION params_buck_coul(int i){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; F_FLOAT cut_ljsq,cut_coulsq,a,c,rhoinv,buck1,buck2,offset; }; diff --git a/src/KOKKOS/pair_buck_kokkos.h b/src/KOKKOS/pair_buck_kokkos.h index 6b6e6f793e..0b0bbf94cf 100644 --- a/src/KOKKOS/pair_buck_kokkos.h +++ b/src/KOKKOS/pair_buck_kokkos.h @@ -43,7 +43,9 @@ class PairBuckKokkos : public PairBuck { double init_one(int, int); struct params_buck{ + KOKKOS_INLINE_FUNCTION params_buck(){cutsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; + KOKKOS_INLINE_FUNCTION params_buck(int i){cutsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;}; F_FLOAT cutsq,a,c,rhoinv,buck1,buck2,offset; }; From 1074c6734be5a1b6be6fabf852975da0ea2d4ef7 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:37:27 -0700 Subject: [PATCH 10/16] add missing return keywords --- src/KOKKOS/neighbor_kokkos.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index 8f334415af..4173d67900 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -147,9 +147,9 @@ void NeighborKokkos::init_ex_mol_bit_kokkos() int NeighborKokkos::check_distance() { if (device_flag) - check_distance_kokkos(); + return check_distance_kokkos(); else - check_distance_kokkos(); + return check_distance_kokkos(); } template From 053ee54a274c64b212f4e1ceb8f3028600bcee2d Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:38:41 -0700 Subject: [PATCH 11/16] remove unused variable --- src/KOKKOS/neighbor_kokkos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index 4173d67900..1bf3f2ef39 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -157,7 +157,7 @@ int NeighborKokkos::check_distance_kokkos() { typedef DeviceType device_type; - double delx,dely,delz,rsq; + double delx,dely,delz; double delta,delta1,delta2; if (boxcheck) { From e992bfe510b5a72cf2aa1d01154cd3f8a59cc930 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:40:52 -0700 Subject: [PATCH 12/16] remove unused variable --- src/compute_coord_atom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 1df5ad64ca..8c69aa7874 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -191,7 +191,6 @@ void ComputeCoordAtom::compute_peratom() c_orientorder->invoked_flag |= INVOKED_PERATOM; } nqlist = c_orientorder->nqlist; - int ltmp = l; normv = c_orientorder->array_atom; comm->forward_comm_compute(this); } From 03c9c465338646ab87a1781730f187c2b0bbb432 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 15:49:05 -0700 Subject: [PATCH 13/16] add missing KOKKOS_INLINE_FUNCTION attributes --- src/KOKKOS/pair_lj_class2_kokkos.h | 2 ++ src/KOKKOS/pair_lj_expand_kokkos.h | 2 ++ src/KOKKOS/pair_lj_gromacs_kokkos.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/KOKKOS/pair_lj_class2_kokkos.h b/src/KOKKOS/pair_lj_class2_kokkos.h index 73865928f5..ccff6821f3 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_kokkos.h @@ -44,7 +44,9 @@ class PairLJClass2Kokkos : public PairLJClass2 { double init_one(int, int); struct params_lj{ + KOKKOS_INLINE_FUNCTION params_lj(){cutsq=0,lj1=0;lj2=0;lj3=0;lj4=0;offset=0;}; + KOKKOS_INLINE_FUNCTION params_lj(int i){cutsq=0,lj1=0;lj2=0;lj3=0;lj4=0;offset=0;}; F_FLOAT cutsq,lj1,lj2,lj3,lj4,offset; }; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.h b/src/KOKKOS/pair_lj_expand_kokkos.h index 125c638527..ee110bab80 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.h +++ b/src/KOKKOS/pair_lj_expand_kokkos.h @@ -44,7 +44,9 @@ class PairLJExpandKokkos : public PairLJExpand { double init_one(int, int); struct params_lj{ + KOKKOS_INLINE_FUNCTION params_lj(){cutsq=0,lj1=0;lj2=0;lj3=0;lj4=0;offset=0;shift=0;}; + KOKKOS_INLINE_FUNCTION params_lj(int i){cutsq=0,lj1=0;lj2=0;lj3=0;lj4=0;offset=0;shift=0;}; F_FLOAT cutsq,lj1,lj2,lj3,lj4,offset,shift; }; diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_kokkos.h index 4c03bf6e9b..1f16409dc5 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.h @@ -44,7 +44,9 @@ class PairLJGromacsKokkos : public PairLJGromacs { double init_one(int, int); struct params_lj{ + KOKKOS_INLINE_FUNCTION params_lj(){cut_inner_sq=0;cut_inner=0;lj1=0;lj2=0;lj3=0;lj4=0;offset=0;ljsw1=0;ljsw2=0;ljsw3=0;ljsw4=0;ljsw5=0;}; + KOKKOS_INLINE_FUNCTION params_lj(int i){cut_inner_sq=0;cut_inner=0;lj1=0;lj2=0;lj3=0;lj4=0;offset=0;ljsw1=0;ljsw2=0;ljsw3=0;ljsw4=0;ljsw5=0;}; F_FLOAT cut_inner_sq,cut_inner,lj1,lj2,lj3,lj4,offset,ljsw1,ljsw2,ljsw3,ljsw4,ljsw5; }; From 672bbbe494df00854648d336943368340844b8c7 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Wed, 25 Jan 2017 16:03:11 -0700 Subject: [PATCH 14/16] add more missing KOKKOS_INLINE_FUNCTION attributes --- src/KOKKOS/pair_coul_debye_kokkos.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KOKKOS/pair_coul_debye_kokkos.h b/src/KOKKOS/pair_coul_debye_kokkos.h index 1f6d222e04..4aadcbe4e1 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_coul_debye_kokkos.h @@ -44,7 +44,9 @@ class PairCoulDebyeKokkos : public PairCoulDebye { double init_one(int, int); struct params_coul{ + KOKKOS_INLINE_FUNCTION params_coul(){cutsq=0,scale=0;}; + KOKKOS_INLINE_FUNCTION params_coul(int i){cutsq=0,scale=0;}; F_FLOAT cutsq, scale; }; From 8b7bd9d88eb491d1479ed698c7ac98ab7bc7ebde Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 26 Jan 2017 14:59:10 -0500 Subject: [PATCH 15/16] fix bug where per atom data for USER-OMP was reducing the wrong arrays with hybrid styles --- src/USER-OMP/thr_omp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index 1744a77387..4eaf09fb9a 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -170,9 +170,8 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, switch (thr_style) { case THR_PAIR: { - Pair * const pair = lmp->force->pair; - if (pair->vflag_fdotr) { + if (lmp->force->pair->vflag_fdotr) { // this is a non-hybrid pair style. compute per thread fdotr if (fix->last_pair_hybrid == NULL) { @@ -192,6 +191,8 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, } if (evflag) { + Pair * const pair = (Pair *)style; + #if defined(_OPENMP) #pragma omp critical #endif From f8506fee23e1e196b3f729bf2dd1ed3aeb237269 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Thu, 26 Jan 2017 14:06:43 -0700 Subject: [PATCH 16/16] sync GHub with SVN --- doc/src/Manual.txt | 4 ++-- potentials/WL.meam | 13 +++++++++++++ src/angle_hybrid.cpp | 2 +- src/bond_hybrid.cpp | 2 +- src/dihedral_hybrid.cpp | 2 +- src/improper_hybrid.cpp | 2 +- src/neigh_request.cpp | 7 ++++++- src/neigh_request.h | 4 ++++ src/neighbor.cpp | 10 ++++++---- src/neighbor.h | 1 + src/version.h | 2 +- 11 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 potentials/WL.meam diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt index 5677d09a85..25319570a4 100644 --- a/doc/src/Manual.txt +++ b/doc/src/Manual.txt @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -21,7 +21,7 @@

LAMMPS Documentation :c,h3 -20 Jan 2017 version :c,h4 +26 Jan 2017 version :c,h4 Version info: :h4 diff --git a/potentials/WL.meam b/potentials/WL.meam new file mode 100644 index 0000000000..43eecb4223 --- /dev/null +++ b/potentials/WL.meam @@ -0,0 +1,13 @@ +# DATE: 2017-01-25 CONTRIBUTOR: Aidan Thompson, athomps@sandia.gov, CITATION: Lee, Baskes, Kim, Cho. Phys. Rev. B, 64, 184102 (2001) +rc = 3.8 +delr = 0.1 +augt1 = 0 +erose_form = 2 +zbl(1,1) = 0 +nn2(1,1) = 1 +Ec(1,1) = 8.66 +re(1,1) = 2.74 +attrac(1,1) = 0 +repuls(1,1) = 0 +Cmin(1,1,1) = 0.49 +Cmax(1,1,1) = 2.8 diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index a477d7f8f6..9b3af1856e 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -104,7 +104,7 @@ void AngleHybrid::compute(int eflag, int vflag) // accumulate sub-style global/peratom energy/virial in hybrid if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; for (m = 0; m < nstyles; m++) { neighbor->nanglelist = nanglelist[m]; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 1244c2822b..9a16d0e1fd 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -103,7 +103,7 @@ void BondHybrid::compute(int eflag, int vflag) // accumulate sub-style global/peratom energy/virial in hybrid if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; for (m = 0; m < nstyles; m++) { neighbor->nbondlist = nbondlist[m]; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 0ae396b887..372a858d02 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -105,7 +105,7 @@ void DihedralHybrid::compute(int eflag, int vflag) // accumulate sub-style global/peratom energy/virial in hybrid if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; for (m = 0; m < nstyles; m++) { neighbor->ndihedrallist = ndihedrallist[m]; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 78ee69569e..abaaae02da 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -105,7 +105,7 @@ void ImproperHybrid::compute(int eflag, int vflag) // accumulate sub-style global/peratom energy/virial in hybrid if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; for (m = 0; m < nstyles; m++) { neighbor->nimproperlist = nimproperlist[m]; diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 6354af4d36..4007daadce 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -46,7 +46,7 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) command_style = NULL; // combination of settings, mutiple can be set to 1 - // default is every reneighboring + // default is every reneighboring, not occasional // default is use newton_pair setting in force // default is no size history (when gran = 1) // default is no one-sided sphere/surface interactions (when gran = 1) @@ -55,6 +55,7 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) // default is no multi-threaded neighbor list build // default is no Kokkos neighbor list build // default is no Shardlow Splitting Algorithm (SSA) neighbor list build + // default is neighbors of atoms, not bonds occasional = 0; newton = 0; @@ -65,6 +66,7 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) intel = 0; kokkos_host = kokkos_device = 0; ssa = 0; + bond = 0; // copy/skip/derive info, default is no copy or skip // none or only one option is set @@ -142,6 +144,7 @@ int NeighRequest::identical(NeighRequest *other) if (kokkos_host != other->kokkos_host) same = 0; if (kokkos_device != other->kokkos_device) same = 0; if (ssa != other->ssa) same = 0; + if (bond != other->bond) same = 0; if (copy != other->copy_original) same = 0; if (same_skip(other) == 0) same = 0; @@ -182,6 +185,7 @@ int NeighRequest::same_kind(NeighRequest *other) if (kokkos_host != other->kokkos_host) same = 0; if (kokkos_device != other->kokkos_device) same = 0; if (ssa != other->ssa) same = 0; + if (bond != other->bond) same = 0; // copy/skip/derive info does not need to be the same @@ -237,4 +241,5 @@ void NeighRequest::copy_request(NeighRequest *other) kokkos_host = other->kokkos_host; kokkos_device = other->kokkos_device; ssa = other->ssa; + bond = other->bond; } diff --git a/src/neigh_request.h b/src/neigh_request.h index 0b561710e7..2738f4c036 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -95,6 +95,10 @@ class NeighRequest : protected Pointers { int ssa; + // 1 if bond neighbors, not atom neighbors + + int bond; + // ----------------- // end of optional settings // ----------------- diff --git a/src/neighbor.cpp b/src/neighbor.cpp index cbcd5d640d..79958a29f4 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1411,11 +1411,11 @@ int Neighbor::choose_pair(NeighRequest *rq) int copyflag,skipflag,halfflag,fullflag,halffullflag,sizeflag,respaflag, ghostflag,off2onflag,onesideflag,ssaflag,ompflag,intelflag, - kokkos_device_flag,kokkos_host_flag; + kokkos_device_flag,kokkos_host_flag,bondflag; copyflag = skipflag = halfflag = fullflag = halffullflag = sizeflag = ghostflag = respaflag = off2onflag = onesideflag = ssaflag = - ompflag = intelflag = kokkos_device_flag = kokkos_host_flag = 0; + ompflag = intelflag = kokkos_device_flag = kokkos_host_flag = bondflag = 0; if (rq->copy) copyflag = NP_COPY; if (rq->skip) skipflag = NP_SKIP; @@ -1447,6 +1447,7 @@ int Neighbor::choose_pair(NeighRequest *rq) if (rq->intel) intelflag = NP_INTEL; if (rq->kokkos_device) kokkos_device_flag = NP_KOKKOS_DEVICE; if (rq->kokkos_host) kokkos_host_flag = NP_KOKKOS_HOST; + if (rq->bond) bondflag = NP_BOND; int newtflag; if (rq->newton == 0 && newton_pair) newtflag = 1; @@ -1459,10 +1460,10 @@ int Neighbor::choose_pair(NeighRequest *rq) int mask; - //printf("FLAGS: %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + //printf("FLAGS: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", // copyflag,skipflag,halfflag,fullflag,halffullflag, // sizeflag,respaflag,ghostflag,off2onflag,onesideflag,ssaflag, - // ompflag,intelflag,newtflag); + // ompflag,intelflag,newtflag,bondflag); for (int i = 0; i < npclass; i++) { mask = pairmasks[i]; @@ -1496,6 +1497,7 @@ int Neighbor::choose_pair(NeighRequest *rq) if (off2onflag != (mask & NP_OFF2ON)) continue; if (onesideflag != (mask & NP_ONESIDE)) continue; if (ssaflag != (mask & NP_SSA)) continue; + if (bondflag != (mask & NP_BOND)) continue; if (ompflag != (mask & NP_OMP)) continue; if (intelflag != (mask & NP_INTEL)) continue; diff --git a/src/neighbor.h b/src/neighbor.h index eb603ad84f..d087af9ed5 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -267,6 +267,7 @@ namespace NeighConst { static const int NP_TRI = 1<<19; static const int NP_KOKKOS_DEVICE = 1<<20; static const int NP_KOKKOS_HOST = 1<<21; + static const int NP_BOND = 1<<22; } } diff --git a/src/version.h b/src/version.h index 1b3ba22b49..6847e5ff82 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "20 Jan 2017" +#define LAMMPS_VERSION "26 Jan 2017"