#include <stdio.h>
#include <stdlib.h>
-// TODO We would like to move this down, but the way gmx_nbnxm_gpu_t
+// TODO We would like to move this down, but the way NbnxmGpu
// is currently declared means this has to be before gpu_types.h
#include "nbnxm_cuda_types.h"
static unsigned int gpu_min_ci_balanced_factor = 44;
/* Fw. decl. */
-static void nbnxn_cuda_clear_e_fshift(gmx_nbnxm_gpu_t* nb);
+static void nbnxn_cuda_clear_e_fshift(NbnxmGpu* nb);
/* Fw. decl, */
static void nbnxn_cuda_free_nbparam_table(cu_nbparam_t* nbparam);
}
/*! Initializes simulation constant data. */
-static void cuda_init_const(gmx_nbnxm_gpu_t* nb,
+static void cuda_init_const(NbnxmGpu* nb,
const interaction_const_t* ic,
const PairlistParams& listParams,
const nbnxn_atomdata_t::Params& nbatParams)
nbnxn_cuda_clear_e_fshift(nb);
}
-gmx_nbnxm_gpu_t* gpu_init(const gmx_device_info_t* deviceInfo,
- const interaction_const_t* ic,
- const PairlistParams& listParams,
- const nbnxn_atomdata_t* nbat,
- int /*rank*/,
- gmx_bool bLocalAndNonlocal)
+NbnxmGpu* gpu_init(const gmx_device_info_t* deviceInfo,
+ const interaction_const_t* ic,
+ const PairlistParams& listParams,
+ const nbnxn_atomdata_t* nbat,
+ int /*rank*/,
+ gmx_bool bLocalAndNonlocal)
{
cudaError_t stat;
- gmx_nbnxm_gpu_t* nb;
- snew(nb, 1);
+ auto nb = new NbnxmGpu;
snew(nb->atdat, 1);
snew(nb->nbparam, 1);
snew(nb->plist[InteractionLocality::Local], 1);
return nb;
}
-void gpu_init_pairlist(gmx_nbnxm_gpu_t* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
+void gpu_init_pairlist(NbnxmGpu* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
{
char sbuf[STRLEN];
bool bDoTime = (nb->bDoTime && !h_plist->sci.empty());
d_plist->haveFreshList = true;
}
-void gpu_upload_shiftvec(gmx_nbnxm_gpu_t* nb, const nbnxn_atomdata_t* nbatom)
+void gpu_upload_shiftvec(NbnxmGpu* nb, const nbnxn_atomdata_t* nbatom)
{
cu_atomdata_t* adat = nb->atdat;
cudaStream_t ls = nb->stream[InteractionLocality::Local];
}
/*! Clears the first natoms_clear elements of the GPU nonbonded force output array. */
-static void nbnxn_cuda_clear_f(gmx_nbnxm_gpu_t* nb, int natoms_clear)
+static void nbnxn_cuda_clear_f(NbnxmGpu* nb, int natoms_clear)
{
cudaError_t stat;
cu_atomdata_t* adat = nb->atdat;
}
/*! Clears nonbonded shift force output array and energy outputs on the GPU. */
-static void nbnxn_cuda_clear_e_fshift(gmx_nbnxm_gpu_t* nb)
+static void nbnxn_cuda_clear_e_fshift(NbnxmGpu* nb)
{
cudaError_t stat;
cu_atomdata_t* adat = nb->atdat;
CU_RET_ERR(stat, "cudaMemsetAsync on e_el falied");
}
-void gpu_clear_outputs(gmx_nbnxm_gpu_t* nb, bool computeVirial)
+void gpu_clear_outputs(NbnxmGpu* nb, bool computeVirial)
{
nbnxn_cuda_clear_f(nb, nb->atdat->natoms);
/* clear shift force array and energies if the outputs were
}
}
-void gpu_init_atomdata(gmx_nbnxm_gpu_t* nb, const nbnxn_atomdata_t* nbat)
+void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
{
cudaError_t stat;
int nalloc, natoms;
}
}
-void gpu_free(gmx_nbnxm_gpu_t* nb)
+void gpu_free(NbnxmGpu* nb)
{
cudaError_t stat;
cu_atomdata_t* atdat;
sfree(atdat);
sfree(nbparam);
sfree(nb->timings);
- sfree(nb);
+ delete nb;
if (debug)
{
}
//! This function is documented in the header file
-gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(gmx_nbnxm_gpu_t* nb)
+gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(NbnxmGpu* nb)
{
return (nb != nullptr && nb->bDoTime) ? nb->timings : nullptr;
}
}
}
-int gpu_min_ci_balanced(gmx_nbnxm_gpu_t* nb)
+int gpu_min_ci_balanced(NbnxmGpu* nb)
{
return nb != nullptr ? gpu_min_ci_balanced_factor * nb->dev_info->prop.multiProcessorCount : 0;
}
-gmx_bool gpu_is_kernel_ewald_analytical(const gmx_nbnxm_gpu_t* nb)
+gmx_bool gpu_is_kernel_ewald_analytical(const NbnxmGpu* nb)
{
return ((nb->nbparam->eeltype == eelCuEWALD_ANA) || (nb->nbparam->eeltype == eelCuEWALD_ANA_TWIN));
}
-void* gpu_get_command_stream(gmx_nbnxm_gpu_t* nb, const InteractionLocality iloc)
+void* gpu_get_command_stream(NbnxmGpu* nb, const InteractionLocality iloc)
{
assert(nb);
return static_cast<void*>(&nb->stream[iloc]);
}
-void* gpu_get_xq(gmx_nbnxm_gpu_t* nb)
+void* gpu_get_xq(NbnxmGpu* nb)
{
assert(nb);
return static_cast<void*>(nb->atdat->xq);
}
-void* gpu_get_f(gmx_nbnxm_gpu_t* nb)
+void* gpu_get_f(NbnxmGpu* nb)
{
assert(nb);
return static_cast<void*>(nb->atdat->f);
}
-rvec* gpu_get_fshift(gmx_nbnxm_gpu_t* nb)
+rvec* gpu_get_fshift(NbnxmGpu* nb)
{
assert(nb);
/* Initialization for X buffer operations on GPU. */
/* TODO Remove explicit pinning from host arrays from here and manage in a more natural way*/
-void nbnxn_gpu_init_x_to_nbat_x(const Nbnxm::GridSet& gridSet, gmx_nbnxm_gpu_t* gpu_nbv)
+void nbnxn_gpu_init_x_to_nbat_x(const Nbnxm::GridSet& gridSet, NbnxmGpu* gpu_nbv)
{
cudaStream_t stream = gpu_nbv->stream[InteractionLocality::Local];
bool bDoTime = gpu_nbv->bDoTime;
/* Initialization for F buffer operations on GPU. */
void nbnxn_gpu_init_add_nbat_f_to_f(const int* cell,
- gmx_nbnxm_gpu_t* gpu_nbv,
+ NbnxmGpu* gpu_nbv,
int natoms_total,
GpuEventSynchronizer* const localReductionDone)
{