From 8d0de74d5c2170a2fc0f77274f586f69b2641d25 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 3 Mar 2023 09:55:44 -0700 Subject: [PATCH 1/2] Remove deprecated code --- src/KOKKOS/domain_kokkos.cpp | 11 ----------- src/KOKKOS/fix_langevin_kokkos.h | 24 ------------------------ src/KOKKOS/nbin_ssa_kokkos.h | 8 ++++---- src/KOKKOS/pair_reaxff_kokkos.h | 6 ------ 4 files changed, 4 insertions(+), 45 deletions(-) diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 379aa20ec8..9478aa939d 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -67,17 +67,6 @@ public: dst.value[2][1] = MAX(dst.value[2][1],src.value[2][1]); } - KOKKOS_INLINE_FUNCTION - void join(volatile value_type &dst, - const volatile value_type &src) const { - dst.value[0][0] = MIN(dst.value[0][0],src.value[0][0]); - dst.value[0][1] = MAX(dst.value[0][1],src.value[0][1]); - dst.value[1][0] = MIN(dst.value[1][0],src.value[1][0]); - dst.value[1][1] = MAX(dst.value[1][1],src.value[1][1]); - dst.value[2][0] = MIN(dst.value[2][0],src.value[2][0]); - dst.value[2][1] = MAX(dst.value[2][1],src.value[2][1]); - } - KOKKOS_INLINE_FUNCTION void operator() (const int &i, value_type &dst) const { dst.value[0][0] = MIN(dst.value[0][0],x(i,0)); diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index 97dbd28a33..adc07286f2 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -203,21 +203,6 @@ namespace LAMMPS_NS { update.fy += source.fy; update.fz += source.fz; } - - KOKKOS_INLINE_FUNCTION - static void init(volatile value_type &update) { - update.fx = 0.0; - update.fy = 0.0; - update.fz = 0.0; - } - KOKKOS_INLINE_FUNCTION - static void join(volatile value_type &update, - const volatile value_type &source) { - update.fx += source.fx; - update.fy += source.fy; - update.fz += source.fz; - } - }; template @@ -255,15 +240,6 @@ namespace LAMMPS_NS { const value_type &source) { update += source; } - KOKKOS_INLINE_FUNCTION - static void init(volatile value_type &update) { - update = 0.0; - } - KOKKOS_INLINE_FUNCTION - static void join(volatile value_type &update, - const volatile value_type &source) { - update += source; - } }; template diff --git a/src/KOKKOS/nbin_ssa_kokkos.h b/src/KOKKOS/nbin_ssa_kokkos.h index 8ce7cd2e0a..d3875ce201 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.h +++ b/src/KOKKOS/nbin_ssa_kokkos.h @@ -199,8 +199,8 @@ struct NPairSSAKokkosBinIDAtomsFunctor { } KOKKOS_INLINE_FUNCTION - void join (volatile value_type& dst, - const volatile value_type& src) const { + void join (value_type& dst, + const value_type& src) const { if (dst < src) dst = src; } @@ -226,8 +226,8 @@ struct NPairSSAKokkosBinIDGhostsFunctor { } KOKKOS_INLINE_FUNCTION - void join (volatile value_type& dst, - const volatile value_type& src) const { + void join (value_type& dst, + const value_type& src) const { if (dst < src) dst = src; } diff --git a/src/KOKKOS/pair_reaxff_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h index 56f89d4071..1ad0955a1e 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -530,12 +530,6 @@ struct PairReaxKokkosFindBondFunctor { dst = MAX(dst,src); } - KOKKOS_INLINE_FUNCTION - void join(volatile int &dst, - const volatile int &src) const { - dst = MAX(dst,src); - } - KOKKOS_INLINE_FUNCTION void operator()(const int ii, int &numbonds) const { c.calculate_find_bond_item(ii,numbonds); From 19efa08778d6e1f82bbdaa92c14b1a9c0a9b6e74 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 3 Mar 2023 10:06:58 -0700 Subject: [PATCH 2/2] Remove unused volatile overloads --- src/KOKKOS/compute_temp_deform_kokkos.h | 10 ---- src/KOKKOS/compute_temp_kokkos.h | 10 ---- src/KOKKOS/dihedral_charmm_kokkos.h | 19 ------- src/KOKKOS/fix_freeze_kokkos.h | 7 --- src/KOKKOS/fix_langevin_kokkos.h | 7 --- src/KOKKOS/fix_rx_kokkos.h | 9 ---- src/KOKKOS/fix_setforce_kokkos.h | 7 --- src/KOKKOS/kokkos_few.h | 21 -------- src/KOKKOS/kokkos_type.h | 70 ------------------------- src/KOKKOS/min_linesearch_kokkos.h | 6 --- 10 files changed, 166 deletions(-) diff --git a/src/KOKKOS/compute_temp_deform_kokkos.h b/src/KOKKOS/compute_temp_deform_kokkos.h index 17f0f6e0ab..2880314b55 100644 --- a/src/KOKKOS/compute_temp_deform_kokkos.h +++ b/src/KOKKOS/compute_temp_deform_kokkos.h @@ -58,16 +58,6 @@ class ComputeTempDeformKokkos: public ComputeTempDeform { t5 += rhs.t5; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_CTEMP &rhs) volatile { - t0 += rhs.t0; - t1 += rhs.t1; - t2 += rhs.t2; - t3 += rhs.t3; - t4 += rhs.t4; - t5 += rhs.t5; - } }; typedef s_CTEMP CTEMP; diff --git a/src/KOKKOS/compute_temp_kokkos.h b/src/KOKKOS/compute_temp_kokkos.h index 0bc56f13ba..828dfacd8e 100644 --- a/src/KOKKOS/compute_temp_kokkos.h +++ b/src/KOKKOS/compute_temp_kokkos.h @@ -54,16 +54,6 @@ class ComputeTempKokkos : public ComputeTemp { t5 += rhs.t5; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_CTEMP &rhs) volatile { - t0 += rhs.t0; - t1 += rhs.t1; - t2 += rhs.t2; - t3 += rhs.t3; - t4 += rhs.t4; - t5 += rhs.t5; - } }; typedef s_CTEMP CTEMP; diff --git a/src/KOKKOS/dihedral_charmm_kokkos.h b/src/KOKKOS/dihedral_charmm_kokkos.h index 96a9d2ffc1..dea251473b 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.h +++ b/src/KOKKOS/dihedral_charmm_kokkos.h @@ -63,25 +63,6 @@ struct s_EVM_FLOAT { vp[4] += rhs.vp[4]; vp[5] += rhs.vp[5]; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_EVM_FLOAT &rhs) volatile { - evdwl += rhs.evdwl; - ecoul += rhs.ecoul; - emol += rhs.emol; - v[0] += rhs.v[0]; - v[1] += rhs.v[1]; - v[2] += rhs.v[2]; - v[3] += rhs.v[3]; - v[4] += rhs.v[4]; - v[5] += rhs.v[5]; - vp[0] += rhs.vp[0]; - vp[1] += rhs.vp[1]; - vp[2] += rhs.vp[2]; - vp[3] += rhs.vp[3]; - vp[4] += rhs.vp[4]; - vp[5] += rhs.vp[5]; - } }; typedef struct s_EVM_FLOAT EVM_FLOAT; diff --git a/src/KOKKOS/fix_freeze_kokkos.h b/src/KOKKOS/fix_freeze_kokkos.h index 0a134030fb..04f28b742f 100644 --- a/src/KOKKOS/fix_freeze_kokkos.h +++ b/src/KOKKOS/fix_freeze_kokkos.h @@ -49,13 +49,6 @@ class FixFreezeKokkos : public FixFreeze { values[2] += rhs.values[2]; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile OriginalForce &rhs) volatile { - values[0] += rhs.values[0]; - values[1] += rhs.values[1]; - values[2] += rhs.values[2]; - } }; FixFreezeKokkos(class LAMMPS *, int, char **); diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index adc07286f2..f7142e6286 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -43,13 +43,6 @@ namespace LAMMPS_NS { fz += rhs.fz; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_FSUM &rhs) volatile { - fx += rhs.fx; - fy += rhs.fy; - fz += rhs.fz; - } }; typedef s_FSUM FSUM; diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index fba67de7bd..8633d665b3 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -59,15 +59,6 @@ struct s_CounterType nFails += rhs.nFails; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_CounterType &rhs) volatile - { - nSteps += rhs.nSteps; - nIters += rhs.nIters; - nFuncs += rhs.nFuncs; - nFails += rhs.nFails; - } }; typedef struct s_CounterType CounterType; diff --git a/src/KOKKOS/fix_setforce_kokkos.h b/src/KOKKOS/fix_setforce_kokkos.h index 4ed2cc5f0e..e723f9c7d6 100644 --- a/src/KOKKOS/fix_setforce_kokkos.h +++ b/src/KOKKOS/fix_setforce_kokkos.h @@ -41,13 +41,6 @@ struct s_double_3 { d2 += rhs.d2; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_double_3 &rhs) volatile { - d0 += rhs.d0; - d1 += rhs.d1; - d2 += rhs.d2; - } }; typedef s_double_3 double_3; diff --git a/src/KOKKOS/kokkos_few.h b/src/KOKKOS/kokkos_few.h index 48f6ed7390..96cbd1681f 100644 --- a/src/KOKKOS/kokkos_few.h +++ b/src/KOKKOS/kokkos_few.h @@ -28,42 +28,21 @@ class Few { KOKKOS_INLINE_FUNCTION Few(Few const& rhs) { for (std::size_t i = 0; i < n; ++i) new (data() + i) T(rhs[i]); } - KOKKOS_INLINE_FUNCTION Few(Few const volatile& rhs) { - for (std::size_t i = 0; i < n; ++i) new (data() + i) T(rhs[i]); - } - KOKKOS_INLINE_FUNCTION void operator=(Few const& rhs) volatile { - for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i]; - } KOKKOS_INLINE_FUNCTION void operator=(Few const& rhs) { for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i]; } - KOKKOS_INLINE_FUNCTION void operator=(Few const volatile& rhs) { - for (std::size_t i = 0; i < n; ++i) data()[i] = rhs[i]; - } KOKKOS_INLINE_FUNCTION T* data() { return reinterpret_cast(array_); } KOKKOS_INLINE_FUNCTION T const* data() const { return reinterpret_cast(array_); } - KOKKOS_INLINE_FUNCTION T volatile* data() volatile { - return reinterpret_cast(array_); - } - KOKKOS_INLINE_FUNCTION T const volatile* data() const volatile { - return reinterpret_cast(array_); - } KOKKOS_INLINE_FUNCTION T& operator[](std::size_t i) { return data()[i]; } KOKKOS_INLINE_FUNCTION T const& operator[](std::size_t i) const { return data()[i]; } - KOKKOS_INLINE_FUNCTION T volatile& operator[](std::size_t i) volatile { - return data()[i]; - } - KOKKOS_INLINE_FUNCTION T const volatile& operator[](std::size_t i) const volatile { - return data()[i]; - } }; #endif diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index a496f6ff94..06a6d3fc6e 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -64,23 +64,11 @@ namespace Kokkos { z+=tmp.z; } KOKKOS_INLINE_FUNCTION - void operator += (const lmp_float3& tmp) volatile { - x+=tmp.x; - y+=tmp.y; - z+=tmp.z; - } - KOKKOS_INLINE_FUNCTION void operator = (const lmp_float3& tmp) { x=tmp.x; y=tmp.y; z=tmp.z; } - KOKKOS_INLINE_FUNCTION - void operator = (const lmp_float3& tmp) volatile { - x=tmp.x; - y=tmp.y; - z=tmp.z; - } }; struct lmp_double3 { @@ -95,23 +83,11 @@ namespace Kokkos { z+=tmp.z; } KOKKOS_INLINE_FUNCTION - void operator += (const lmp_double3& tmp) volatile { - x+=tmp.x; - y+=tmp.y; - z+=tmp.z; - } - KOKKOS_INLINE_FUNCTION void operator = (const lmp_double3& tmp) { x=tmp.x; y=tmp.y; z=tmp.z; } - KOKKOS_INLINE_FUNCTION - void operator = (const lmp_double3& tmp) volatile { - x=tmp.x; - y=tmp.y; - z=tmp.z; - } }; template @@ -139,23 +115,11 @@ struct t_scalar3 { return *this; } - KOKKOS_FORCEINLINE_FUNCTION - t_scalar3 operator= (const volatile t_scalar3& rhs) { - x = rhs.x; y = rhs.y; z = rhs.z; - return *this; - } - KOKKOS_FORCEINLINE_FUNCTION t_scalar3 operator+= (const t_scalar3& rhs) { x += rhs.x; y += rhs.y; z += rhs.z; return *this; } - - KOKKOS_FORCEINLINE_FUNCTION - t_scalar3 operator+= (const volatile t_scalar3& rhs) volatile { - x += rhs.x; y += rhs.y; z += rhs.z; - return *this; - } }; template @@ -429,14 +393,6 @@ struct s_EV_FLOAT { for (int i = 0; i < 6; ++i) v[i] += rhs.v[i]; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_EV_FLOAT &rhs) volatile { - evdwl += rhs.evdwl; - ecoul += rhs.ecoul; - for (int i = 0; i < 6; ++i) - v[i] += rhs.v[i]; - } }; typedef struct s_EV_FLOAT EV_FLOAT; @@ -464,16 +420,6 @@ struct s_EV_FLOAT_REAX { for (int i = 0; i < 9; ++i) ereax[i] += rhs.ereax[i]; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_EV_FLOAT_REAX &rhs) volatile { - evdwl += rhs.evdwl; - ecoul += rhs.ecoul; - for (int i = 0; i < 6; ++i) - v[i] += rhs.v[i]; - for (int i = 0; i < 9; ++i) - ereax[i] += rhs.ereax[i]; - } }; typedef struct s_EV_FLOAT_REAX EV_FLOAT_REAX; @@ -501,16 +447,6 @@ struct s_FEV_FLOAT { for (int i = 0; i < 3; ++i) f[i] += rhs.f[i]; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_FEV_FLOAT &rhs) volatile { - evdwl += rhs.evdwl; - ecoul += rhs.ecoul; - for (int i = 0; i < 6; ++i) - v[i] += rhs.v[i]; - for (int i = 0; i < 3; ++i) - f[i] += rhs.f[i]; - } }; typedef struct s_FEV_FLOAT FEV_FLOAT; @@ -534,12 +470,6 @@ struct alignas(2*sizeof(F_FLOAT)) s_FLOAT2 { v[0] += rhs.v[0]; v[1] += rhs.v[1]; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_FLOAT2 &rhs) volatile { - v[0] += rhs.v[0]; - v[1] += rhs.v[1]; - } }; typedef struct s_FLOAT2 F_FLOAT2; diff --git a/src/KOKKOS/min_linesearch_kokkos.h b/src/KOKKOS/min_linesearch_kokkos.h index bf0b886b0c..5aae6e4487 100644 --- a/src/KOKKOS/min_linesearch_kokkos.h +++ b/src/KOKKOS/min_linesearch_kokkos.h @@ -31,12 +31,6 @@ namespace LAMMPS_NS { d1 += rhs.d1; return *this; } - - KOKKOS_INLINE_FUNCTION - void operator+=(const volatile s_double2 &rhs) volatile { - d0 += rhs.d0; - d1 += rhs.d1; - } }; //typedef s_double2 double2;