Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
DDBalanceRegionHandler Class Reference

#include <gromacs/domdec/dlbtiming.h>

Description

Manager for starting and stopping the dynamic load balancing region.

Public Member Functions

 DDBalanceRegionHandler (const t_commrec *cr)
 Constructor, pass a pointer to t_commrec or nullptr when not using domain decomposition.
 
bool useBalancingRegion () const
 Returns whether were are actually using the balancing region.
 
void openBeforeForceComputationCpu (DdAllowBalanceRegionReopen allowReopen) const
 Open the load balance timing region on the CPU. More...
 
void openBeforeForceComputationGpu () const
 Open the load balance timing region for the CPU. More...
 
void reopenRegionCpu () const
 Re-open the, already opened, load balance timing region. More...
 
void closeAfterForceComputationCpu () const
 Close the load balance timing region on the CPU side.
 
void closeAfterForceComputationGpu (float waitCyclesGpuInCpuRegion, DdBalanceRegionWaitedForGpu waitedForGpu) const
 Close the load balance timing region on the GPU side. More...
 

Member Function Documentation

void DDBalanceRegionHandler::closeAfterForceComputationGpu ( float  waitCyclesGpuInCpuRegion,
DdBalanceRegionWaitedForGpu  waitedForGpu 
) const
inline

Close the load balance timing region on the GPU side.

This should be called after the CPU receives the last (local) results from the GPU. The wait time for these results is estimated, depending on the waitedForGpu parameter. If called on an already closed region, this call does nothing.

Parameters
[in]waitCyclesGpuInCpuRegionThe time we waited for the GPU earlier, overlapping completely with the open CPU region
[in]waitedForGpuTells if we waited for the GPU to finish now
void DDBalanceRegionHandler::openBeforeForceComputationCpu ( DdAllowBalanceRegionReopen  allowReopen) const
inline

Open the load balance timing region on the CPU.

Opens the balancing region for timing how much time it takes to perform the (balancable part of) the MD step. This should be called right after the last communication during the previous step to maximize the region. In practice this means right after the force communication finished or just before neighbor search at search steps. It is assumed that computation done in the region either scales along with the domain size or takes constant time.

Parameters
[in]allowReopenAllows calling with a potentially already opened region
void DDBalanceRegionHandler::openBeforeForceComputationGpu ( ) const
inline

Open the load balance timing region for the CPU.

This can only be called within a region that is open on the CPU side.

void DDBalanceRegionHandler::reopenRegionCpu ( ) const
inline

Re-open the, already opened, load balance timing region.

This function should be called after every MPI communication that occurs in the main MD loop. Note that the current setup assumes that all MPI communication acts like a global barrier. But if some ranks don't participate in communication or if some ranks communicate faster with neighbors than others, the obtained timings might not accurately reflect the computation time.


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