walberla::gpu::communication::CustomMemoryBuffer< Allocator > Class Template Reference

Detailed Description

template<typename Allocator>
class walberla::gpu::communication::CustomMemoryBuffer< Allocator >

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:

  • static void *allocate( size_t size )
  • void deallocate( void *ptr )
  • void memcpy( void *dst, void *src, size_t count )

The buffer has a beginning, a current position and an end position. Here is an overview of the most important operations:

  • clear: reset current position to begin, does not change size
  • advance: moves current position number of bytes forward and returns pointer to the old current position two versions are available, one that automatically resizes and reallocates the buffer, and one that fails if not enough space is available

#include <CustomMemoryBuffer.h>

Public Types

using ElementType = uint8_t
 

Public Member Functions

 CustomMemoryBuffer ()
 
 CustomMemoryBuffer (std::size_t initSize)
 
 CustomMemoryBuffer (const CustomMemoryBuffer &pb)
 
 ~CustomMemoryBuffer ()
 
CustomMemoryBufferoperator= (const CustomMemoryBuffer &pb)
 
void resize (std::size_t newSize)
 
std::size_t allocSize () const
 
std::size_t size () const
 
std::size_t remainingSize () const
 
ElementTypeptr () const
 
ElementTypecur () const
 
void clear ()
 
ElementTypeadvance (std::size_t bytes)
 
ElementTypeadvanceNoResize (std::size_t bytes)
 
template<typename T >
T * advance (std::size_t bytes)
 
template<typename T >
T * advanceNoResize (std::size_t bytes)
 

Private Attributes

ElementTypebegin_ = nullptr
 
ElementTypecur_ = nullptr
 
ElementTypeend_ = nullptr
 

Member Typedef Documentation

◆ ElementType

template<typename Allocator >
using walberla::gpu::communication::CustomMemoryBuffer< Allocator >::ElementType = uint8_t

Constructor & Destructor Documentation

◆ CustomMemoryBuffer() [1/3]

template<typename Allocator >
walberla::gpu::communication::CustomMemoryBuffer< Allocator >::CustomMemoryBuffer ( )
explicitdefault

◆ CustomMemoryBuffer() [2/3]

template<typename Allocator >
walberla::gpu::communication::CustomMemoryBuffer< Allocator >::CustomMemoryBuffer ( std::size_t  initSize)
explicit

◆ CustomMemoryBuffer() [3/3]

template<typename Allocator >
walberla::gpu::communication::CustomMemoryBuffer< Allocator >::CustomMemoryBuffer ( const CustomMemoryBuffer< Allocator > &  pb)
explicit

◆ ~CustomMemoryBuffer()

template<typename Allocator >
walberla::gpu::communication::CustomMemoryBuffer< Allocator >::~CustomMemoryBuffer

Member Function Documentation

◆ advance() [1/2]

template<typename Allocator >
CustomMemoryBuffer< Allocator >::ElementType * walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advance ( std::size_t  bytes)

◆ advance() [2/2]

template<typename Allocator >
template<typename T >
T* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advance ( std::size_t  bytes)
inline

◆ advanceNoResize() [1/2]

template<typename Allocator >
CustomMemoryBuffer< Allocator >::ElementType * walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advanceNoResize ( std::size_t  bytes)

◆ advanceNoResize() [2/2]

template<typename Allocator >
template<typename T >
T* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::advanceNoResize ( std::size_t  bytes)
inline

◆ allocSize()

template<typename Allocator >
std::size_t walberla::gpu::communication::CustomMemoryBuffer< Allocator >::allocSize ( ) const
inline

◆ clear()

template<typename Allocator >
void walberla::gpu::communication::CustomMemoryBuffer< Allocator >::clear ( )
inline

◆ cur()

template<typename Allocator >
ElementType* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::cur ( ) const
inline

◆ operator=()

template<typename Allocator >
CustomMemoryBuffer< Allocator > & walberla::gpu::communication::CustomMemoryBuffer< Allocator >::operator= ( const CustomMemoryBuffer< Allocator > &  pb)

◆ ptr()

template<typename Allocator >
ElementType* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::ptr ( ) const
inline

◆ remainingSize()

template<typename Allocator >
std::size_t walberla::gpu::communication::CustomMemoryBuffer< Allocator >::remainingSize ( ) const
inline

◆ resize()

template<typename Allocator >
void walberla::gpu::communication::CustomMemoryBuffer< Allocator >::resize ( std::size_t  newSize)

◆ size()

template<typename Allocator >
std::size_t walberla::gpu::communication::CustomMemoryBuffer< Allocator >::size ( ) const
inline

Member Data Documentation

◆ begin_

template<typename Allocator >
ElementType* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::begin_ = nullptr
private

◆ cur_

template<typename Allocator >
ElementType* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::cur_ = nullptr
private

◆ end_

template<typename Allocator >
ElementType* walberla::gpu::communication::CustomMemoryBuffer< Allocator >::end_ = nullptr
private

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