Gromacs  2026.0-dev-20251119-5f0a571d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
gmx::FusedGpuHaloExchange Class Reference

#include <gromacs/domdec/fused_gpuhaloexchange.h>

Description

NVSHMEM-based fused GPU halo exchange.

Aggregates all pulses into a single structure for a fused GPU-initiated exchange path using NVSHMEM. Combining coordinate (X) and force (F) metadata is a by-product of this aggregation. The class:

Public Member Functions

 FusedGpuHaloExchange (const DeviceContext &deviceContext, gmx_wallcycle *wcycle, MPI_Comm mpi_comm_mysim, MPI_Comm mpi_comm_mysim_world)
 Creates NVSHMEM-based fused GPU halo exchange object. More...
 
 ~FusedGpuHaloExchange ()
 Destructor.
 
GpuEventSynchronizer * launchAllCoordinateExchanges (const matrix box, GpuEventSynchronizer *dependencyEvent)
 Launch fused coordinate (X) exchanges across all pulses. More...
 
GpuEventSynchronizer * launchAllForceExchanges (bool accumulateForces, FixedCapacityVector< GpuEventSynchronizer *, 2 > *dependencyEvents)
 Launch fused force (F) exchanges across all pulses. More...
 
void reinitAllHaloExchanges (const t_commrec &cr, DeviceBuffer< RVec > d_coordinatesBuffer, DeviceBuffer< RVec > d_forcesBuffer, DeviceBuffer< uint64_t > d_syncBase, int totalNumPulses)
 (Re-)initialize fused halo exchanges for all dimensions and pulses. Builds per-pulse entries, sets shared buffers, NVSHMEM signals, and prepares metadata. More...
 
void destroyAllHaloExchangeBuffers ()
 Destroy unified/symmetric buffers used by fused halo exchange (if any).
 
void allocateAndCopyHaloExchangeData ()
 Copy per-pulse metadata to device.
 
GpuEventSynchronizer * getForcesReadyOnDeviceEvent ()
 Get the event synchronizer for the fused forces ready on device. More...
 
void allocateUnifiedHaloBuffers ()
 Allocate unified send/recv buffers and point entries into them. Uses max-reduced per-pulse extents to size symmetric buffers and assigns aligned per-entry pointers into those buffers. More...
 

Public Attributes

SharedBuffers sharedBuffers_
 
DeviceBuffer< uint64_t > d_ppHaloExSyncBase_ = nullptr
 
int ppHaloExPerSyncBufSize_ = 0
 

Constructor & Destructor Documentation

gmx::FusedGpuHaloExchange::FusedGpuHaloExchange ( const DeviceContext &  deviceContext,
gmx_wallcycle *  wcycle,
MPI_Comm  mpi_comm_mysim,
MPI_Comm  mpi_comm_mysim_world 
)

Creates NVSHMEM-based fused GPU halo exchange object.

Parameters
[in]deviceContextGPU device context
[in]wcycleWallclock cycle accounting
[in]mpi_comm_mysimMPI communicator used for simulation
[in]mpi_comm_mysim_worldMPI communicator involving PP + PME

Member Function Documentation

void gmx::FusedGpuHaloExchange::allocateUnifiedHaloBuffers ( )

Allocate unified send/recv buffers and point entries into them. Uses max-reduced per-pulse extents to size symmetric buffers and assigns aligned per-entry pointers into those buffers.

max-reduced per-pulse extent across ranks (elements), unified for send/recv

GpuEventSynchronizer * gmx::FusedGpuHaloExchange::getForcesReadyOnDeviceEvent ( )

Get the event synchronizer for the fused forces ready on device.

Returns
The event to synchronize the stream that consumes forces on device.
GpuEventSynchronizer * gmx::FusedGpuHaloExchange::launchAllCoordinateExchanges ( const matrix  box,
GpuEventSynchronizer *  dependencyEvent 
)

Launch fused coordinate (X) exchanges across all pulses.

Parameters
[in]boxCoordinate box (for shifts)
[in]dependencyEventDependency event for this operation
Returns
Event recorded when this operation has been launched
GpuEventSynchronizer * gmx::FusedGpuHaloExchange::launchAllForceExchanges ( bool  accumulateForces,
FixedCapacityVector< GpuEventSynchronizer *, 2 > *  dependencyEvents 
)

Launch fused force (F) exchanges across all pulses.

Parameters
[in]accumulateForcesTrue if forces should accumulate, otherwise they are set
[in]dependencyEventsDependency events for this operation
Returns
Event recorded when this operation has been launched
void gmx::FusedGpuHaloExchange::reinitAllHaloExchanges ( const t_commrec &  cr,
DeviceBuffer< RVec d_coordinatesBuffer,
DeviceBuffer< RVec d_forcesBuffer,
DeviceBuffer< uint64_t >  d_syncBase,
int  totalNumPulses 
)

(Re-)initialize fused halo exchanges for all dimensions and pulses. Builds per-pulse entries, sets shared buffers, NVSHMEM signals, and prepares metadata.

Parameters
[in]crCommunication record
[in]d_coordinatesBufferPointer to coordinates buffer in GPU memory
[in]d_forcesBufferPointer to forces buffer in GPU memory
[in]d_syncBaseBase device pointer for NVSHMEM signal buffer
[in]totalNumPulsesTotal number of pulses across all dimensions

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