Minor naming fix in OpenCL nbnxm kernels
authorSzilárd Páll <pall.szilard@gmail.com>
Thu, 21 Jan 2021 05:17:55 +0000 (05:17 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 21 Jan 2021 05:17:55 +0000 (05:17 +0000)
OpenCL images are not used and when cleaning up host code the kernel
variables were left with the outdated/wrong naming. This change removes
the suffix to eliminate crust and potential for confusion.

src/gromacs/nbnxm/opencl/nbnxm_ocl_kernel.clh
src/gromacs/nbnxm/opencl/nbnxm_ocl_kernel_utils.clh

index e5adb03aa694a88602e638debe2065442597b8ec..7a55ca8e2d53cb52b3f24763adff0940ee75682c 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2012-2018, The GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -126,11 +126,11 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
 #else
                 const __global int* restrict atom_types, /* IN  */
 #endif
-                const __global float* restrict shift_vec,             /* IN stores float3 values */
-                __constant const float* gmx_unused nbfp_climg2d,      /* IN  */
-                __constant const float* gmx_unused nbfp_comb_climg2d, /* IN  */
-                __constant const float* gmx_unused coulomb_tab_climg2d, /* IN  */
-                const __global nbnxn_sci_t* pl_sci,                     /* IN  */
+                const __global float* restrict shift_vec,       /* IN stores float3 values */
+                __constant const float* gmx_unused nbfp,        /* IN  */
+                __constant const float* gmx_unused nbfp_comb,   /* IN  */
+                __constant const float* gmx_unused coulomb_tab, /* IN  */
+                const __global nbnxn_sci_t* pl_sci,             /* IN  */
 #ifndef PRUNE_NBL
                 const
 #endif
@@ -286,8 +286,8 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
             E_el += qi * qi;
 #        endif
 #        if defined LJ_EWALD
-            E_lj += nbfp_climg2d[atom_types[(sci * c_nbnxnGpuNumClusterPerSupercluster + i) * CL_SIZE + tidxi]
-                                 * (ntypes + 1) * 2];
+            E_lj += nbfp[atom_types[(sci * c_nbnxnGpuNumClusterPerSupercluster + i) * CL_SIZE + tidxi]
+                         * (ntypes + 1) * 2];
 #        endif /* LJ_EWALD */
         }
 
@@ -411,8 +411,8 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
 #endif                          /* IATYPE_SHMEM */
                                 /* LJ 6*C6 and 12*C12 */
 #ifndef LJ_COMB
-                                const float c6  = nbfp_climg2d[2 * (ntypes * typei + typej)];
-                                const float c12 = nbfp_climg2d[2 * (ntypes * typei + typej) + 1];
+                                const float c6  = nbfp[2 * (ntypes * typei + typej)];
+                                const float c12 = nbfp[2 * (ntypes * typei + typej) + 1];
 #else /* LJ_COMB */
 #    ifdef LJ_COMB_GEOM
                                 const float c6     = ljcp_i.x * ljcp_j.x;
@@ -474,7 +474,7 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
 #ifdef LJ_EWALD
 #    ifdef LJ_EWALD_COMB_GEOM
 #        ifdef CALC_ENERGIES
-                                calculate_lj_ewald_comb_geom_F_E(nbfp_comb_climg2d,
+                                calculate_lj_ewald_comb_geom_F_E(nbfp_comb,
                                                                  nbparam,
                                                                  typei,
                                                                  typej,
@@ -487,10 +487,10 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
                                                                  &E_lj_p);
 #        else
                                 calculate_lj_ewald_comb_geom_F(
-                                        nbfp_comb_climg2d, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6, &F_invr);
+                                        nbfp_comb, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6, &F_invr);
 #        endif /* CALC_ENERGIES */
 #    elif defined LJ_EWALD_COMB_LB
-                                calculate_lj_ewald_comb_LB_F_E(nbfp_comb_climg2d,
+                                calculate_lj_ewald_comb_LB_F_E(nbfp_comb,
                                                                nbparam,
                                                                typei,
                                                                typej,
@@ -555,7 +555,7 @@ __kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
                                 F_invr += qi * qj_f
                                           * (int_bit * inv_r2
                                              - interpolate_coulomb_force_r(
-                                                       coulomb_tab_climg2d, r2 * inv_r, coulomb_tab_scale))
+                                                       coulomb_tab, r2 * inv_r, coulomb_tab_scale))
                                           * inv_r;
 #endif /* EL_EWALD_ANA/TAB */
 
index d0482aa7c85368766a8a5930c0e535bd47c5016e..6d7db72249b24b460e0b2754acdccf9d5656725a 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -459,7 +459,7 @@ gmx_opencl_inline void calculate_potential_switch_F_E(const cl_nbparam_params_t*
 /*! Calculate LJ-PME grid force contribution with
  *  geometric combination rule.
  */
-gmx_opencl_inline void calculate_lj_ewald_comb_geom_F(__constant const float* nbfp_comb_climg2d,
+gmx_opencl_inline void calculate_lj_ewald_comb_geom_F(__constant const float* nbfp_comb,
                                                       int                     typei,
                                                       int                     typej,
                                                       float                   r2,
@@ -468,7 +468,7 @@ gmx_opencl_inline void calculate_lj_ewald_comb_geom_F(__constant const float* nb
                                                       float                   lje_coeff6_6,
                                                       float*                  F_invr)
 {
-    const float c6grid = nbfp_comb_climg2d[2 * typei] * nbfp_comb_climg2d[2 * typej];
+    const float c6grid = nbfp_comb[2 * typei] * nbfp_comb[2 * typej];
 
     /* Recalculate inv_r6 without exclusion mask */
     const float inv_r6_nm = inv_r2 * inv_r2 * inv_r2;
@@ -483,7 +483,7 @@ gmx_opencl_inline void calculate_lj_ewald_comb_geom_F(__constant const float* nb
 /*! Calculate LJ-PME grid force + energy contribution with
  *  geometric combination rule.
  */
-gmx_opencl_inline void calculate_lj_ewald_comb_geom_F_E(__constant const float* nbfp_comb_climg2d,
+gmx_opencl_inline void calculate_lj_ewald_comb_geom_F_E(__constant const float*    nbfp_comb,
                                                         const cl_nbparam_params_t* nbparam,
                                                         int                        typei,
                                                         int                        typej,
@@ -495,7 +495,7 @@ gmx_opencl_inline void calculate_lj_ewald_comb_geom_F_E(__constant const float*
                                                         float*                     F_invr,
                                                         float*                     E_lj)
 {
-    const float c6grid = nbfp_comb_climg2d[2 * typei] * nbfp_comb_climg2d[2 * typej];
+    const float c6grid = nbfp_comb[2 * typei] * nbfp_comb[2 * typej];
 
     /* Recalculate inv_r6 without exclusion mask */
     const float inv_r6_nm = inv_r2 * inv_r2 * inv_r2;
@@ -516,7 +516,7 @@ gmx_opencl_inline void calculate_lj_ewald_comb_geom_F_E(__constant const float*
  *  We use a single F+E kernel with conditional because the performance impact
  *  of this is pretty small and LB on the CPU is anyway very slow.
  */
-gmx_opencl_inline void calculate_lj_ewald_comb_LB_F_E(__constant const float*    nbfp_comb_climg2d,
+gmx_opencl_inline void calculate_lj_ewald_comb_LB_F_E(__constant const float*    nbfp_comb,
                                                       const cl_nbparam_params_t* nbparam,
                                                       int                        typei,
                                                       int                        typej,
@@ -530,9 +530,9 @@ gmx_opencl_inline void calculate_lj_ewald_comb_LB_F_E(__constant const float*
                                                       float*                     E_lj)
 {
     /* sigma and epsilon are scaled to give 6*C6 */
-    const float sigma = nbfp_comb_climg2d[2 * typei] + nbfp_comb_climg2d[2 * typej];
+    const float sigma = nbfp_comb[2 * typei] + nbfp_comb[2 * typej];
 
-    const float epsilon = nbfp_comb_climg2d[2 * typei + 1] * nbfp_comb_climg2d[2 * typej + 1];
+    const float epsilon = nbfp_comb[2 * typei + 1] * nbfp_comb[2 * typej + 1];
 
     const float sigma2 = sigma * sigma;
     const float c6grid = epsilon * sigma2 * sigma2 * sigma2;
@@ -558,16 +558,14 @@ gmx_opencl_inline void calculate_lj_ewald_comb_LB_F_E(__constant const float*
 /*! Interpolate Ewald coulomb force using the table through the tex_nbfp texture.
  *  Original idea: from the OpenMM project
  */
-gmx_opencl_inline float interpolate_coulomb_force_r(__constant const float* coulomb_tab_climg2d,
-                                                    float                   r,
-                                                    float                   scale)
+gmx_opencl_inline float interpolate_coulomb_force_r(__constant const float* coulomb_tab, float r, float scale)
 {
     float normalized = scale * r;
     int   index      = (int)normalized;
     float fract2     = normalized - (float)index;
     float fract1     = 1.0F - fract2;
 
-    return fract1 * coulomb_tab_climg2d[index] + fract2 * coulomb_tab_climg2d[index + 1];
+    return fract1 * coulomb_tab[index] + fract2 * coulomb_tab[index + 1];
 }
 
 /*! Calculate analytical Ewald correction term. */