waLBerla 7.2
Loading...
Searching...
No Matches
walberla::gpu::HostFieldAllocator< T, HostAllocFlags > Class Template Reference

Detailed Description

template<typename T, unsigned int HostAllocFlags = gpuHostAllocDefault>
class walberla::gpu::HostFieldAllocator< T, HostAllocFlags >

Allocator that allocates a CPU! field using gpuHostAlloc without padding.

Uses gpuHostAlloc for the allocation - which allocates page-locked memory that is faster to transfer to the GPU. This allocator should be used for CPU fields that are often transferred to GPU and back.

#include <HostFieldAllocator.h>

+ Inheritance diagram for walberla::gpu::HostFieldAllocator< T, HostAllocFlags >:

Public Member Functions

 ~HostFieldAllocator () override=default
 
T * allocateMemory (uint_t size0, uint_t size1, uint_t size2, uint_t size3, uint_t &allocSize1, uint_t &allocSize2, uint_t &allocSize3) override
 Same as allocated, without handling of reference counter.
 
T * allocateMemory (uint_t size) override
 Same as allocated, without handling of reference counter.
 
void deallocate (T *&values) override
 Deallocates memory that has been allocated using allocate()
 
- Public Member Functions inherited from walberla::field::FieldAllocator< T >
virtual ~FieldAllocator ()=default
 
T * allocate (uint_t size0, uint_t size1, uint_t size2, uint_t size3, uint_t &allocSize1, uint_t &allocSize2, uint_t &allocSize3)
 Allocate memory for a field of given sizes and initializes reference counter with one.
 
virtual void setInnerGhostLayerSize (uint_t)
 
T * allocate (uint_t allocSize)
 Allocate memory of the given size.
 
void incrementReferenceCount (T *mem)
 Increments the reference count for the given pointer.
 
bool decrementReferenceCount (T *mem)
 Decrements the reference count for the given pointer.
 
uint_t referenceCount (T *mem) const
 

Additional Inherited Members

- Public Types inherited from walberla::field::FieldAllocator< T >
using BaseType = std::conditional_t<VectorTrait<T>::F_SIZE!=0, typename VectorTrait<T>::OutputType, T>
 

Constructor & Destructor Documentation

◆ ~HostFieldAllocator()

template<typename T , unsigned int HostAllocFlags = gpuHostAllocDefault>
walberla::gpu::HostFieldAllocator< T, HostAllocFlags >::~HostFieldAllocator ( )
overridedefault

Member Function Documentation

◆ allocateMemory() [1/2]

template<typename T , unsigned int HostAllocFlags = gpuHostAllocDefault>
T * walberla::gpu::HostFieldAllocator< T, HostAllocFlags >::allocateMemory ( uint_t size)
inlineoverridevirtual

Same as allocated, without handling of reference counter.

Implements walberla::field::FieldAllocator< T >.

◆ allocateMemory() [2/2]

template<typename T , unsigned int HostAllocFlags = gpuHostAllocDefault>
T * walberla::gpu::HostFieldAllocator< T, HostAllocFlags >::allocateMemory ( uint_t size0,
uint_t size1,
uint_t size2,
uint_t size3,
uint_t & allocSize1,
uint_t & allocSize2,
uint_t & allocSize3 )
inlineoverridevirtual

Same as allocated, without handling of reference counter.

Implements walberla::field::FieldAllocator< T >.

◆ deallocate()

template<typename T , unsigned int HostAllocFlags = gpuHostAllocDefault>
void walberla::gpu::HostFieldAllocator< T, HostAllocFlags >::deallocate ( T *& values)
inlineoverridevirtual

Deallocates memory that has been allocated using allocate()

Parameters
valuesReturn value of allocate function()

Implements walberla::field::FieldAllocator< T >.


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