An allocator
compatible with Thrust containers and algorithms using a device_memory_resource
for memory (de)allocation.
More...
#include <thrust_allocator_adaptor.hpp>
|
using | Base = thrust::device_malloc_allocator< T > |
| The base type of this allocator.
|
|
using | pointer = typename Base::pointer |
| The pointer type.
|
|
using | size_type = typename Base::size_type |
| The size type.
|
|
template<typename T>
class rmm::mr::thrust_allocator< T >
An allocator
compatible with Thrust containers and algorithms using a device_memory_resource
for memory (de)allocation.
Unlike a device_memory_resource
, thrust_allocator
is typed and bound to allocate objects of a specific type T
, but can be freely rebound to other types.
- Template Parameters
-
T | The type of the objects that will be allocated by this allocator |
◆ thrust_allocator() [1/3]
Constructs a thrust_allocator
using the default device memory resource and specified stream.
- Parameters
-
stream | The stream to be used for device memory (de)allocation |
◆ thrust_allocator() [2/3]
Constructs a thrust_allocator
using a device memory resource and stream.
- Parameters
-
mr | The resource to be used for device memory allocation |
stream | The stream to be used for device memory (de)allocation |
◆ thrust_allocator() [3/3]
template<typename T >
template<typename U >
Copy constructor. Copies the resource pointer and stream.
- Parameters
-
◆ allocate()
Allocate objects of type T
- Parameters
-
num | The number of elements of type T to allocate |
- Returns
- pointer Pointer to the newly allocated storage
◆ deallocate()
Deallocates objects of type T
- Parameters
-
ptr | Pointer returned by a previous call to allocate |
num | number of elements, must be equal to the argument passed to the prior allocate call that produced p |
◆ memory_resource()
The async_resource_ref used to allocate and deallocate.
- Returns
- The async_resource_ref used to allocate and deallocate
◆ stream()
The stream used by this allocator.
- Returns
- The stream used by this allocator
◆ get_property
template<typename T >
void get_property |
( |
thrust_allocator< T > const & |
, |
|
|
cuda::mr::device_accessible |
|
|
) |
| |
|
friend |
Enables the cuda::mr::device_accessible
property.
This property declares that a thrust_allocator
provides device accessible memory
The documentation for this class was generated from the following file: