GhostLayerField stored on a CUDA/HIP GPU.
Basically a wrapper around a CUDA/HIP device pointer together with size information about the field i.e. sizes in x,y,z,f directions and number of ghost layers.
Internally represented by a gpuPitchedPtr which is allocated with gpuMalloc3D to take padding of the innermost coordinate into account.
Supports Array-of-Structures (AoS,zyxf) layout and Structure-of-Arrays (SoA, fzyx) layout, in a similar way to field::Field
To work with the GPUField look at the gpu::fieldCpy functions to transfer a field::Field to a gpu::GPUField and vice versa. When writing device kernels for GPUFields have a look at the FieldIndexing and FieldAccessor concepts. These simplify the "iteration" i.e. indexing of cells in GPUFields.
#include <GPUField.h>
Public Types | |
typedef T | value_type |
Public Member Functions | |
GPUField (uint_t _xSize, uint_t _ySize, uint_t _zSize, uint_t _fSize, uint_t _nrOfGhostLayers, const Layout &_layout=fzyx, bool usePitchedMem=true) | |
~GPUField () | |
Layout | layout () const |
bool | isPitchedMem () const |
gpuPitchedPtr | pitchedPtr () const |
uint_t | xSize () const |
uint_t | ySize () const |
uint_t | zSize () const |
uint_t | fSize () const |
uint_t | size () const |
uint_t | size (uint_t coord) const |
uint_t | xSizeWithGhostLayer () const |
uint_t | ySizeWithGhostLayer () const |
uint_t | zSizeWithGhostLayer () const |
uint_t | sizeWithGhostLayer (uint_t i) const |
cell_idx_t | xOff () const |
cell_idx_t | yOff () const |
cell_idx_t | zOff () const |
cell_idx_t | xStride () const |
cell_idx_t | yStride () const |
cell_idx_t | zStride () const |
cell_idx_t | fStride () const |
uint_t | xAllocSize () const |
uint_t | yAllocSize () const |
uint_t | zAllocSize () const |
uint_t | fAllocSize () const |
uint_t | allocSize () const |
bool | hasSameAllocSize (const GPUField< T > &other) const |
True if allocation sizes of all dimensions match. More... | |
bool | hasSameSize (const GPUField< T > &other) const |
True if sizes of all dimensions match. More... | |
GPUField< T > * | cloneUninitialized () const |
Creates a new GPUField that has equal size, layout and memory type as this field but has uninitialized memory. More... | |
void | swapDataPointers (GPUField< T > &other) |
void | swapDataPointers (GPUField< T > *other) |
uint_t | nrOfGhostLayers () const |
CellInterval | xyzSize () const |
CellInterval | xyzSizeWithGhostLayer () const |
bool | operator== (const GPUField &other) const |
Implementation of equality operator, GPUField are equal if identical. More... | |
void | getGhostRegion (stencil::Direction d, CellInterval &ci, cell_idx_t thickness, bool fullSlice=false) const |
void | getSliceBeforeGhostLayer (stencil::Direction d, CellInterval &ci, cell_idx_t thickness, bool fullSlice=false) const |
void | getSlice (stencil::Direction d, CellInterval &ci, cell_idx_t distance, cell_idx_t thickness, bool fullSlice) const |
void * | data () |
const void * | data () const |
T * | dataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) |
const T * | dataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
TimestepCounter | |
gpuPitchedPtr | pitchedPtr_ |
uint_t | nrOfGhostLayers_ |
uint_t | xSize_ |
uint_t | ySize_ |
uint_t | zSize_ |
uint_t | fSize_ |
uint_t | xAllocSize_ |
uint_t | fAllocSize_ |
Layout | layout_ |
bool | usePitchedMem_ |
uint8_t | timestepCounter_ |
uint8_t | advanceTimestep () |
uint8_t | getTimestep () const |
uint8_t | getTimestepPlusOne () const |
bool | isEvenTimeStep () const |
typedef T walberla::gpu::GPUField< T >::value_type |
walberla::gpu::GPUField< T >::GPUField | ( | uint_t | _xSize, |
uint_t | _ySize, | ||
uint_t | _zSize, | ||
uint_t | _fSize, | ||
uint_t | _nrOfGhostLayers, | ||
const Layout & | _layout = fzyx , |
||
bool | usePitchedMem = true |
||
) |
walberla::gpu::GPUField< T >::~GPUField |
|
inline |
|
inline |
GPUField< T > * walberla::gpu::GPUField< T >::cloneUninitialized |
|
inline |
|
inline |
T * walberla::gpu::GPUField< T >::dataAt | ( | cell_idx_t | x, |
cell_idx_t | y, | ||
cell_idx_t | z, | ||
cell_idx_t | f | ||
) |
const T * walberla::gpu::GPUField< T >::dataAt | ( | cell_idx_t | x, |
cell_idx_t | y, | ||
cell_idx_t | z, | ||
cell_idx_t | f | ||
) | const |
uint_t walberla::gpu::GPUField< T >::fAllocSize |
|
inline |
|
inline |
void walberla::gpu::GPUField< T >::getGhostRegion | ( | stencil::Direction | d, |
CellInterval & | ci, | ||
cell_idx_t | thickness, | ||
bool | fullSlice = false |
||
) | const |
void walberla::gpu::GPUField< T >::getSlice | ( | stencil::Direction | d, |
CellInterval & | ci, | ||
cell_idx_t | distance, | ||
cell_idx_t | thickness, | ||
bool | fullSlice | ||
) | const |
|
inline |
|
inline |
|
inline |
bool walberla::gpu::GPUField< T >::hasSameAllocSize | ( | const GPUField< T > & | other | ) | const |
True if allocation sizes of all dimensions match.
bool walberla::gpu::GPUField< T >::hasSameSize | ( | const GPUField< T > & | other | ) | const |
True if sizes of all dimensions match.
|
inline |
|
inline |
|
inline |
|
inline |
bool walberla::gpu::GPUField< T >::operator== | ( | const GPUField< T > & | o | ) | const |
Implementation of equality operator, GPUField are equal if identical.
operator== is required in order to store GPUFields as block data. Implementing a correct equality check would require to call a kernel, which should be done manually. Therefore only identical GPUFields are considered equal.
|
inline |
|
inline |
|
inline |
|
inline |
void walberla::gpu::GPUField< T >::swapDataPointers | ( | GPUField< T > & | other | ) |
|
inline |
uint_t walberla::gpu::GPUField< T >::xAllocSize |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
uint_t walberla::gpu::GPUField< T >::yAllocSize |
|
inline |
|
inline |
|
inline |
|
inline |
uint_t walberla::gpu::GPUField< T >::zAllocSize |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |