#include "gromacs/nbnxm/gpu_jit_support.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/nbnxm/nbnxm_gpu.h"
+#include "gromacs/nbnxm/nbnxm_gpu_data_mgmt.h"
#include "gromacs/nbnxm/pairlistsets.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/timing/gpu_timing.h"
*/
static unsigned int gpu_min_ci_balanced_factor = 50;
-/*! \brief Tabulates the Ewald Coulomb force and initializes the size/scale
- * and the table GPU array.
- *
- * If called with an already allocated table, it just re-uploads the
- * table.
- */
-static void init_ewald_coulomb_force_table(const EwaldCorrectionTables& tables,
- NBParamGpu* nbp,
- const DeviceContext& deviceContext)
-{
- if (nbp->coulomb_tab != nullptr)
- {
- freeDeviceBuffer(&(nbp->coulomb_tab));
- }
-
- DeviceBuffer<real> coulomb_tab;
-
- initParamLookupTable(&coulomb_tab, nullptr, tables.tableF.data(), tables.tableF.size(), deviceContext);
-
- nbp->coulomb_tab = coulomb_tab;
- nbp->coulomb_tab_scale = tables.scale;
-}
-
/*! \brief Initializes the atomdata structure first time, it only gets filled at
pair-search.
ad->nalloc = -1;
}
-/*! \brief Copies all parameters related to the cut-off from ic to nbp
- */
-static void set_cutoff_parameters(NBParamGpu* nbp, const interaction_const_t* ic, const PairlistParams& listParams)
-{
- nbp->ewald_beta = ic->ewaldcoeff_q;
- nbp->sh_ewald = ic->sh_ewald;
- nbp->epsfac = ic->epsfac;
- nbp->two_k_rf = 2.0 * ic->k_rf;
- nbp->c_rf = ic->c_rf;
- nbp->rvdw_sq = ic->rvdw * ic->rvdw;
- nbp->rcoulomb_sq = ic->rcoulomb * ic->rcoulomb;
- nbp->rlistOuter_sq = listParams.rlistOuter * listParams.rlistOuter;
- nbp->rlistInner_sq = listParams.rlistInner * listParams.rlistInner;
- nbp->useDynamicPruning = listParams.useDynamicPruning;
-
- nbp->sh_lj_ewald = ic->sh_lj_ewald;
- nbp->ewaldcoeff_lj = ic->ewaldcoeff_lj;
-
- nbp->rvdw_switch = ic->rvdw_switch;
- nbp->dispersion_shift = ic->dispersion_shift;
- nbp->repulsion_shift = ic->repulsion_shift;
- nbp->vdw_switch = ic->vdw_switch;
-}
-
/*! \brief Returns the kinds of electrostatics and Vdw OpenCL
* kernels that will be used.
*
init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, *nb->deviceContext_);
}
-/*! \brief Initializes the pair list data structure.
- */
-static void init_plist(cl_plist_t* pl)
-{
- /* initialize to nullptr pointers to data that is not allocated here and will
- need reallocation in nbnxn_gpu_init_pairlist */
- pl->sci = nullptr;
- pl->cj4 = nullptr;
- pl->imask = nullptr;
- pl->excl = nullptr;
-
- /* size -1 indicates that the respective array hasn't been initialized yet */
- pl->na_c = -1;
- pl->nsci = -1;
- pl->sci_nalloc = -1;
- pl->ncj4 = -1;
- pl->cj4_nalloc = -1;
- pl->nimask = -1;
- pl->imask_nalloc = -1;
- pl->nexcl = -1;
- pl->excl_nalloc = -1;
- pl->haveFreshList = false;
-}
-
-/*! \brief Initializes the timings data structure.
- */
-static void init_timings(gmx_wallclock_gpu_nbnxn_t* t)
-{
- int i, j;
-
- t->nb_h2d_t = 0.0;
- t->nb_d2h_t = 0.0;
- t->nb_c = 0;
- t->pl_h2d_t = 0.0;
- t->pl_h2d_c = 0;
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- t->ktime[i][j].t = 0.0;
- t->ktime[i][j].c = 0;
- }
- }
-
- t->pruneTime.c = 0;
- t->pruneTime.t = 0.0;
- t->dynamicPruneTime.c = 0;
- t->dynamicPruneTime.t = 0.0;
-}
-
/*! \brief Initializes the OpenCL kernel pointers of the nbnxn_ocl_ptr_t input data structure. */
static cl_kernel nbnxn_gpu_create_kernel(NbnxmGpu* nb, const char* kernel_name)
{
// which leads to the counter not being reset.
bool bDoTime = (nb->bDoTime && !h_plist->sci.empty());
const DeviceStream& deviceStream = *nb->deviceStreams[iloc];
- cl_plist_t* d_plist = nb->plist[iloc];
+ gpu_plist* d_plist = nb->plist[iloc];
if (d_plist->na_c < 0)
{
{
if (d_plist->na_c != h_plist->na_ci)
{
- sprintf(sbuf, "In cu_init_plist: the #atoms per cell has changed (from %d to %d)",
+ sprintf(sbuf, "In init_plist: the #atoms per cell has changed (from %d to %d)",
d_plist->na_c, h_plist->na_ci);
gmx_incons(sbuf);
}