| 公有类型 | 公有成员函数 | 友元 | 所有成员列表
rmm::mr::thrust_allocator< T > 类模板参考

一个与 Thrust 容器和算法兼容的 allocator,使用 device_async_resource_ref 进行内存分配和释放。 更多...

#include <thrust__allocator__adaptor.hpp>

rmm::mr::thrust_allocator< T > 的继承图
Inheritance graph
[图例]
rmm::mr::thrust_allocator< T > 的协作图
Collaboration graph
[图例]

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 属性。 更多...
 

详细说明

template<typename T>
class rmm::mr::thrust_allocator< T >

一个与 Thrust 容器和算法兼容的 allocator,使用 device_async_resource_ref 进行内存分配和释放。

device_async_resource_ref 不同,thrust_allocator 是类型化的,绑定用于分配特定类型 T 的对象,但可以自由地重新绑定到其他类型。

此 allocator 记录当前的 cuda 设备,并且只能与对同一设备有效的底层 device_async_resource_ref 一起使用。

模板参数
T此 allocator 将分配的对象的类型

构造函数和析构函数文档

◆ thrust_allocator() [1/3]

template<typename T >
rmm::mr::thrust_allocator< T >::thrust_allocator ( cuda_stream_view  stream)
inlineexplicit

使用默认设备内存资源和指定流构造一个 thrust_allocator

参数
stream用于设备内存分配和释放的流

◆ thrust_allocator() [2/3]

template<typename T >
rmm::mr::thrust_allocator< T >::thrust_allocator ( cuda_stream_view  stream,
rmm::device_async_resource_ref  mr 
)
inline

使用设备内存资源和流构造一个 thrust_allocator

参数
mr用于设备内存分配的资源
stream用于设备内存分配和释放的流

◆ thrust_allocator() [3/3]

template<typename T >
template<typename U >
rmm::mr::thrust_allocator< T >::thrust_allocator ( thrust_allocator< U > const &  other)
inline

复制构造函数。复制资源指针和流。

参数
other要复制的 thrust_allocator

成员函数文档

◆ allocate()

template<typename T >
pointer rmm::mr::thrust__allocator< T >::allocate ( size_type  num)
inline

分配类型为 T 的对象

参数
num要分配的类型为 T 的元素的数量
返回值
pointer 指向新分配存储的指针

◆ deallocate()

template<typename T >
void rmm::mr::thrust__allocator< T >::deallocate ( pointer  ptr,
size_type  num 
)
inline

释放类型为 T 的对象

参数
ptr由先前调用 allocate 返回的指针
num元素数量,必须 等于产生 p 的先前 allocate 调用传递的参数

◆ get_upstream_resource()

template<typename T >
rmm::device_async_resource_ref rmm::mr::thrust__allocator< T >::get_upstream_resource ( ) const
inlinenoexcept

指向 upstream resource 的 rmm::device_async_resource_ref

返回值
指向 upstream resource 的 rmm::device_async_resource_ref

◆ stream()

template<typename T >
cuda_stream_view rmm::mr::thrust__allocator< T >::stream ( ) const
inlinenoexcept

此 allocator 使用的流。

返回值
此 allocator 使用的流

友元和相关函数文档

◆ get_property

template<typename T >
void get_property ( thrust_allocator< T > const &  ,
cuda::mr::device_accessible   
)
friend

启用 cuda::mr::device_accessible 属性。

此属性声明 thrust_allocator 提供设备可访问的内存


本类的文档生成自以下文件