waLBerla 7.3
Loading...
Searching...
No Matches
walberla::gpu::communication::UniformGPUScheme< Stencil > Class Template Reference

Detailed Description

template<typename Stencil>
class walberla::gpu::communication::UniformGPUScheme< Stencil >

Communication scheme for buffered communication in uniform block grids.

Synchronize a set of GPUField between GPU devices. Communication between fields on the same process: use direct copy via GeneratedGPUPackInfo::communicateLocal. Communication between different processes: use a buffered communication scheme; when multiple fields have been changed they can be synchronized at once, using one MPI message per communication partner.

UniformGPUScheme<stencil::D3Q19> scheme; // the stencil defines the communication neighbors
scheme.addPackInfo( make_shared<gpu::communication::MemcpyPackInfo<FieldType> >( idOfFirstField ) );
scheme.addPackInfo( make_shared<gpu::communication::MemcpyPackInfo<FieldType> >( idOfSecondField ) );
// either synchronous communication...
scheme();
// .. or asynchronous:
functionWhichDoesNotNeedCommunicatedValues();
scheme.wait();
Data packing/unpacking for ghost layer based communication of a GPUField.
Definition MemcpyPackInfo.h:40
void addPackInfo(const shared_ptr< GeneratedGPUPackInfo > &pi)
Definition UniformGPUScheme.impl.h:297
void wait()
Definition UniformGPUScheme.impl.h:164
void startCommunication()
Definition UniformGPUScheme.impl.h:75
UniformGPUScheme(const weak_ptr< StructuredBlockForest > &bf, const bool sendDirectlyFromGPU=false, const bool useLocalCommunication=true, std::optional< int > tag=std::nullopt)
Definition UniformGPUScheme.impl.h:29

This scheme sends one message per communication step and neighbor device. Therefore all contents that have to be sent are packed into a single buffer. Multiple GeneratedGPUPackInfo can be registered to send their contents in a single step.

When running multiple UniformGPUScheme concurrently, different MPI tags have to be used for the schemes: the tag can be passed in the constructor. Default MPI tag = 5432

#include <UniformGPUScheme.h>

Classes

struct  Header

Public Member Functions

 UniformGPUScheme (const weak_ptr< StructuredBlockForest > &bf, const bool sendDirectlyFromGPU=false, const bool useLocalCommunication=true, std::optional< int > tag=std::nullopt)
 UniformGPUScheme (const weak_ptr< StructuredBlockForest > &bf, const Set< SUID > &requiredBlockSelectors, const Set< SUID > &incompatibleBlockSelectors, const bool sendDirectlyFromGPU=false, const bool useLocalCommunication=true, std::optional< int > tag=std::nullopt)
 UniformGPUScheme (const UniformGPUScheme &)=delete
void addPackInfo (const shared_ptr< GeneratedGPUPackInfo > &pi)
void startCommunication ()
void wait ()
void operator() ()
void communicate ()
std::function< void()> getCommunicateFunctor ()
std::function< void()> getStartCommunicateFunctor ()
std::function< void()> getWaitFunctor ()

Private Types

using CpuBuffer_T = gpu::communication::PinnedMemoryBuffer
using GpuBuffer_T = gpu::communication::GPUMemoryBuffer

Private Member Functions

void setupCommunication ()

Private Attributes

weak_ptr< StructuredBlockForestblockForest_
uint_t forestModificationStamp_
bool setupBeforeNextCommunication_
bool communicationInProgress_
const bool sendFromGPU_
const bool useLocalCommunication_
mpi::GenericBufferSystem< CpuBuffer_T, CpuBuffer_TbufferSystemCPU_
mpi::GenericBufferSystem< GpuBuffer_T, GpuBuffer_TbufferSystemGPU_
std::vector< shared_ptr< GeneratedGPUPackInfo > > packInfos_
std::map< mpi::MPIRank, std::vector< Header > > headers_
Set< SUIDrequiredBlockSelectors_
Set< SUIDincompatibleBlockSelectors_
std::array< StreamRAII, Stencil::Q > streams_

Member Typedef Documentation

◆ CpuBuffer_T

template<typename Stencil>
using walberla::gpu::communication::UniformGPUScheme< Stencil >::CpuBuffer_T = gpu::communication::PinnedMemoryBuffer
private

◆ GpuBuffer_T

Constructor & Destructor Documentation

◆ UniformGPUScheme() [1/3]

template<typename Stencil>
walberla::gpu::communication::UniformGPUScheme< Stencil >::UniformGPUScheme ( const weak_ptr< StructuredBlockForest > & bf,
const bool sendDirectlyFromGPU = false,
const bool useLocalCommunication = true,
std::optional< int > tag = std::nullopt )
explicit

◆ UniformGPUScheme() [2/3]

template<typename Stencil>
walberla::gpu::communication::UniformGPUScheme< Stencil >::UniformGPUScheme ( const weak_ptr< StructuredBlockForest > & bf,
const Set< SUID > & requiredBlockSelectors,
const Set< SUID > & incompatibleBlockSelectors,
const bool sendDirectlyFromGPU = false,
const bool useLocalCommunication = true,
std::optional< int > tag = std::nullopt )
explicit

◆ UniformGPUScheme() [3/3]

template<typename Stencil>
walberla::gpu::communication::UniformGPUScheme< Stencil >::UniformGPUScheme ( const UniformGPUScheme< Stencil > & )
delete

Member Function Documentation

◆ addPackInfo()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::addPackInfo ( const shared_ptr< GeneratedGPUPackInfo > & pi)

◆ communicate()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::communicate ( )
inline

◆ getCommunicateFunctor()

template<typename Stencil>
std::function< void()> walberla::gpu::communication::UniformGPUScheme< Stencil >::getCommunicateFunctor ( )

◆ getStartCommunicateFunctor()

template<typename Stencil>
std::function< void()> walberla::gpu::communication::UniformGPUScheme< Stencil >::getStartCommunicateFunctor ( )

◆ getWaitFunctor()

template<typename Stencil>
std::function< void()> walberla::gpu::communication::UniformGPUScheme< Stencil >::getWaitFunctor ( )

◆ operator()()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::operator() ( )
inline

◆ setupCommunication()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::setupCommunication ( )
private

◆ startCommunication()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::startCommunication ( )

◆ wait()

template<typename Stencil>
void walberla::gpu::communication::UniformGPUScheme< Stencil >::wait ( )

Member Data Documentation

◆ blockForest_

template<typename Stencil>
weak_ptr<StructuredBlockForest> walberla::gpu::communication::UniformGPUScheme< Stencil >::blockForest_
private

◆ bufferSystemCPU_

template<typename Stencil>
mpi::GenericBufferSystem<CpuBuffer_T, CpuBuffer_T> walberla::gpu::communication::UniformGPUScheme< Stencil >::bufferSystemCPU_
private

◆ bufferSystemGPU_

template<typename Stencil>
mpi::GenericBufferSystem<GpuBuffer_T, GpuBuffer_T> walberla::gpu::communication::UniformGPUScheme< Stencil >::bufferSystemGPU_
private

◆ communicationInProgress_

template<typename Stencil>
bool walberla::gpu::communication::UniformGPUScheme< Stencil >::communicationInProgress_
private

◆ forestModificationStamp_

template<typename Stencil>
uint_t walberla::gpu::communication::UniformGPUScheme< Stencil >::forestModificationStamp_
private

◆ headers_

template<typename Stencil>
std::map<mpi::MPIRank, std::vector<Header> > walberla::gpu::communication::UniformGPUScheme< Stencil >::headers_
private

◆ incompatibleBlockSelectors_

template<typename Stencil>
Set<SUID> walberla::gpu::communication::UniformGPUScheme< Stencil >::incompatibleBlockSelectors_
private

◆ packInfos_

template<typename Stencil>
std::vector<shared_ptr<GeneratedGPUPackInfo> > walberla::gpu::communication::UniformGPUScheme< Stencil >::packInfos_
private

◆ requiredBlockSelectors_

template<typename Stencil>
Set<SUID> walberla::gpu::communication::UniformGPUScheme< Stencil >::requiredBlockSelectors_
private

◆ sendFromGPU_

template<typename Stencil>
const bool walberla::gpu::communication::UniformGPUScheme< Stencil >::sendFromGPU_
private

◆ setupBeforeNextCommunication_

template<typename Stencil>
bool walberla::gpu::communication::UniformGPUScheme< Stencil >::setupBeforeNextCommunication_
private

◆ streams_

template<typename Stencil>
std::array<StreamRAII, Stencil::Q> walberla::gpu::communication::UniformGPUScheme< Stencil >::streams_
private

◆ useLocalCommunication_

template<typename Stencil>
const bool walberla::gpu::communication::UniformGPUScheme< Stencil >::useLocalCommunication_
private

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