Gromacs  2025-dev-20240710-afbd73d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
threaded_force_buffer.h File Reference
#include <memory>
#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/bitmask.h"
#include "gromacs/utility/classhelpers.h"
+ Include dependency graph for threaded_force_buffer.h:
+ This graph shows which files directly or indirectly include this file:


This file contains the declaration of ThreadForceBuffer and ThreadedForceBuffer.

These classes provides thread-local force, shift force and energy buffers for kernels. These kernels can then run completely independently on multiple threads. Their output can be reduced thread-parallel afterwards.


At domain decomposition time: Each thread calls: ThreadForceBuffer.resizeBufferAndClearMask() Each thread calls: ThreadForceBuffer.addAtomToMask() for all atoms used in the buffer Each thread calls: ThreadForceBuffer.processMask() After that ThreadedForceBuffer.setupReduction() is called

At force computation time: Each thread calls: ThreadForceBuffer.clearForcesAndEnergies(). Each thread can then accumulate forces and energies into the buffers in ThreadForceBuffer. After that ThreadedForceBuffer.reduce() is called for thread-parallel reduction.

Berk Hess


class  gmx::ThreadForceBuffer< ForceBufferElementType >
 Object that holds force and energies buffers plus a mask for a thread. More...
class  gmx::ThreadedForceBuffer< ForceBufferElementType >
 Class for accumulating and reducing forces and energies on threads in parallel. More...