19 #include <thrust/device_vector.h>
20 #include <thrust/mr/allocator.h>
21 #include <thrust/mr/memory_resource.h>
25 namespace Data_Namespace {
34 template <
typename Po
inter>
36 using base = thrust::mr::memory_resource<Pointer>;
50 std::
size_t alignment = THRUST_MR_DEFAULT_ALIGNMENT) final {
53 reinterpret_cast<typename thrust::detail::pointer_traits<Pointer>::element_type*
>(
61 void do_deallocate(Pointer p, std::size_t bytes, std::size_t alignment)
final {
64 reinterpret_cast<int8_t*>(thrust::detail::pointer_traits<Pointer>::get(p)),
86 pointer<void, thrust::device_system_tag, thrust::use_default, thrust::use_default>;
91 thrust::device_ptr_memory_resource<DataMgrMemoryResource<Pointer>>;
135 template <
typename T>
138 public thrust::mr::allocator<T, detail::TypedThrustAllocatorState::DeviceResource> {
140 thrust::mr::allocator<T, detail::TypedThrustAllocatorState::DeviceResource>;
163 template <
typename T>
DataMgrMemoryResource(const DataMgrMemoryResource &other)
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 ...
int8_t * allocate(std::ptrdiff_t num_bytes)
DeviceResource device_rsrc_
__host__ __device__ void operator=(const TypedThrustAllocator< T > &other)
void deallocate(int8_t *ptr, size_t num_bytes)
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 ThrustAll...
Manages the underlying state of a TypedThrustAllocator. The state consists of: DataMgrMemoryResource:...
__host__ __device__ const ThrustAllocator * getThrustAllocator() const
A thrust memory resource wrapped around a Data_Namespace::ThrustAllocator that allocates memory via D...
__host__ __device__ void operator=(const TypedThrustAllocatorState &other)
thrust::pointer< void, thrust::device_system_tag, thrust::use_default, thrust::use_default > Pointer
thrust::mr::allocator< T, detail::TypedThrustAllocatorState::DeviceResource > Base
~DataMgrMemoryResource() final=default
TypedThrustAllocatorState(ThrustAllocator &thrust_allocator)
DataMgrMemoryResource(ThrustAllocator &thrust_allocator)
a Templated version of Data_Namespace::ThrustAllocator that can be used as a custom allocator in thru...
ThrustAllocator * thrust_allocator_
TypedThrustAllocatorState(TypedThrustAllocatorState &&other)
TypedThrustAllocator(ThrustAllocator &thrust_allocator)
DataMgrMemoryResource< Pointer > data_mgr_mem_rsrc_
TypedThrustAllocatorState(const TypedThrustAllocatorState &other)
TypedThrustAllocator(TypedThrustAllocator &&other)
thrust::mr::memory_resource< Pointer > base
thrust::device_vector< T, TypedThrustAllocator< T >> ThrustAllocatorDeviceVector
TypedThrustAllocator(const TypedThrustAllocator &other)
thrust::device_ptr_memory_resource< DataMgrMemoryResource< Pointer >> DeviceResource