OmniSciDB  2e3a973ef4
Data_Namespace::TypedThrustAllocator< T > Class Template Reference

a Templated version of Data_Namespace::ThrustAllocator that can be used as a custom allocator in thrust device containers such as thrust::device_vector. Note that this class derives from thrust::mr::allocator in order to meet the requirements of an Allocator More...

#include <TypedThrustAllocator.h>

+ Inheritance diagram for Data_Namespace::TypedThrustAllocator< T >:
+ Collaboration diagram for Data_Namespace::TypedThrustAllocator< T >:

Public Member Functions

 TypedThrustAllocator (ThrustAllocator &thrust_allocator)
 
 TypedThrustAllocator (const TypedThrustAllocator &other)
 
 TypedThrustAllocator (TypedThrustAllocator &&other)
 
__host__ __device__ void operator= (const TypedThrustAllocator< T > &other)
 
- Public Member Functions inherited from Data_Namespace::detail::TypedThrustAllocatorState
 TypedThrustAllocatorState (ThrustAllocator &thrust_allocator)
 
 TypedThrustAllocatorState (const TypedThrustAllocatorState &other)
 
 TypedThrustAllocatorState (TypedThrustAllocatorState &&other)
 
__host__ __device__ void operator= (const TypedThrustAllocatorState &other)
 

Private Types

using Base = thrust::mr::allocator< T, detail::TypedThrustAllocatorState::DeviceResource >
 

Additional Inherited Members

- Public Types inherited from Data_Namespace::detail::TypedThrustAllocatorState
using Pointer = thrust::pointer< void, thrust::device_system_tag, thrust::use_default, thrust::use_default >
 
using DeviceResource = thrust::device_ptr_memory_resource< DataMgrMemoryResource< Pointer > >
 
- Protected Attributes inherited from Data_Namespace::detail::TypedThrustAllocatorState
DataMgrMemoryResource< Pointerdata_mgr_mem_rsrc_
 
DeviceResource device_rsrc_
 

Detailed Description

template<typename T>
class Data_Namespace::TypedThrustAllocator< T >

a Templated version of Data_Namespace::ThrustAllocator that can be used as a custom allocator in thrust device containers such as thrust::device_vector. Note that this class derives from thrust::mr::allocator in order to meet the requirements of an Allocator

// creates a thrust allocator on device 0
ThrustAllocator thrust_allocator(data_mgr, 0);
// creates a device vector that allocates storage via the above ThrustAllocator
thrust::device_vector<int, TypedThrustAllocator<int>>
vec(10, TypedThrustAllocator<int>(thrust_allocator));

Definition at line 136 of file TypedThrustAllocator.h.

Member Typedef Documentation

◆ Base

template<typename T>
using Data_Namespace::TypedThrustAllocator< T >::Base = thrust::mr::allocator<T, detail::TypedThrustAllocatorState::DeviceResource>
private

Definition at line 140 of file TypedThrustAllocator.h.

Constructor & Destructor Documentation

◆ TypedThrustAllocator() [1/3]

template<typename T>
Data_Namespace::TypedThrustAllocator< T >::TypedThrustAllocator ( ThrustAllocator thrust_allocator)
inline

Definition at line 143 of file TypedThrustAllocator.h.

144  : detail::TypedThrustAllocatorState(thrust_allocator), Base(&device_rsrc_) {}
thrust::mr::allocator< T, detail::TypedThrustAllocatorState::DeviceResource > Base

◆ TypedThrustAllocator() [2/3]

template<typename T>
Data_Namespace::TypedThrustAllocator< T >::TypedThrustAllocator ( const TypedThrustAllocator< T > &  other)
inline

Definition at line 149 of file TypedThrustAllocator.h.

150  : detail::TypedThrustAllocatorState(other), Base(&device_rsrc_) {}
thrust::mr::allocator< T, detail::TypedThrustAllocatorState::DeviceResource > Base

◆ TypedThrustAllocator() [3/3]

template<typename T>
Data_Namespace::TypedThrustAllocator< T >::TypedThrustAllocator ( TypedThrustAllocator< T > &&  other)
inline

Definition at line 152 of file TypedThrustAllocator.h.

153  : detail::TypedThrustAllocatorState(std::move(other)), Base(&device_rsrc_) {}
thrust::mr::allocator< T, detail::TypedThrustAllocatorState::DeviceResource > Base

Member Function Documentation

◆ operator=()

template<typename T>
__host__ __device__ void Data_Namespace::TypedThrustAllocator< T >::operator= ( const TypedThrustAllocator< T > &  other)
inline

Definition at line 155 of file TypedThrustAllocator.h.

References Data_Namespace::detail::TypedThrustAllocatorState::operator=().

155  {
156  // NOTE: only applying the copy operator to TypedThrustAllocatorState
157  // The thrust::mr::allocator should have already been constructed with a poitner to
158  // the local state and is therefore up-to-date
160  }
__host__ __device__ void operator=(const TypedThrustAllocatorState &other)
+ Here is the call graph for this function:

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