Removed the incomplete support for warpless execution.
Change-Id: I2dfde49a0855cd4493cfe03a47e9e118b3ab909f
*/
/*! \internal \file
- * \brief OpenCL non-bonded kernel for AMD GPUs.
+ * \brief OpenCL non-bonded kernel.
*
* OpenCL 1.2 support is expected.
*
/* Currently we enable CJ prefetch for AMD/NVIDIA and disable it for the "nowarp" kernel
* Note that this should precede the kernel_utils include.
*/
+#if defined _AMD_SOURCE_ || defined _NVIDIA_SOURCE_
#define USE_CJ_PREFETCH 1
+#else
+#define USE_CJ_PREFETCH 0
+#endif
#include "nbnxn_ocl_kernel_utils.clh"
* with pruning it leads to slowdown.
*
* Tested with driver 1800.5
+ *
+ * TODO: check loop unrolling with NVIDIA OpenCL
*/
-#if !defined PRUNE_NBL
+#if !defined PRUNE_NBL && !defined _NVIDIA_SOURCE_
#pragma unroll 4
#endif
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 2012,2013,2014,2016,2017,2018, 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-
-/*! \internal \file
- * \brief OpenCL non-bonded "generic" kernel for architectures other than AMD/NVIDIA.
- *
- * This kernel is use by default on all architectures other than the ones we
- * explicitly support/optimize for.
- *
- * OpenCL 1.2 support is expected.
- *
- * \author Anca Hamuraru <anca@streamcomputing.eu>
- * \author Szilárd Páll <pall.szilard@gmail.com>
- * \ingroup module_mdlib
- */
-
-/* Currently we enable CJ prefetch for AMD/NVIDIA and disable it for the "nowarp" kernel
- * Note that this should precede the kernel_utils include.
- */
-#define USE_CJ_PREFETCH 0
-
-#include "nbnxn_ocl_kernel_utils.clh"
-
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if defined EL_EWALD_ANA || defined EL_EWALD_TAB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define EL_EWALD_ANY
-#endif
-
-#if defined EL_EWALD_ANY || defined EL_RF || defined LJ_EWALD || (defined EL_CUTOFF && defined CALC_ENERGIES)
-/* Macro to control the calculation of exclusion forces in the kernel
- * We do that with Ewald (elec/vdw) and RF. Cut-off only has exclusion
- * energy terms.
- *
- * Note: convenience macro, needs to be undef-ed at the end of the file.
- */
-#define EXCLUSION_FORCES
-#endif
-
-#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define LJ_EWALD
-#endif
-
-#if defined LJ_COMB_GEOM || defined LJ_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define LJ_COMB
-#endif
-
-/*
- Kernel launch parameters:
- - #blocks = #pair lists, blockId = pair list Id
- - #threads = CL_SIZE^2
- - shmem = CL_SIZE^2 * sizeof(float)
-
- Each thread calculates an i force-component taking one pair of i-j atoms.
-
- TODO: implement 128 threads/wavefront by porting over the NTHREAD_Z/j4 loop
- "horizontal splitting" over threads.
- */
-
-/* NOTE:
- NB_KERNEL_FUNC_NAME differs from the CUDA equivalent as it is not a variadic macro due to OpenCL not having a support for them, this version only takes exactly 2 arguments.
- Thus if more strings need to be appended a new macro must be written or it must be directly appended here.
- */
-__attribute__((reqd_work_group_size(CL_SIZE, CL_SIZE, 1)))
-#ifdef PRUNE_NBL
- #ifdef CALC_ENERGIES
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _VF_prune_opencl)
- #else
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_prune_opencl)
- #endif
-#else
- #ifdef CALC_ENERGIES
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _VF_opencl)
- #else
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
- #endif
-#endif
-(
-#ifndef LJ_COMB
- int ntypes, /* IN */
-#endif
- cl_nbparam_params_t nbparam_params, /* IN */
- const __global float4 *restrict xq, /* IN */
- __global float *restrict f, /* OUT stores float3 values */
- __global float *restrict e_lj, /* OUT */
- __global float *restrict e_el, /* OUT */
- __global float *restrict fshift, /* OUT stores float3 values */
-#ifdef LJ_COMB
- const __global float2 *restrict lj_comb, /* IN stores float2 values */
-#else
- const __global int *restrict atom_types, /* IN */
-#endif
- const __global float *restrict shift_vec, /* IN stores float3 values */
- __constant float* nbfp_climg2d, /* IN */
- __constant float* nbfp_comb_climg2d, /* IN */
- __constant float* coulomb_tab_climg2d, /* IN */
- const __global nbnxn_sci_t* pl_sci, /* IN */
-#ifndef PRUNE_NBL
- const
-#endif
- __global nbnxn_cj4_t* pl_cj4, /* OUT / IN */
- const __global nbnxn_excl_t* excl, /* IN */
- int bCalcFshift, /* IN */
- __local float4 *xqib /* Pointer to dyn alloc'ed shmem */
-)
-{
- /* convenience variables */
- cl_nbparam_params_t *nbparam = &nbparam_params;
-
- float rcoulomb_sq = nbparam->rcoulomb_sq;
-#ifdef LJ_COMB
- float2 ljcp_i, ljcp_j;
-#endif
-#ifdef VDW_CUTOFF_CHECK
- float rvdw_sq = nbparam_params.rvdw_sq;
- float vdw_in_range;
-#endif
-#ifdef LJ_EWALD
- float lje_coeff2, lje_coeff6_6;
-#endif
-#ifdef EL_RF
- float two_k_rf = nbparam->two_k_rf;
-#endif
-#ifdef EL_EWALD_TAB
- float coulomb_tab_scale = nbparam->coulomb_tab_scale;
-#endif
-#ifdef EL_EWALD_ANA
- float beta2 = nbparam->ewald_beta*nbparam->ewald_beta;
- float beta3 = nbparam->ewald_beta*nbparam->ewald_beta*nbparam->ewald_beta;
-#endif
-#ifdef PRUNE_NBL
- float rlist_sq = nbparam->rlistOuter_sq;
-#endif
-
-#ifdef CALC_ENERGIES
-#ifdef EL_EWALD_ANY
- float beta = nbparam->ewald_beta;
- float ewald_shift = nbparam->sh_ewald;
-#else
- float c_rf = nbparam->c_rf;
-#endif /* EL_EWALD_ANY */
-#endif /* CALC_ENERGIES */
-
- /* thread/block/warp id-s */
- unsigned int tidxi = get_local_id(0);
- unsigned int tidxj = get_local_id(1);
- unsigned int tidx = get_local_id(1) * get_local_size(0) + get_local_id(0);
- unsigned int bidx = get_group_id(0);
- unsigned int widx = tidx / WARP_SIZE; /* warp index */
- int sci, ci, cj, ci_offset,
- ai, aj,
- cij4_start, cij4_end;
-#ifndef LJ_COMB
- int typei, typej;
-#endif
- int i, jm, j4, wexcl_idx;
- float qi, qj_f,
- r2, inv_r, inv_r2;
-#if !defined LJ_COMB_LB || defined CALC_ENERGIES
- float inv_r6, c6, c12;
-#endif
-#if defined LJ_COMB_LB
- float sigma, epsilon;
-#endif
- float int_bit,
- F_invr;
-
-#ifdef CALC_ENERGIES
- float E_lj, E_el;
-#endif
-#if defined CALC_ENERGIES || defined LJ_POT_SWITCH
- float E_lj_p;
-#endif
- unsigned int wexcl, imask, mask_ji;
- float4 xqbuf;
- float3 xi, xj, rv, f_ij, fcj_buf /*, fshift_buf*/;
- float fshift_buf;
- float3 fci_buf[NCL_PER_SUPERCL]; /* i force buffer */
- nbnxn_sci_t nb_sci;
-
- /*! i-cluster interaction mask for a super-cluster with all NCL_PER_SUPERCL=8 bits set */
- const unsigned superClInteractionMask = ((1U << NCL_PER_SUPERCL) - 1U);
-
-#define LOCAL_OFFSET xqib + NCL_PER_SUPERCL * CL_SIZE
- __local int *cjs;
-#if USE_CJ_PREFETCH
- /* shmem buffer for cj, for both warps separately */
- cjs = (__local int *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET cjs + 2 * NBNXN_GPU_JGROUP_SIZE
-#endif
-
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- /* shmem buffer for i atom-type pre-loading */
- __local int *atib = (__local int *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET atib + NCL_PER_SUPERCL * CL_SIZE
-#else
- __local float2 *ljcpib = (__local float2 *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET ljcpib + NCL_PER_SUPERCL * CL_SIZE
-#endif
-#endif
-
-#ifndef REDUCE_SHUFFLE
- /* shmem j force buffer */
- __local float *f_buf = (__local float *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET f_buf + CL_SIZE * CL_SIZE * 3
-#endif
- /* Local buffer used to implement __any warp vote function from CUDA.
- volatile is used to avoid compiler optimizations for AMD builds. */
- volatile __local uint *warp_any = (__local uint*)(LOCAL_OFFSET);
-#undef LOCAL_OFFSET
-
- nb_sci = pl_sci[bidx]; /* my i super-cluster's index = current bidx */
- sci = nb_sci.sci; /* super-cluster */
- cij4_start = nb_sci.cj4_ind_start; /* first ...*/
- cij4_end = nb_sci.cj4_ind_end; /* and last index of j clusters */
-
- /* Pre-load i-atom x and q into shared memory */
- ci = sci * NCL_PER_SUPERCL + tidxj;
- ai = ci * CL_SIZE + tidxi;
-
- xqbuf = xq[ai] + (float4)(shift_vec[3 * nb_sci.shift], shift_vec[3 * nb_sci.shift + 1], shift_vec[3 * nb_sci.shift + 2], 0.0f);
- xqbuf.w *= nbparam->epsfac;
- xqib[tidxj * CL_SIZE + tidxi] = xqbuf;
-
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- /* Pre-load the i-atom types into shared memory */
- atib[tidxj * CL_SIZE + tidxi] = atom_types[ai];
-#else
- ljcpib[tidxj * CL_SIZE + tidxi] = lj_comb[ai];
-#endif
-#endif
- /* Initialise warp vote. (8x8 block) 2 warps for nvidia */
- if (tidx == 0 || tidx == 32)
- {
- warp_any[widx] = 0;
- }
-
- barrier(CLK_LOCAL_MEM_FENCE);
-
- for (ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
- {
- fci_buf[ci_offset] = (float3)(0.0f);
- }
-
-#ifdef LJ_EWALD
- /* TODO: we are trading registers with flops by keeping lje_coeff-s, try re-calculating it later */
- lje_coeff2 = nbparam->ewaldcoeff_lj*nbparam->ewaldcoeff_lj;
- lje_coeff6_6 = lje_coeff2*lje_coeff2*lje_coeff2*ONE_SIXTH_F;
-#endif /* LJ_EWALD */
-
-
-#ifdef CALC_ENERGIES
- E_lj = 0.0f;
- E_el = 0.0f;
-
-#if defined EXCLUSION_FORCES /* Ewald or RF */
- if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci*NCL_PER_SUPERCL)
- {
- /* we have the diagonal: add the charge and LJ self interaction energy term */
- for (i = 0; i < NCL_PER_SUPERCL; i++)
- {
-#if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
- qi = xqib[i * CL_SIZE + tidxi].w;
- E_el += qi*qi;
-#endif
-#if defined LJ_EWALD
- E_lj += nbfp_climg2d[atom_types[(sci*NCL_PER_SUPERCL + i)*CL_SIZE + tidxi]*(ntypes + 1)*2];
-#endif /* LJ_EWALD */
- }
-
- /* divide the self term(s) equally over the j-threads, then multiply with the coefficients. */
-#ifdef LJ_EWALD
- E_lj /= CL_SIZE;
- E_lj *= 0.5f*ONE_SIXTH_F*lje_coeff6_6;
-#endif /* LJ_EWALD */
-
-#if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
- /* Correct for epsfac^2 due to adding qi^2 */
- E_el /= nbparam->epsfac*CL_SIZE;
-#if defined EL_RF || defined EL_CUTOFF
- E_el *= -0.5f*c_rf;
-#else
- E_el *= -beta*M_FLOAT_1_SQRTPI; /* last factor 1/sqrt(pi) */
-#endif
-#endif /* EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF */
- }
-#endif /* EXCLUSION_FORCES */
-
-#endif /* CALC_ENERGIES */
-
-#ifdef EXCLUSION_FORCES
- const int nonSelfInteraction = !(nb_sci.shift == CENTRAL & tidxj <= tidxi);
-#endif
-
- /* loop over the j clusters = seen by any of the atoms in the current super-cluster */
- for (j4 = cij4_start; j4 < cij4_end; j4++)
- {
- wexcl_idx = pl_cj4[j4].imei[widx].excl_ind;
- imask = pl_cj4[j4].imei[widx].imask;
- wexcl = excl[wexcl_idx].pair[(tidx) & (WARP_SIZE - 1)];
-
- preloadCj4(cjs, pl_cj4[j4].cj, tidxi, tidxj, imask);
- barrier(CLK_LOCAL_MEM_FENCE);
-
-#ifndef PRUNE_NBL
- if (imask)
-#endif
- {
- /* Unrolling this loop improves performance without pruning but
- * with pruning it leads to slowdown.
- *
- * Tested with driver 1800.5
- */
-#if !defined PRUNE_NBL
-#pragma unroll 4
-#endif
-
- for (jm = 0; jm < NBNXN_GPU_JGROUP_SIZE; jm++)
- {
- if (imask & (superClInteractionMask << (jm * NCL_PER_SUPERCL)))
- {
- mask_ji = (1U << (jm * NCL_PER_SUPERCL));
-
- cj = loadCj(cjs, pl_cj4[j4].cj, jm, tidxi, tidxj);
- aj = cj * CL_SIZE + tidxj;
-
- /* load j atom data */
- xqbuf = xq[aj];
- xj = (float3)(xqbuf.xyz);
- qj_f = xqbuf.w;
-#ifndef LJ_COMB
- typej = atom_types[aj];
-#else
- ljcp_j = lj_comb[aj];
-#endif
-
- fcj_buf = (float3)(0.0f);
-
-#if !defined PRUNE_NBL
-#pragma unroll 8
-#endif
- for (i = 0; i < NCL_PER_SUPERCL; i++)
- {
- if (imask & mask_ji)
- {
- ci_offset = i; /* i force buffer offset */
-
- ci = sci * NCL_PER_SUPERCL + i; /* i cluster index */
- ai = ci * CL_SIZE + tidxi; /* i atom index */
-
- /* all threads load an atom from i cluster ci into shmem! */
- xqbuf = xqib[i * CL_SIZE + tidxi];
- xi = (float3)(xqbuf.xyz);
-
- /* distance between i and j atoms */
- rv = xi - xj;
- r2 = norm2(rv);
-
-#ifdef PRUNE_NBL
- /* vote.. should code shmem serialisation, wonder what the hit will be */
- if (r2 < rlist_sq)
- {
- warp_any[widx] = 1;
- }
-
- /* Note: in the general case, we need a mem fence here as we can't assume execution width. */
- barrier(CLK_LOCAL_MEM_FENCE);
-
- /* If _none_ of the atoms pairs are in cutoff range,
- the bit corresponding to the current
- cluster-pair in imask gets set to 0. */
- if (!warp_any[widx])
- {
- imask &= ~mask_ji;
- }
-
- warp_any[widx] = 0;
-#endif
-
- int_bit = (wexcl & mask_ji) ? 1.0f : 0.0f;
-
- /* cutoff & exclusion check */
-#ifdef EXCLUSION_FORCES
- if ((r2 < rcoulomb_sq) * (nonSelfInteraction | (ci != cj)))
-#else
- if ((r2 < rcoulomb_sq) * int_bit)
-#endif
- {
- /* load the rest of the i-atom parameters */
- qi = xqbuf.w;
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- typei = atib[i * CL_SIZE + tidxi];
-#else
- ljcp_i = ljcpib[i * CL_SIZE + tidxi];
-#endif
-#else /* IATYPE_SHMEM */
-#ifndef LJ_COMB
- typei = atom_types[ai];
-#else
- ljcp_i = lj_comb[ai];
-#endif
-#endif /* IATYPE_SHMEM */
- /* LJ 6*C6 and 12*C12 */
-#ifndef LJ_COMB
- c6 = nbfp_climg2d[2 * (ntypes * typei + typej)];
- c12 = nbfp_climg2d[2 * (ntypes * typei + typej)+1];
-#else /* LJ_COMB */
-#ifdef LJ_COMB_GEOM
- c6 = ljcp_i.x * ljcp_j.x;
- c12 = ljcp_i.y * ljcp_j.y;
-#else
- /* LJ 2^(1/6)*sigma and 12*epsilon */
- sigma = ljcp_i.x + ljcp_j.x;
- epsilon = ljcp_i.y * ljcp_j.y;
-#if defined CALC_ENERGIES || defined LJ_FORCE_SWITCH || defined LJ_POT_SWITCH
- convert_sigma_epsilon_to_c6_c12(sigma, epsilon, &c6, &c12);
-#endif
-#endif /* LJ_COMB_GEOM */
-#endif /* LJ_COMB */
-
- // Ensure distance do not become so small that r^-12 overflows
- r2 = max(r2, NBNXN_MIN_RSQ);
-
- inv_r = rsqrt(r2);
- inv_r2 = inv_r * inv_r;
-#if !defined LJ_COMB_LB || defined CALC_ENERGIES
- inv_r6 = inv_r2 * inv_r2 * inv_r2;
-#if defined EXCLUSION_FORCES
- /* We could mask inv_r2, but with Ewald
- * masking both inv_r6 and F_invr is faster */
- inv_r6 *= int_bit;
-#endif /* EXCLUSION_FORCES */
-
- F_invr = inv_r6 * (c12 * inv_r6 - c6) * inv_r2;
-#if defined CALC_ENERGIES || defined LJ_POT_SWITCH
- E_lj_p = int_bit * (c12 * (inv_r6 * inv_r6 + nbparam->repulsion_shift.cpot)*ONE_TWELVETH_F -
- c6 * (inv_r6 + nbparam->dispersion_shift.cpot)*ONE_SIXTH_F);
-
-#endif
-#else /* ! LJ_COMB_LB || CALC_ENERGIES */
- float sig_r = sigma*inv_r;
- float sig_r2 = sig_r*sig_r;
- float sig_r6 = sig_r2*sig_r2*sig_r2;
-#if defined EXCLUSION_FORCES
- sig_r6 *= int_bit;
-#endif /* EXCLUSION_FORCES */
-
- F_invr = epsilon * sig_r6 * (sig_r6 - 1.0f) * inv_r2;
-#endif /* ! LJ_COMB_LB || CALC_ENERGIES */
-
-
-#ifdef LJ_FORCE_SWITCH
-#ifdef CALC_ENERGIES
- calculate_force_switch_F_E(nbparam, c6, c12, inv_r, r2, &F_invr, &E_lj_p);
-#else
- calculate_force_switch_F(nbparam, c6, c12, inv_r, r2, &F_invr);
-#endif /* CALC_ENERGIES */
-#endif /* LJ_FORCE_SWITCH */
-
-
-#ifdef LJ_EWALD
-#ifdef LJ_EWALD_COMB_GEOM
-#ifdef CALC_ENERGIES
- calculate_lj_ewald_comb_geom_F_E(nbfp_comb_climg2d, nbparam, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6, int_bit, &F_invr, &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);
-#endif /* CALC_ENERGIES */
-#elif defined LJ_EWALD_COMB_LB
- calculate_lj_ewald_comb_LB_F_E(nbfp_comb_climg2d, nbparam, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6,
-#ifdef CALC_ENERGIES
- int_bit, true, &F_invr, &E_lj_p
-#else
- 0, false, &F_invr, 0
-#endif /* CALC_ENERGIES */
- );
-#endif /* LJ_EWALD_COMB_GEOM */
-#endif /* LJ_EWALD */
-
-#ifdef LJ_POT_SWITCH
-#ifdef CALC_ENERGIES
- calculate_potential_switch_F_E(nbparam, inv_r, r2, &F_invr, &E_lj_p);
-#else
- calculate_potential_switch_F(nbparam, inv_r, r2, &F_invr, &E_lj_p);
-#endif /* CALC_ENERGIES */
-#endif /* LJ_POT_SWITCH */
-
-#ifdef VDW_CUTOFF_CHECK
- /* Separate VDW cut-off check to enable twin-range cut-offs
- * (rvdw < rcoulomb <= rlist)
- */
- vdw_in_range = (r2 < rvdw_sq) ? 1.0f : 0.0f;
- F_invr *= vdw_in_range;
-#ifdef CALC_ENERGIES
- E_lj_p *= vdw_in_range;
-#endif
-#endif /* VDW_CUTOFF_CHECK */
-
-#ifdef CALC_ENERGIES
- E_lj += E_lj_p;
-
-#endif
-
-
-#ifdef EL_CUTOFF
-#ifdef EXCLUSION_FORCES
- F_invr += qi * qj_f * int_bit * inv_r2 * inv_r;
-#else
- F_invr += qi * qj_f * inv_r2 * inv_r;
-#endif
-#endif
-#ifdef EL_RF
- F_invr += qi * qj_f * (int_bit*inv_r2 * inv_r - two_k_rf);
-#endif
-#if defined EL_EWALD_ANA
- F_invr += qi * qj_f * (int_bit*inv_r2*inv_r + pmecorrF(beta2*r2)*beta3);
-#elif defined EL_EWALD_TAB
- F_invr += qi * qj_f * (int_bit*inv_r2 -
- interpolate_coulomb_force_r(coulomb_tab_climg2d, r2 * inv_r, coulomb_tab_scale)
- ) * inv_r;
-#endif /* EL_EWALD_ANA/TAB */
-
-#ifdef CALC_ENERGIES
-#ifdef EL_CUTOFF
- E_el += qi * qj_f * (int_bit*inv_r - c_rf);
-#endif
-#ifdef EL_RF
- E_el += qi * qj_f * (int_bit*inv_r + 0.5f * two_k_rf * r2 - c_rf);
-#endif
-#ifdef EL_EWALD_ANY
- /* 1.0f - erff is faster than erfcf */
- E_el += qi * qj_f * (inv_r * (int_bit - erf(r2 * inv_r * beta)) - int_bit * ewald_shift);
-#endif /* EL_EWALD_ANY */
-#endif
- f_ij = rv * F_invr;
-
- /* accumulate j forces in registers */
- fcj_buf -= f_ij;
-
- /* accumulate i forces in registers */
- fci_buf[ci_offset] += f_ij;
- }
- }
-
- /* shift the mask bit by 1 */
- mask_ji += mask_ji;
- }
-
- /* reduce j forces */
-
- /* store j forces in shmem */
- f_buf[ tidx] = fcj_buf.x;
- f_buf[ FBUF_STRIDE + tidx] = fcj_buf.y;
- f_buf[2 * FBUF_STRIDE + tidx] = fcj_buf.z;
-
- reduce_force_j_generic(f_buf, f, tidxi, tidxj, aj);
- }
- }
-#ifdef PRUNE_NBL
- /* Update the imask with the new one which does not contain the
- out of range clusters anymore. */
-
- pl_cj4[j4].imei[widx].imask = imask;
-#endif
- }
- }
-
- /* skip central shifts when summing shift forces */
- if (nb_sci.shift == CENTRAL)
- {
- bCalcFshift = false;
- }
-
- fshift_buf = 0.0f;
-
- /* reduce i forces */
- for (ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
- {
- ai = (sci * NCL_PER_SUPERCL + ci_offset) * CL_SIZE + tidxi;
-
- f_buf[ tidx] = fci_buf[ci_offset].x;
- f_buf[ FBUF_STRIDE + tidx] = fci_buf[ci_offset].y;
- f_buf[2 * FBUF_STRIDE + tidx] = fci_buf[ci_offset].z;
- barrier(CLK_LOCAL_MEM_FENCE);
- reduce_force_i(f_buf, f,
- &fshift_buf, bCalcFshift,
- tidxi, tidxj, ai);
- barrier(CLK_LOCAL_MEM_FENCE);
- }
-
- /* add up local shift forces into global mem */
- if (bCalcFshift)
- {
- /* Only threads with tidxj < 3 will update fshift.
- The threads performing the update must be the same with the threads
- which stored the reduction result in reduce_force_i function
- */
- if (tidxj < 3)
- {
- atomicAdd_g_f(&(fshift[3 * nb_sci.shift + tidxj]), fshift_buf);
- }
- }
-
-#ifdef CALC_ENERGIES
- /* flush the energies to shmem and reduce them */
- f_buf[ tidx] = E_lj;
- f_buf[FBUF_STRIDE + tidx] = E_el;
- reduce_energy_pow2(f_buf + (tidx & WARP_SIZE), e_lj, e_el, tidx & ~WARP_SIZE);
-
-#endif
-}
-
-#undef EL_EWALD_ANY
-#undef EXCLUSION_FORCES
-#undef LJ_EWALD
-
-#undef LJ_COMB
-#undef USE_CJ_PREFETCH
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 2012,2013,2014,2016,2017,2018, 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-
-/*! \internal \file
- * \brief OpenCL non-bonded kernel for NVIDIA GPUs.
- *
- * OpenCL 1.2 support is expected (CUDA driver API 7.5 and later).
- *
- * \author Anca Hamuraru <anca@streamcomputing.eu>
- * \author Szilárd Páll <pall.szilard@gmail.com>
- * \ingroup module_mdlib
- */
-
-/* Currently we enable CJ prefetch for AMD/NVIDIA and disable it for the "nowarp" kernel
- * Note that this should precede the kernel_utils include.
- */
-#define USE_CJ_PREFETCH 1
-
-#include "nbnxn_ocl_kernel_utils.clh"
-
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if defined EL_EWALD_ANA || defined EL_EWALD_TAB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define EL_EWALD_ANY
-#endif
-
-#if defined EL_EWALD_ANY || defined EL_RF || defined LJ_EWALD || (defined EL_CUTOFF && defined CALC_ENERGIES)
-/* Macro to control the calculation of exclusion forces in the kernel
- * We do that with Ewald (elec/vdw) and RF. Cut-off only has exclusion
- * energy terms.
- *
- * Note: convenience macro, needs to be undef-ed at the end of the file.
- */
-#define EXCLUSION_FORCES
-#endif
-
-#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define LJ_EWALD
-#endif
-
-#if defined LJ_COMB_GEOM || defined LJ_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-#define LJ_COMB
-#endif
-
-/*
- Kernel launch parameters:
- - #blocks = #pair lists, blockId = pair list Id
- - #threads = CL_SIZE^2
- - shmem = CL_SIZE^2 * sizeof(float)
-
- Each thread calculates an i force-component taking one pair of i-j atoms.
- */
-
-/* NOTE:
- NB_KERNEL_FUNC_NAME differs from the CUDA equivalent as it is not a variadic macro due to OpenCL not having a support for them, this version only takes exactly 2 arguments.
- Thus if more strings need to be appended a new macro must be written or it must be directly appended here.
- */
-__attribute__((reqd_work_group_size(CL_SIZE, CL_SIZE, 1)))
-#ifdef PRUNE_NBL
- #ifdef CALC_ENERGIES
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _VF_prune_opencl)
- #else
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_prune_opencl)
- #endif
-#else
- #ifdef CALC_ENERGIES
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _VF_opencl)
- #else
-__kernel void NB_KERNEL_FUNC_NAME(nbnxn_kernel, _F_opencl)
- #endif
-#endif
-(
-#ifndef LJ_COMB
- int ntypes, /* IN */
-#endif
- cl_nbparam_params_t nbparam_params, /* IN */
- const __global float4 *restrict xq, /* IN */
- __global float *restrict f, /* OUT stores float3 values */
- __global float *restrict e_lj, /* OUT */
- __global float *restrict e_el, /* OUT */
- __global float *restrict fshift, /* OUT stores float3 values */
-#ifdef LJ_COMB
- const __global float2 *restrict lj_comb, /* IN stores float2 values */
-#else
- const __global int *restrict atom_types, /* IN */
-#endif
- const __global float *restrict shift_vec, /* IN stores float3 values */
- __constant float* nbfp_climg2d, /* IN */
- __constant float* nbfp_comb_climg2d, /* IN */
- __constant float* coulomb_tab_climg2d, /* IN */
- const __global nbnxn_sci_t* pl_sci, /* IN */
-#ifndef PRUNE_NBL
- const
-#endif
- __global nbnxn_cj4_t* pl_cj4, /* OUT / IN */
- const __global nbnxn_excl_t* excl, /* IN */
- int bCalcFshift, /* IN */
- __local float4 *xqib /* Pointer to dyn alloc'ed shmem */
-)
-{
- /* convenience variables */
- cl_nbparam_params_t *nbparam = &nbparam_params;
-
- float rcoulomb_sq = nbparam->rcoulomb_sq;
-#ifdef LJ_COMB
- float2 ljcp_i, ljcp_j;
-#endif
-#ifdef VDW_CUTOFF_CHECK
- float rvdw_sq = nbparam_params.rvdw_sq;
- float vdw_in_range;
-#endif
-#ifdef LJ_EWALD
- float lje_coeff2, lje_coeff6_6;
-#endif
-#ifdef EL_RF
- float two_k_rf = nbparam->two_k_rf;
-#endif
-#ifdef EL_EWALD_TAB
- float coulomb_tab_scale = nbparam->coulomb_tab_scale;
-#endif
-#ifdef EL_EWALD_ANA
- float beta2 = nbparam->ewald_beta*nbparam->ewald_beta;
- float beta3 = nbparam->ewald_beta*nbparam->ewald_beta*nbparam->ewald_beta;
-#endif
-#ifdef PRUNE_NBL
- float rlist_sq = nbparam->rlistOuter_sq;
-#endif
-
-#ifdef CALC_ENERGIES
-#ifdef EL_EWALD_ANY
- float beta = nbparam->ewald_beta;
- float ewald_shift = nbparam->sh_ewald;
-#else
- float c_rf = nbparam->c_rf;
-#endif /* EL_EWALD_ANY */
-#endif /* CALC_ENERGIES */
-
- /* thread/block/warp id-s */
- unsigned int tidxi = get_local_id(0);
- unsigned int tidxj = get_local_id(1);
- unsigned int tidx = get_local_id(1) * get_local_size(0) + get_local_id(0);
- unsigned int bidx = get_group_id(0);
- unsigned int widx = tidx / WARP_SIZE; /* warp index */
- int sci, ci, cj, ci_offset,
- ai, aj,
- cij4_start, cij4_end;
-#ifndef LJ_COMB
- int typei, typej;
-#endif
- int i, jm, j4, wexcl_idx;
- float qi, qj_f,
- r2, inv_r, inv_r2;
-#if !defined LJ_COMB_LB || defined CALC_ENERGIES
- float inv_r6, c6, c12;
-#endif
-#if defined LJ_COMB_LB
- float sigma, epsilon;
-#endif
- float int_bit,
- F_invr;
-
-#ifdef CALC_ENERGIES
- float E_lj, E_el;
-#endif
-#if defined CALC_ENERGIES || defined LJ_POT_SWITCH
- float E_lj_p;
-#endif
- unsigned int wexcl, imask, mask_ji;
- float4 xqbuf;
- float3 xi, xj, rv, f_ij, fcj_buf /*, fshift_buf*/;
- float fshift_buf;
- float3 fci_buf[NCL_PER_SUPERCL]; /* i force buffer */
- nbnxn_sci_t nb_sci;
-
- /*! i-cluster interaction mask for a super-cluster with all NCL_PER_SUPERCL=8 bits set */
- const unsigned superClInteractionMask = ((1U << NCL_PER_SUPERCL) - 1U);
-
-#define LOCAL_OFFSET xqib + NCL_PER_SUPERCL * CL_SIZE
- __local int *cjs;
-#if USE_CJ_PREFETCH
- /* shmem buffer for cj, for both warps separately */
- cjs = (__local int *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET cjs + 2 * NBNXN_GPU_JGROUP_SIZE
-#endif
-
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- /* shmem buffer for i atom-type pre-loading */
- __local int *atib = (__local int *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET atib + NCL_PER_SUPERCL * CL_SIZE
-#else
- __local float2 *ljcpib = (__local float2 *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET ljcpib + NCL_PER_SUPERCL * CL_SIZE
-#endif
-#endif
-
-#ifndef REDUCE_SHUFFLE
- /* shmem j force buffer */
- __local float *f_buf = (__local float *)(LOCAL_OFFSET);
- #undef LOCAL_OFFSET
- #define LOCAL_OFFSET f_buf + CL_SIZE * CL_SIZE * 3
-#endif
- /* Local buffer used to implement __any warp vote function from CUDA.
- volatile is used to avoid compiler optimizations for AMD builds. */
- volatile __local uint *warp_any = (__local uint*)(LOCAL_OFFSET);
-#undef LOCAL_OFFSET
-
- nb_sci = pl_sci[bidx]; /* my i super-cluster's index = current bidx */
- sci = nb_sci.sci; /* super-cluster */
- cij4_start = nb_sci.cj4_ind_start; /* first ...*/
- cij4_end = nb_sci.cj4_ind_end; /* and last index of j clusters */
-
- /* Pre-load i-atom x and q into shared memory */
- ci = sci * NCL_PER_SUPERCL + tidxj;
- ai = ci * CL_SIZE + tidxi;
-
- xqbuf = xq[ai] + (float4)(shift_vec[3 * nb_sci.shift], shift_vec[3 * nb_sci.shift + 1], shift_vec[3 * nb_sci.shift + 2], 0.0f);
- xqbuf.w *= nbparam->epsfac;
- xqib[tidxj * CL_SIZE + tidxi] = xqbuf;
-
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- /* Pre-load the i-atom types into shared memory */
- atib[tidxj * CL_SIZE + tidxi] = atom_types[ai];
-#else
- ljcpib[tidxj * CL_SIZE + tidxi] = lj_comb[ai];
-#endif
-#endif
- /* Initialise warp vote. (8x8 block) 2 warps for nvidia */
- if (tidx == 0 || tidx == 32)
- {
- warp_any[widx] = 0;
- }
-
- barrier(CLK_LOCAL_MEM_FENCE);
-
- for (ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
- {
- fci_buf[ci_offset] = (float3)(0.0f);
- }
-
-#ifdef LJ_EWALD
- /* TODO: we are trading registers with flops by keeping lje_coeff-s, try re-calculating it later */
- lje_coeff2 = nbparam->ewaldcoeff_lj*nbparam->ewaldcoeff_lj;
- lje_coeff6_6 = lje_coeff2*lje_coeff2*lje_coeff2*ONE_SIXTH_F;
-#endif /* LJ_EWALD */
-
-
-#ifdef CALC_ENERGIES
- E_lj = 0.0f;
- E_el = 0.0f;
-
-#if defined EXCLUSION_FORCES /* Ewald or RF */
- if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci*NCL_PER_SUPERCL)
- {
- /* we have the diagonal: add the charge and LJ self interaction energy term */
- for (i = 0; i < NCL_PER_SUPERCL; i++)
- {
-#if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
- qi = xqib[i * CL_SIZE + tidxi].w;
- E_el += qi*qi;
-#endif
-#if defined LJ_EWALD
- E_lj += nbfp_climg2d[atom_types[(sci*NCL_PER_SUPERCL + i)*CL_SIZE + tidxi]*(ntypes + 1)*2];
-#endif /* LJ_EWALD */
- }
-
- /* divide the self term(s) equally over the j-threads, then multiply with the coefficients. */
-#ifdef LJ_EWALD
- E_lj /= CL_SIZE;
- E_lj *= 0.5f*ONE_SIXTH_F*lje_coeff6_6;
-#endif /* LJ_EWALD */
-
-#if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
- /* Correct for epsfac^2 due to adding qi^2 */
- E_el /= nbparam->epsfac*CL_SIZE;
-#if defined EL_RF || defined EL_CUTOFF
- E_el *= -0.5f*c_rf;
-#else
- E_el *= -beta*M_FLOAT_1_SQRTPI; /* last factor 1/sqrt(pi) */
-#endif
-#endif /* EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF */
- }
-#endif /* EXCLUSION_FORCES */
-
-#endif /* CALC_ENERGIES */
-
-#ifdef EXCLUSION_FORCES
- const int nonSelfInteraction = !(nb_sci.shift == CENTRAL & tidxj <= tidxi);
-#endif
-
- /* loop over the j clusters = seen by any of the atoms in the current super-cluster */
- for (j4 = cij4_start; j4 < cij4_end; j4++)
- {
- wexcl_idx = pl_cj4[j4].imei[widx].excl_ind;
- imask = pl_cj4[j4].imei[widx].imask;
- wexcl = excl[wexcl_idx].pair[(tidx) & (WARP_SIZE - 1)];
-
- preloadCj4(cjs, pl_cj4[j4].cj, tidxi, tidxj, imask);
-
-#ifndef PRUNE_NBL
- if (imask)
-#endif
- {
- /* TODO: check loop unrolling with NVIDIA OpenCL */
-#if !defined PRUNE_NBL
-//#pragma unroll 4
-#endif
-
- for (jm = 0; jm < NBNXN_GPU_JGROUP_SIZE; jm++)
- {
- if (imask & (superClInteractionMask << (jm * NCL_PER_SUPERCL)))
- {
- mask_ji = (1U << (jm * NCL_PER_SUPERCL));
-
- cj = loadCj(cjs, pl_cj4[j4].cj, jm, tidxi, tidxj);
- aj = cj * CL_SIZE + tidxj;
-
- /* load j atom data */
- xqbuf = xq[aj];
- xj = (float3)(xqbuf.xyz);
- qj_f = xqbuf.w;
-#ifndef LJ_COMB
- typej = atom_types[aj];
-#else
- ljcp_j = lj_comb[aj];
-#endif
-
- fcj_buf = (float3)(0.0f);
-
-#if !defined PRUNE_NBL
-#pragma unroll 8
-#endif
- for (i = 0; i < NCL_PER_SUPERCL; i++)
- {
- if (imask & mask_ji)
- {
- ci_offset = i; /* i force buffer offset */
-
- ci = sci * NCL_PER_SUPERCL + i; /* i cluster index */
- ai = ci * CL_SIZE + tidxi; /* i atom index */
-
- /* all threads load an atom from i cluster ci into shmem! */
- xqbuf = xqib[i * CL_SIZE + tidxi];
- xi = (float3)(xqbuf.xyz);
-
- /* distance between i and j atoms */
- rv = xi - xj;
- r2 = norm2(rv);
-
-#ifdef PRUNE_NBL
- /* vote.. should code shmem serialisation, wonder what the hit will be */
- if (r2 < rlist_sq)
- {
- warp_any[widx] = 1;
- }
-
- /* If _none_ of the atoms pairs are in cutoff range,
- the bit corresponding to the current
- cluster-pair in imask gets set to 0. */
- if (!warp_any[widx])
- {
- imask &= ~mask_ji;
- }
-
- warp_any[widx] = 0;
-#endif
-
- int_bit = (wexcl & mask_ji) ? 1.0f : 0.0f;
-
- /* cutoff & exclusion check */
-#ifdef EXCLUSION_FORCES
- if ((r2 < rcoulomb_sq) * (nonSelfInteraction | (ci != cj)))
-#else
- if ((r2 < rcoulomb_sq) * int_bit)
-#endif
- {
- /* load the rest of the i-atom parameters */
- qi = xqbuf.w;
-#ifdef IATYPE_SHMEM
-#ifndef LJ_COMB
- typei = atib[i * CL_SIZE + tidxi];
-#else
- ljcp_i = ljcpib[i * CL_SIZE + tidxi];
-#endif
-#else /* IATYPE_SHMEM */
-#ifndef LJ_COMB
- typei = atom_types[ai];
-#else
- ljcp_i = lj_comb[ai];
-#endif
-#endif /* IATYPE_SHMEM */
- /* LJ 6*C6 and 12*C12 */
-#ifndef LJ_COMB
- c6 = nbfp_climg2d[2 * (ntypes * typei + typej)];
- c12 = nbfp_climg2d[2 * (ntypes * typei + typej)+1];
-#else /* LJ_COMB */
-#ifdef LJ_COMB_GEOM
- c6 = ljcp_i.x * ljcp_j.x;
- c12 = ljcp_i.y * ljcp_j.y;
-#else
- /* LJ 2^(1/6)*sigma and 12*epsilon */
- sigma = ljcp_i.x + ljcp_j.x;
- epsilon = ljcp_i.y * ljcp_j.y;
-#if defined CALC_ENERGIES || defined LJ_FORCE_SWITCH || defined LJ_POT_SWITCH
- convert_sigma_epsilon_to_c6_c12(sigma, epsilon, &c6, &c12);
-#endif
-#endif /* LJ_COMB_GEOM */
-#endif /* LJ_COMB */
-
- // Ensure distance do not become so small that r^-12 overflows
- r2 = max(r2, NBNXN_MIN_RSQ);
-
- inv_r = rsqrt(r2);
- inv_r2 = inv_r * inv_r;
-#if !defined LJ_COMB_LB || defined CALC_ENERGIES
- inv_r6 = inv_r2 * inv_r2 * inv_r2;
-#if defined EXCLUSION_FORCES
- /* We could mask inv_r2, but with Ewald
- * masking both inv_r6 and F_invr is faster */
- inv_r6 *= int_bit;
-#endif /* EXCLUSION_FORCES */
-
- F_invr = inv_r6 * (c12 * inv_r6 - c6) * inv_r2;
-#if defined CALC_ENERGIES || defined LJ_POT_SWITCH
- E_lj_p = int_bit * (c12 * (inv_r6 * inv_r6 + nbparam->repulsion_shift.cpot)*ONE_TWELVETH_F -
- c6 * (inv_r6 + nbparam->dispersion_shift.cpot)*ONE_SIXTH_F);
-
-#endif
-#else /* ! LJ_COMB_LB || CALC_ENERGIES */
- float sig_r = sigma*inv_r;
- float sig_r2 = sig_r*sig_r;
- float sig_r6 = sig_r2*sig_r2*sig_r2;
-#if defined EXCLUSION_FORCES
- sig_r6 *= int_bit;
-#endif /* EXCLUSION_FORCES */
-
- F_invr = epsilon * sig_r6 * (sig_r6 - 1.0f) * inv_r2;
-#endif /* ! LJ_COMB_LB || CALC_ENERGIES */
-
-
-#ifdef LJ_FORCE_SWITCH
-#ifdef CALC_ENERGIES
- calculate_force_switch_F_E(nbparam, c6, c12, inv_r, r2, &F_invr, &E_lj_p);
-#else
- calculate_force_switch_F(nbparam, c6, c12, inv_r, r2, &F_invr);
-#endif /* CALC_ENERGIES */
-#endif /* LJ_FORCE_SWITCH */
-
-
-#ifdef LJ_EWALD
-#ifdef LJ_EWALD_COMB_GEOM
-#ifdef CALC_ENERGIES
- calculate_lj_ewald_comb_geom_F_E(nbfp_comb_climg2d, nbparam, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6, int_bit, &F_invr, &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);
-#endif /* CALC_ENERGIES */
-#elif defined LJ_EWALD_COMB_LB
- calculate_lj_ewald_comb_LB_F_E(nbfp_comb_climg2d, nbparam, typei, typej, r2, inv_r2, lje_coeff2, lje_coeff6_6,
-#ifdef CALC_ENERGIES
- int_bit, true, &F_invr, &E_lj_p
-#else
- 0, false, &F_invr, 0
-#endif /* CALC_ENERGIES */
- );
-#endif /* LJ_EWALD_COMB_GEOM */
-#endif /* LJ_EWALD */
-
-#ifdef LJ_POT_SWITCH
-#ifdef CALC_ENERGIES
- calculate_potential_switch_F_E(nbparam, inv_r, r2, &F_invr, &E_lj_p);
-#else
- calculate_potential_switch_F(nbparam, inv_r, r2, &F_invr, &E_lj_p);
-#endif /* CALC_ENERGIES */
-#endif /* LJ_POT_SWITCH */
-
-#ifdef VDW_CUTOFF_CHECK
- /* Separate VDW cut-off check to enable twin-range cut-offs
- * (rvdw < rcoulomb <= rlist)
- */
- vdw_in_range = (r2 < rvdw_sq) ? 1.0f : 0.0f;
- F_invr *= vdw_in_range;
-#ifdef CALC_ENERGIES
- E_lj_p *= vdw_in_range;
-#endif
-#endif /* VDW_CUTOFF_CHECK */
-
-#ifdef CALC_ENERGIES
- E_lj += E_lj_p;
-
-#endif
-
-
-#ifdef EL_CUTOFF
-#ifdef EXCLUSION_FORCES
- F_invr += qi * qj_f * int_bit * inv_r2 * inv_r;
-#else
- F_invr += qi * qj_f * inv_r2 * inv_r;
-#endif
-#endif
-#ifdef EL_RF
- F_invr += qi * qj_f * (int_bit*inv_r2 * inv_r - two_k_rf);
-#endif
-#if defined EL_EWALD_ANA
- F_invr += qi * qj_f * (int_bit*inv_r2*inv_r + pmecorrF(beta2*r2)*beta3);
-#elif defined EL_EWALD_TAB
- F_invr += qi * qj_f * (int_bit*inv_r2 -
- interpolate_coulomb_force_r(coulomb_tab_climg2d, r2 * inv_r, coulomb_tab_scale)
- ) * inv_r;
-#endif /* EL_EWALD_ANA/TAB */
-
-#ifdef CALC_ENERGIES
-#ifdef EL_CUTOFF
- E_el += qi * qj_f * (int_bit*inv_r - c_rf);
-#endif
-#ifdef EL_RF
- E_el += qi * qj_f * (int_bit*inv_r + 0.5f * two_k_rf * r2 - c_rf);
-#endif
-#ifdef EL_EWALD_ANY
- /* 1.0f - erff is faster than erfcf */
- E_el += qi * qj_f * (inv_r * (int_bit - erf(r2 * inv_r * beta)) - int_bit * ewald_shift);
-#endif /* EL_EWALD_ANY */
-#endif
- f_ij = rv * F_invr;
-
- /* accumulate j forces in registers */
- fcj_buf -= f_ij;
-
- /* accumulate i forces in registers */
- fci_buf[ci_offset] += f_ij;
- }
- }
-
- /* shift the mask bit by 1 */
- mask_ji += mask_ji;
- }
-
- /* reduce j forces */
-
- /* store j forces in shmem */
- f_buf[ tidx] = fcj_buf.x;
- f_buf[ FBUF_STRIDE + tidx] = fcj_buf.y;
- f_buf[2 * FBUF_STRIDE + tidx] = fcj_buf.z;
-
- reduce_force_j_generic(f_buf, f, tidxi, tidxj, aj);
- }
- }
-#ifdef PRUNE_NBL
- /* Update the imask with the new one which does not contain the
- out of range clusters anymore. */
-
- pl_cj4[j4].imei[widx].imask = imask;
-#endif
- }
- }
-
- /* skip central shifts when summing shift forces */
- if (nb_sci.shift == CENTRAL)
- {
- bCalcFshift = false;
- }
-
- fshift_buf = 0.0f;
-
- /* reduce i forces */
- for (ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
- {
- ai = (sci * NCL_PER_SUPERCL + ci_offset) * CL_SIZE + tidxi;
-
- f_buf[ tidx] = fci_buf[ci_offset].x;
- f_buf[ FBUF_STRIDE + tidx] = fci_buf[ci_offset].y;
- f_buf[2 * FBUF_STRIDE + tidx] = fci_buf[ci_offset].z;
- barrier(CLK_LOCAL_MEM_FENCE);
- reduce_force_i(f_buf, f,
- &fshift_buf, bCalcFshift,
- tidxi, tidxj, ai);
- barrier(CLK_LOCAL_MEM_FENCE);
- }
-
- /* add up local shift forces into global mem */
- if (bCalcFshift)
- {
- /* Only threads with tidxj < 3 will update fshift.
- The threads performing the update must be the same with the threads
- which stored the reduction result in reduce_force_i function
- */
- if (tidxj < 3)
- {
- atomicAdd_g_f(&(fshift[3 * nb_sci.shift + tidxj]), fshift_buf);
- }
- }
-
-#ifdef CALC_ENERGIES
- /* flush the energies to shmem and reduce them */
- f_buf[ tidx] = E_lj;
- f_buf[FBUF_STRIDE + tidx] = E_el;
- reduce_energy_pow2(f_buf + (tidx & WARP_SIZE), e_lj, e_el, tidx & ~WARP_SIZE);
-
-#endif
-}
-
-#undef EL_EWALD_ANY
-#undef EXCLUSION_FORCES
-#undef LJ_EWALD
-
-#undef LJ_COMB
-#undef USE_CJ_PREFETCH
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2018, 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.
* NOTE: No include fence as it is meant to be included multiple times.
*/
-#if defined(_WARPLESS_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nowarp.clh"
-#elif defined(_NVIDIA_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nvidia.clh"
-#elif defined(_AMD_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_amd.clh"
-#else
-#pragma error "Unknown kernel vendor spec"
-#endif
-
-
#include "nbnxn_ocl_kernel_utils.clh"
/* Analytical plain cut-off electrostatics kernels
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecCut_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecRF_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEw_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwTwinCut_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTab_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ */
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwinCut_VdwLJ ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w geometric combination rules */
#define LJ_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwin_VdwLJCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* cut-off + V shift LJ w LB combination rules */
#define LJ_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwin_VdwLJCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w geometric combination rules */
#define LJ_EWALD_COMB_GEOM
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwinCut_VdwLJEwCombGeom ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_GEOM
#undef NB_KERNEL_FUNC_NAME
/* LJ-Ewald w LB combination rules */
#define LJ_EWALD_COMB_LB
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwinCut_VdwLJEwCombLB ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_EWALD_COMB_LB
#undef NB_KERNEL_FUNC_NAME
/* F switch LJ */
#define LJ_FORCE_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwinCut_VdwLJFsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_FORCE_SWITCH
#undef NB_KERNEL_FUNC_NAME
/* V switch LJ */
#define LJ_POT_SWITCH
#define NB_KERNEL_FUNC_NAME(x, y) x ## _ElecEwQSTabTwinCut_VdwLJPsw ## y
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef LJ_POT_SWITCH
#undef NB_KERNEL_FUNC_NAME
#undef EL_EWALD_TAB
#undef VDW_CUTOFF_CHECK
-
-#undef CL_SOURCE_FILE
* NOTE: No include fence as it is meant to be included multiple times.
*/
-#if defined(_WARPLESS_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nowarp.clh"
-#elif defined(_NVIDIA_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nvidia.clh"
-#elif defined(_AMD_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_amd.clh"
-#else
-#pragma error "Unknown kernel vendor spec"
-#endif
-
-
#include "nbnxn_ocl_kernel_utils.clh"
#define NB_INDIRECT_1(x, eel, vdw, y) x ## eel ## vdw ## y
#define NB_INDIRECT_2(x, eel, vdw, y) NB_INDIRECT_1(x, eel, vdw, y)
#define NB_KERNEL_FUNC_NAME(x, y) NB_INDIRECT_2(x, EELNAME, VDWNAME, y)
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
-#undef CL_SOURCE_FILE
* NOTE: No include fence as it is meant to be included multiple times.
*/
-#if defined(_WARPLESS_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nowarp.clh"
-#elif defined(_NVIDIA_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_nvidia.clh"
-#elif defined(_AMD_SOURCE_)
-#define CL_SOURCE_FILE "nbnxn_ocl_kernel_amd.clh"
-#else
-#pragma error "Unknown kernel vendor spec"
-#endif
-
-
#include "nbnxn_ocl_kernel_utils.clh"
/* Define the single-cutoff version of the kernel */
#define NB_INDIRECT_2(x, eel, vdw, y) NB_INDIRECT_1(x, eel, vdw, y)
#define NB_KERNEL_FUNC_NAME(x, y) NB_INDIRECT_2(x, EELNAME, VDWNAME, y)
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
#define VDW_CUTOFF_CHECK
-#include CL_SOURCE_FILE
+#include "nbnxn_ocl_kernel.clh"
#undef NB_KERNEL_FUNC_NAME
#undef VDW_CUTOFF_CHECK
-
-#undef CL_SOURCE_FILE