Gromacs
2024.3
|
#include <gromacs/mdtypes/threaded_force_buffer.h>
Class for accumulating and reducing forces and energies on threads in parallel.
ForceBufferElementType | The type for components of the normal force buffer: rvec or rvec4 |
Public Member Functions | |
ThreadedForceBuffer (int numThreads, bool useEnergyTerms, int numEnergyGroups) | |
Constructor. More... | |
int | numThreadBuffers () const |
Returns the number of thread buffers. | |
ThreadForceBuffer < ForceBufferElementType > & | threadForceBuffer (int bufferIndex) |
Returns a reference to the buffer object for the thread with index bufferIndex . | |
void | setupReduction () |
Sets up the reduction, should be called after generating the masks on each thread. | |
void | reduce (gmx::ForceWithShiftForces *forceWithShiftForces, real *ener, gmx_grppairener_t *grpp, gmx::ArrayRef< real > dvdl, const gmx::StepWorkload &stepWork, int reductionBeginIndex) |
Reduces forces and energies, as requested by stepWork . More... | |
gmx::ThreadedForceBuffer< ForceBufferElementType >::ThreadedForceBuffer | ( | int | numThreads, |
bool | useEnergyTerms, | ||
int | numEnergyGroups | ||
) |
Constructor.
[in] | numThreads | The number of threads that will use the buffers and reduce |
[in] | useEnergyTerms | Whether the list of energy terms will be used |
[in] | numEnergyGroups | The number of non-bonded energy groups |
void gmx::ThreadedForceBuffer< ForceBufferElementType >::reduce | ( | gmx::ForceWithShiftForces * | forceWithShiftForces, |
real * | ener, | ||
gmx_grppairener_t * | grpp, | ||
gmx::ArrayRef< real > | dvdl, | ||
const gmx::StepWorkload & | stepWork, | ||
int | reductionBeginIndex | ||
) |
Reduces forces and energies, as requested by stepWork
.
The reduction of all output starts at the output from thread reductionBeginIndex
, except for the normal force buffer, which always starts at 0.
Buffers that will not be used as indicated by the flags in stepWork
are allowed to be nullptr or empty.