Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::GpuHaloExchange Class Reference

#include <gromacs/domdec/gpuhaloexchange.h>

Description

Manages GPU Halo Exchange object.

Public Member Functions

 GpuHaloExchange (gmx_domdec_t *dd, int dimIndex, MPI_Comm mpi_comm_mysim, const DeviceContext &deviceContext, int pulse, gmx_wallcycle *wcycle)
 Creates GPU Halo Exchange object. More...
 
 GpuHaloExchange (GpuHaloExchange &&source) noexcept
 
GpuHaloExchangeoperator= (GpuHaloExchange &&source) noexcept
 
void reinitHalo (DeviceBuffer< RVec > d_coordinateBuffer, DeviceBuffer< RVec > d_forcesBuffer)
 Initialization for GPU halo exchange of coordinates buffer. More...
 
GpuEventSynchronizer * communicateHaloCoordinates (const matrix box, GpuEventSynchronizer *dependencyEvent)
 GPU halo exchange of coordinates buffer. More...
 
void communicateHaloForces (bool accumulateForces, FixedCapacityVector< GpuEventSynchronizer *, 2 > *dependencyEvents)
 GPU halo exchange of force buffer. More...
 
GpuEventSynchronizer * getForcesReadyOnDeviceEvent ()
 Get the event synchronizer for the forces ready on device. More...
 

Constructor & Destructor Documentation

gmx::GpuHaloExchange::GpuHaloExchange ( gmx_domdec_t *  dd,
int  dimIndex,
MPI_Comm  mpi_comm_mysim,
const DeviceContext &  deviceContext,
int  pulse,
gmx_wallcycle *  wcycle 
)

Creates GPU Halo Exchange object.

Constructor stub.

Coordinate Halo exchange will be performed in its own stream with appropriate event-based synchronization, and the communicateHaloCoordinates method must be called before any subsequent operations that access non-local parts of the coordinate buffer (such as the non-local non-bonded kernels). It also must be called after the local coordinates buffer operations (where the coordinates are copied to the device and hence the coordinatesReadyOnDeviceEvent is recorded). Force Halo exchange will also be performed in its own stream with appropriate event-based synchronization, and the communicateHaloForces method must be called after the non-local buffer operations, after the local force buffer has been copied to the GPU (if CPU forces are present), and before the local buffer operations. The force halo exchange does not yet support virial steps.

Parameters
[in,out]dddomdec structure
[in]dimIndexthe dimension index for this instance
[in]mpi_comm_mysimcommunicator used for simulation
[in]deviceContextGPU device context
[in]pulsethe communication pulse for this instance
[in]wcycleThe wallclock counter

Member Function Documentation

GpuEventSynchronizer * gmx::GpuHaloExchange::communicateHaloCoordinates ( const matrix  box,
GpuEventSynchronizer *  dependencyEvent 
)

GPU halo exchange of coordinates buffer.

apply X halo exchange stub.

Must be called after local setCoordinates (which records an event when the coordinate data has been copied to the device).

Parameters
[in]boxCoordinate box (from which shifts will be constructed)
[in]dependencyEventDependency event for this operation
Returns
Event recorded when this operation has been launched
void gmx::GpuHaloExchange::communicateHaloForces ( bool  accumulateForces,
FixedCapacityVector< GpuEventSynchronizer *, 2 > *  dependencyEvents 
)

GPU halo exchange of force buffer.

apply F halo exchange stub.

Parameters
[in]accumulateForcesTrue if forces should accumulate, otherwise they are set
[in]dependencyEventsDependency events for this operation
GpuEventSynchronizer * gmx::GpuHaloExchange::getForcesReadyOnDeviceEvent ( )

Get the event synchronizer for the forces ready on device.

get forces ready on device event stub.

Returns
The event to synchronize the stream that consumes forces on device.
void gmx::GpuHaloExchange::reinitHalo ( DeviceBuffer< RVec d_coordinateBuffer,
DeviceBuffer< RVec d_forcesBuffer 
)

Initialization for GPU halo exchange of coordinates buffer.

init halo exhange stub.

Parameters
[in]d_coordinateBufferpointer to coordinates buffer in GPU memory
[in]d_forcesBufferpointer to coordinates buffer in GPU memory

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