|
waLBerla 7.2
|
Data packing/unpacking for ghost layer based communication of a GPUField.
Encapsulate information on how to extract data from blocks that should be communicated to neighboring blocks (see pack()) and how to inject this data in a receiving block (see unpack()). This involves a device memory buffer and two device-to-device memory copy operations.
A special method exists for communication between two blocks which are allocated on the same process (see communicateLocal()). In this case the data does not have be communicated via a device buffer, but can be sent directly. This involves a single device-to-device memory copy operation.
Data that is packed in direction "dir" at one block is unpacked in direction "stencil::inverseDir[dir]" at the neighboring block. This behavior must be implemented in communicateLocal()!
| GPUFieldType | A fully qualified GPUField. |
#include <MemcpyPackInfo.h>
Inheritance diagram for walberla::gpu::communication::MemcpyPackInfo< GPUFieldType >:Public Member Functions | |
| MemcpyPackInfo (BlockDataID fieldId, const uint_t numGhostLayers=0) | |
| ~MemcpyPackInfo () override=default | |
| void | pack (stencil::Direction dir, unsigned char *buffer, IBlock *block, gpuStream_t stream) override |
| Pack data from a block into a send buffer. | |
| void | communicateLocal (stencil::Direction dir, const IBlock *sender, IBlock *receiver, gpuStream_t stream) override |
| Copy data from one local block to another local block. | |
| void | unpack (stencil::Direction dir, unsigned char *buffer, IBlock *block, gpuStream_t stream) override |
| Unpack data from a receive buffer into a block. | |
| uint_t | size (stencil::Direction dir, IBlock *block) override |
Public Member Functions inherited from walberla::gpu::GeneratedGPUPackInfo | |
| GeneratedGPUPackInfo ()=default | |
| virtual | ~GeneratedGPUPackInfo ()=default |
Private Member Functions | |
| uint_t | numberOfGhostLayersToCommunicate (const GPUFieldType *const field) const |
Private Attributes | |
| BlockDataID | fieldId_ |
| uint_t | numberOfGhostLayers_ { 0 } |
| bool | communicateAllGhostLayers_ { true } |
|
inline |
| fieldId_ | BlockDataID of the field to be communicated |
| numGhostLayers | Number of ghost layers to be communicated. If left at zero, the number will be inferred from the field. |
|
overridedefault |
|
overridevirtual |
Copy data from one local block to another local block.
Both blocks are allocated on the same MPI rank.
| dir | the direction of the communication (from sender to receiver) |
| sender | id of block where the data should be copied from |
| receiver | id of block where the data should be copied to |
| stream | GPU stream |
Implements walberla::gpu::GeneratedGPUPackInfo.
|
private |
|
overridevirtual |
Pack data from a block into a send buffer.
| dir | pack data for neighbor in this direction |
| buffer | buffer for writing the data into |
| block | the block whose data should be packed into a buffer |
| stream | GPU stream |
Implements walberla::gpu::GeneratedGPUPackInfo.
|
overridevirtual |
Implements walberla::gpu::GeneratedGPUPackInfo.
|
overridevirtual |
Unpack data from a receive buffer into a block.
| dir | receive data from neighbor in this direction |
| buffer | buffer for reading the data from |
| block | the block where the unpacked data should be stored into |
| stream | GPU stream |
Implements walberla::gpu::GeneratedGPUPackInfo.
|
private |
|
private |
|
private |