Simple buffer class that supports memory allocators, e.g.
for pinned host memory or GPU memory
In contrast to core::mpi::Buffer this class does not support stream operators "<<" and ">>" because these operators imply serial (un)packing which is not feasible on the GPU. The allocator template has to provide:
The buffer has a beginning, a current position and an end position. Here is an overview of the most important operations:
#include <CustomMemoryBuffer.h>
Public Types | |
using | ElementType = uint8_t |
Public Member Functions | |
CustomMemoryBuffer () | |
CustomMemoryBuffer (std::size_t initSize) | |
CustomMemoryBuffer (const CustomMemoryBuffer &pb) | |
~CustomMemoryBuffer () | |
CustomMemoryBuffer & | operator= (const CustomMemoryBuffer &pb) |
void | resize (std::size_t newSize) |
std::size_t | allocSize () const |
std::size_t | size () const |
std::size_t | remainingSize () const |
ElementType * | ptr () const |
ElementType * | cur () const |
void | clear () |
ElementType * | advance (std::size_t bytes) |
ElementType * | advanceNoResize (std::size_t bytes) |
template<typename T > | |
T * | advance (std::size_t bytes) |
template<typename T > | |
T * | advanceNoResize (std::size_t bytes) |
Private Attributes | |
ElementType * | begin_ = nullptr |
ElementType * | cur_ = nullptr |
ElementType * | end_ = nullptr |
using walberla::gpu::communication::CustomMemoryBuffer< Allocator >::ElementType = uint8_t |
|
explicitdefault |
|
explicit |
|
explicit |
walberla::gpu::communication::CustomMemoryBuffer< Allocator >::~CustomMemoryBuffer |
CustomMemoryBuffer< Allocator >::ElementType * walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advance | ( | std::size_t | bytes | ) |
|
inline |
CustomMemoryBuffer< Allocator >::ElementType * walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advanceNoResize | ( | std::size_t | bytes | ) |
|
inline |
|
inline |
|
inline |
|
inline |
CustomMemoryBuffer< Allocator > & walberla::gpu::communication::CustomMemoryBuffer< Allocator >::operator= | ( | const CustomMemoryBuffer< Allocator > & | pb | ) |
|
inline |
|
inline |
void walberla::gpu::communication::CustomMemoryBuffer< Allocator >::resize | ( | std::size_t | newSize | ) |
|
inline |
|
private |
|
private |
|
private |