Gromacs
2025-dev-20241003-bd59e46
|
#include <gromacs/mdlib/gpuforcereduction.h>
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) |
gmx::GpuForceReduction::GpuForceReduction | ( | const DeviceContext & | deviceContext, |
const DeviceStream & | deviceStream, | ||
gmx_wallcycle * | wcycle | ||
) |
Creates GPU force reduction object.
[in] | deviceContext | GPU device context |
[in] | deviceStream | Stream to use for reduction |
[in] | wcycle | Wall-clock cycle counter |
void gmx::GpuForceReduction::addDependency | ( | GpuEventSynchronizer * | dependency | ) |
Add a dependency for this force reduction.
[in] | dependency | Dependency for this reduction |
void gmx::GpuForceReduction::registerNbnxmForce | ( | DeviceBuffer< RVec > | forcePtr | ) |
Register a nbnxm-format force to be reduced.
[in] | forcePtr | Pointer to force to be reduced |
void gmx::GpuForceReduction::registerRvecForce | ( | DeviceBuffer< RVec > | forcePtr | ) |
Register a rvec-format force to be reduced.
[in] | forcePtr | Pointer 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.
[in] | baseForcePtr | Pointer to force to be used as a base |
[in] | numAtoms | The number of atoms |
[in] | cell | Pointer to the cell array |
[in] | atomStart | The start atom for the reduction |
[in] | accumulate | Whether reduction should be accumulated |
[in] | completionMarker | Event to be marked when launch of reduction is complete |