一个与 Thrust 容器和算法兼容的 allocator
,使用 device_async_resource_ref
进行内存分配和释放。 更多...
#include <thrust__allocator__adaptor.hpp>
类 | |
struct | rebind |
提供用另一种类型实例化的 thrust_allocator 的类型。 更多... | |
公有类型 | |
using | Base = thrust::device_malloc_allocator< T > |
此 allocator 的基类型。 | |
using | pointer = typename Base::pointer |
指针类型。 | |
using | size_type = typename Base::size_type |
大小类型。 | |
公有成员函数 | |
thrust_allocator ()=default | |
默认构造函数使用默认内存资源和默认流创建一个 allocator。 | |
thrust_allocator (cuda_stream_view stream) | |
使用默认设备内存资源和指定流构造一个 thrust_allocator 。 更多... | |
thrust_allocator (cuda_stream_view stream, rmm::device_async_resource_ref mr) | |
使用设备内存资源和流构造一个 thrust_allocator 。 更多... | |
template<typename U > | |
thrust_allocator (thrust_allocator< U > const &other) | |
复制构造函数。复制资源指针和流。 更多... | |
pointer | allocate (size_type num) |
分配类型为 T 的对象。 更多... | |
void | deallocate (pointer ptr, size_type num) |
释放类型为 T 的对象。 更多... | |
rmm::device_async_resource_ref | get_upstream_resource () const noexcept |
指向 upstream resource 的 rmm::device_async_resource_ref。 更多... | |
cuda_stream_view | stream () const noexcept |
此 allocator 使用的流。 更多... | |
友元 | |
void | get_property (thrust_allocator const &, cuda::mr::device_accessible) noexcept |
启用 cuda::mr::device_accessible 属性。 更多... | |
一个与 Thrust 容器和算法兼容的 allocator
,使用 device_async_resource_ref
进行内存分配和释放。
与 device_async_resource_ref
不同,thrust_allocator
是类型化的,绑定用于分配特定类型 T
的对象,但可以自由地重新绑定到其他类型。
此 allocator 记录当前的 cuda 设备,并且只能与对同一设备有效的底层 device_async_resource_ref
一起使用。
T | 此 allocator 将分配的对象的类型 |
|
inlineexplicit |
使用默认设备内存资源和指定流构造一个 thrust_allocator
。
stream | 用于设备内存分配和释放的流 |
|
inline |
使用设备内存资源和流构造一个 thrust_allocator
。
mr | 用于设备内存分配的资源 |
stream | 用于设备内存分配和释放的流 |
|
inline |
复制构造函数。复制资源指针和流。
other | 要复制的 thrust_allocator |
|
inline |
分配类型为 T
的对象
num | 要分配的类型为 T 的元素的数量 |
|
inline |
释放类型为 T
的对象
ptr | 由先前调用 allocate 返回的指针 |
num | 元素数量,必须 等于产生 p 的先前 allocate 调用传递的参数 |
|
inlinenoexcept |
指向 upstream resource 的 rmm::device_async_resource_ref
|
inlinenoexcept |
此 allocator 使用的流。
|
friend |
启用 cuda::mr::device_accessible
属性。
此属性声明 thrust_allocator
提供设备可访问的内存