OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data_Namespace::detail::DataMgrMemoryResource< Pointer > Class Template Referencefinal

A thrust memory resource wrapped around a Data_Namespace::ThrustAllocator that allocates memory via DataMgr. This memory resource wrapper is required to properly use ThrustAllocator as a custom allocator for thrust device containers like thrust::device_vector. More...

#include <TypedThrustAllocator.h>

+ Inheritance diagram for Data_Namespace::detail::DataMgrMemoryResource< Pointer >:
+ Collaboration diagram for Data_Namespace::detail::DataMgrMemoryResource< Pointer >:

Public Member Functions

 DataMgrMemoryResource (ThrustAllocator &thrust_allocator)
 
 DataMgrMemoryResource (const DataMgrMemoryResource &other)
 
 ~DataMgrMemoryResource () final=default
 
Pointer do_allocate (std::size_t bytes, std::size_t alignment=THRUST_MR_DEFAULT_ALIGNMENT) final
 Overrides a pure virtual function defined in thrust::mr::memory_resource to allocate from a ThrustAllocator. More...
 
void do_deallocate (Pointer p, std::size_t bytes, std::size_t alignment) final
 Overrides a pure virtual function defined in thrust::mr::memory_resource to deallocate memory from a ThrustAllocator. More...
 
__host__ __device__ const
ThrustAllocator
getThrustAllocator () const
 

Private Types

using base = thrust::mr::memory_resource< Pointer >
 

Private Attributes

ThrustAllocatorthrust_allocator_
 

Detailed Description

template<typename Pointer>
class Data_Namespace::detail::DataMgrMemoryResource< Pointer >

A thrust memory resource wrapped around a Data_Namespace::ThrustAllocator that allocates memory via DataMgr. This memory resource wrapper is required to properly use ThrustAllocator as a custom allocator for thrust device containers like thrust::device_vector.

Definition at line 35 of file TypedThrustAllocator.h.

Member Typedef Documentation

template<typename Pointer >
using Data_Namespace::detail::DataMgrMemoryResource< Pointer >::base = thrust::mr::memory_resource<Pointer>
private

Definition at line 36 of file TypedThrustAllocator.h.

Constructor & Destructor Documentation

template<typename Pointer >
Data_Namespace::detail::DataMgrMemoryResource< Pointer >::DataMgrMemoryResource ( ThrustAllocator thrust_allocator)
inline

Definition at line 39 of file TypedThrustAllocator.h.

40  : base(), thrust_allocator_(&thrust_allocator) {}
thrust::mr::memory_resource< Pointer > base
template<typename Pointer >
Data_Namespace::detail::DataMgrMemoryResource< Pointer >::DataMgrMemoryResource ( const DataMgrMemoryResource< Pointer > &  other)
inline

Definition at line 41 of file TypedThrustAllocator.h.

42  : base(other), thrust_allocator_(other.thrust_allocator_) {}
thrust::mr::memory_resource< Pointer > base
template<typename Pointer >
Data_Namespace::detail::DataMgrMemoryResource< Pointer >::~DataMgrMemoryResource ( )
finaldefault

Member Function Documentation

template<typename Pointer >
Pointer Data_Namespace::detail::DataMgrMemoryResource< Pointer >::do_allocate ( std::size_t  bytes,
std::size_t  alignment = THRUST_MR_DEFAULT_ALIGNMENT 
)
inlinefinal

Overrides a pure virtual function defined in thrust::mr::memory_resource to allocate from a ThrustAllocator.

Definition at line 49 of file TypedThrustAllocator.h.

References ThrustAllocator::allocate(), and Data_Namespace::detail::DataMgrMemoryResource< Pointer >::thrust_allocator_.

50  {
51  (void)alignment; // dummy cast to avoid unused warnings
52  return Pointer(
53  reinterpret_cast<typename thrust::detail::pointer_traits<Pointer>::element_type*>(
54  thrust_allocator_->allocate(bytes)));
55  }
int8_t * allocate(std::ptrdiff_t num_bytes)

+ Here is the call graph for this function:

template<typename Pointer >
void Data_Namespace::detail::DataMgrMemoryResource< Pointer >::do_deallocate ( Pointer  p,
std::size_t  bytes,
std::size_t  alignment 
)
inlinefinal

Overrides a pure virtual function defined in thrust::mr::memory_resource to deallocate memory from a ThrustAllocator.

Definition at line 61 of file TypedThrustAllocator.h.

References ThrustAllocator::deallocate(), and Data_Namespace::detail::DataMgrMemoryResource< Pointer >::thrust_allocator_.

61  {
62  (void)alignment; // dummy cast to avoid unused warnings
64  reinterpret_cast<int8_t*>(thrust::detail::pointer_traits<Pointer>::get(p)),
65  bytes);
66  }
void deallocate(int8_t *ptr, size_t num_bytes)

+ Here is the call graph for this function:

template<typename Pointer >
__host__ __device__ const ThrustAllocator* Data_Namespace::detail::DataMgrMemoryResource< Pointer >::getThrustAllocator ( ) const
inline

Member Data Documentation


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