Gromacs  2025-dev-20241003-bd59e46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::GpuForceReduction Class Reference

#include <gromacs/mdlib/gpuforcereduction.h>

Description

Manages the force reduction directly in GPU memory.

Manages the reduction of multiple GPU force buffers into a single GPU force buffer. The reduction involves at least one (input/output) Rvec-format buffer and one (input) Nbat-format buffer, where the Nbat->Rvec conversion is handled internally. One additional (input) Rvec-format buffer is supported as optional.

Public Member Functions

 GpuForceReduction (const DeviceContext &deviceContext, const DeviceStream &deviceStream, gmx_wallcycle *wcycle)
 Creates GPU force reduction object. More...
 
void registerNbnxmForce (DeviceBuffer< RVec > forcePtr)
 Register a nbnxm-format force to be reduced. More...
 
void registerRvecForce (DeviceBuffer< RVec > forcePtr)
 Register a rvec-format force to be reduced. More...
 
void addDependency (GpuEventSynchronizer *dependency)
 Add a dependency for this force reduction. More...
 
void reinit (DeviceBuffer< RVec > baseForcePtr, int numAtoms, ArrayRef< const int > cell, int atomStart, bool accumulate, GpuEventSynchronizer *completionMarker=nullptr)
 Reinitialize the GPU force reduction. More...
 
void execute ()
 Execute the force reduction.
 
void registerForcesReadyNvshmemFlags (DeviceBuffer< uint64_t > syncObj)
 

Constructor & Destructor Documentation

gmx::GpuForceReduction::GpuForceReduction ( const DeviceContext &  deviceContext,
const DeviceStream deviceStream,
gmx_wallcycle *  wcycle 
)

Creates GPU force reduction object.

Parameters
[in]deviceContextGPU device context
[in]deviceStreamStream to use for reduction
[in]wcycleWall-clock cycle counter

Member Function Documentation

void gmx::GpuForceReduction::addDependency ( GpuEventSynchronizer *  dependency)

Add a dependency for this force reduction.

Parameters
[in]dependencyDependency for this reduction
void gmx::GpuForceReduction::registerNbnxmForce ( DeviceBuffer< RVec forcePtr)

Register a nbnxm-format force to be reduced.

Parameters
[in]forcePtrPointer to force to be reduced
void gmx::GpuForceReduction::registerRvecForce ( DeviceBuffer< RVec forcePtr)

Register a rvec-format force to be reduced.

Parameters
[in]forcePtrPointer to force to be reduced
void gmx::GpuForceReduction::reinit ( DeviceBuffer< RVec baseForcePtr,
int  numAtoms,
ArrayRef< const int >  cell,
int  atomStart,
bool  accumulate,
GpuEventSynchronizer *  completionMarker = nullptr 
)

Reinitialize the GPU force reduction.

Parameters
[in]baseForcePtrPointer to force to be used as a base
[in]numAtomsThe number of atoms
[in]cellPointer to the cell array
[in]atomStartThe start atom for the reduction
[in]accumulateWhether reduction should be accumulated
[in]completionMarkerEvent to be marked when launch of reduction is complete

The documentation for this class was generated from the following files: