Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
pme_gpu_calculate_splines.h File Reference
#include <cassert>
#include "gromacs/math/vectypes.h"
+ Include dependency graph for pme_gpu_calculate_splines.h:
+ This graph shows which files directly or indirectly include this file:

Description

This file defines small PME GPU inline host/device functions. Note that OpenCL device-side functions can't use C++ features, so they are located in a similar file pme_gpu_utils.clh. Be sure to keep the logic in sync in both files when changing it!

Author
Aleksei Iupinov a.yup.nosp@m.inov.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Functions

template<int order, int atomsPerWarp>
int getSplineParamIndexBase (int warpIndex, int atomWarpIndex)
 Gets a base of the unique index to an element in a spline parameter buffer (theta/dtheta), which is laid out for GPU spread/gather kernels. The base only corresponds to the atom index within the execution block. Feed the result into getSplineParamIndex() to get a full index. TODO: it's likely that both parameters can be just replaced with a single atom index, as they are derived from it. Do that, verifying that the generated code is not bloated, and/or revise the spline indexing scheme. Removing warp dependency would also be nice (and would probably coincide with removing c_pmeSpreadGatherAtomsPerWarp). More...
 
template<int order, int atomsPerWarp>
int getSplineParamIndex (int paramIndexBase, int dimIndex, int splineIndex)
 Gets a unique index to an element in a spline parameter buffer (theta/dtheta), which is laid out for GPU spread/gather kernels. The index is wrt to the execution block, in range(0, atomsPerBlock * order * DIM). This function consumes result of getSplineParamIndexBase() and adjusts it for dimIndex and splineIndex. More...
 

Function Documentation

template<int order, int atomsPerWarp>
int getSplineParamIndex ( int  paramIndexBase,
int  dimIndex,
int  splineIndex 
)
inline

Gets a unique index to an element in a spline parameter buffer (theta/dtheta), which is laid out for GPU spread/gather kernels. The index is wrt to the execution block, in range(0, atomsPerBlock * order * DIM). This function consumes result of getSplineParamIndexBase() and adjusts it for dimIndex and splineIndex.

Template Parameters
orderPME order
atomsPerWarpNumber of atoms processed by a warp
Parameters
[in]paramIndexBaseMust be result of getSplineParamIndexBase().
[in]dimIndexDimension index (from 0 to 2)
[in]splineIndexSpline contribution index (from 0 to order - 1)
Returns
Index into theta or dtheta array using GPU layout.
template<int order, int atomsPerWarp>
int getSplineParamIndexBase ( int  warpIndex,
int  atomWarpIndex 
)
inline

Gets a base of the unique index to an element in a spline parameter buffer (theta/dtheta), which is laid out for GPU spread/gather kernels. The base only corresponds to the atom index within the execution block. Feed the result into getSplineParamIndex() to get a full index. TODO: it's likely that both parameters can be just replaced with a single atom index, as they are derived from it. Do that, verifying that the generated code is not bloated, and/or revise the spline indexing scheme. Removing warp dependency would also be nice (and would probably coincide with removing c_pmeSpreadGatherAtomsPerWarp).

Template Parameters
orderPME order
atomsPerWarpNumber of atoms processed by a warp
Parameters
[in]warpIndexWarp index wrt the block.
[in]atomWarpIndexAtom index wrt the warp (from 0 to atomsPerWarp - 1).
Returns
Index into theta or dtheta array using GPU layout.