公共成员函数 | 所有成员列表
rmm::mr::limiting_resource_adaptor< Upstream > 类模板参考final

使用 Upstream 分配内存并限制总分配量的资源。 更多...

#include <limiting_resource_adaptor.hpp>

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

公共成员函数

 limiting_resource_adaptor (device_async_resource_ref upstream, std::size_t allocation_limit, std::size_t alignment=CUDA_ALLOCATION_ALIGNMENT)
 构造一个新的限制资源适配器,使用 upstream 满足分配请求并限制可能的总分配量。 更多...
 
 limiting_resource_adaptor (Upstream *upstream, std::size_t allocation_limit, std::size_t alignment=CUDA_ALLOCATION_ALIGNMENT)
 构造一个新的限制资源适配器,使用 upstream 满足分配请求并限制可能的总分配量。 更多...
 
 limiting_resource_adaptor (limiting_resource_adaptor const &)=delete
 
 limiting_resource_adaptor (limiting_resource_adaptor &&) noexcept=default
 默认移动构造函数。
 
limiting_resource_adaptoroperator= (limiting_resource_adaptor const &)=delete
 
limiting_resource_adaptoroperator= (limiting_resource_adaptor &&) noexcept=default
 默认移动赋值运算符。 更多...
 
device_async_resource_ref get_upstream_resource () const noexcept
 上游资源的 device_async_resource_ref 更多...
 
std::size_t get_allocated_bytes () const
 查询已分配的字节数。注意,由于可能的碎片以及此分配器未跟踪的内部页面大小和对齐方式,不能使用此函数来了解可能的最大分配量。 更多...
 
std::size_t get_allocation_limit () const
 查询此分配器允许分配的最大字节数。这是对分配器的限制,并非底层设备的表示。设备可能无法支持此限制。 更多...
 
- 继承自 rmm::mr::device_memory_resource 的公共成员函数
 device_memory_resource (device_memory_resource const &)=default
 默认拷贝构造函数。
 
 device_memory_resource (device_memory_resource &&) noexcept=default
 默认移动构造函数。
 
device_memory_resourceoperator= (device_memory_resource const &)=default
 默认拷贝赋值运算符。 更多...
 
device_memory_resourceoperator= (device_memory_resource &&) noexcept=default
 默认移动赋值运算符。 更多...
 
void * allocate (std::size_t bytes, cuda_stream_view stream=cuda_stream_view{})
 分配至少 bytes 大小的内存。 更多...
 
void deallocate (void *ptr, std::size_t bytes, cuda_stream_view stream=cuda_stream_view{})
 释放 p 指向的内存。 更多...
 
bool is_equal (device_memory_resource const &other) const noexcept
 将此资源与另一个资源进行比较。 更多...
 
void * allocate (std::size_t bytes, std::size_t alignment)
 分配至少 bytes 大小的内存。 更多...
 
void deallocate (void *ptr, std::size_t bytes, std::size_t alignment)
 释放 p 指向的内存。 更多...
 
void * allocate_async (std::size_t bytes, std::size_t alignment, cuda_stream_view stream)
 分配至少 bytes 大小的内存。 更多...
 
void * allocate_async (std::size_t bytes, cuda_stream_view stream)
 分配至少 bytes 大小的内存。 更多...
 
void deallocate_async (void *ptr, std::size_t bytes, std::size_t alignment, cuda_stream_view stream)
 释放 p 指向的内存。 更多...
 
void deallocate_async (void *ptr, std::size_t bytes, cuda_stream_view stream)
 释放 p 指向的内存。 更多...
 
bool operator== (device_memory_resource const &other) const noexcept
 与另一个 device_memory_resource 的比较运算符。 更多...
 
bool operator!= (device_memory_resource const &other) const noexcept
 与另一个 device_memory_resource 的比较运算符。 更多...
 

详细描述

template<typename Upstream>
class rmm::mr::limiting_resource_adaptor< Upstream >

使用 Upstream 分配内存并限制总分配量的资源。

此资源的一个实例可以使用现有的上游资源来满足分配请求,但任何现有的分配将不被跟踪。原子操作用于确保线程安全,但请注意 get_allocated_bytes 可能不包含正在进行的分配。

模板参数
Upstream用于分配/释放内存的上游资源的类型。

构造函数与析构函数文档

◆ limiting_resource_adaptor() [1/2]

template<typename Upstream >
rmm::mr::limiting_resource_adaptor< Upstream >::limiting_resource_adaptor ( device_async_resource_ref  upstream,
std::size_t  allocation_limit,
std::size_t  alignment = CUDA_ALLOCATION_ALIGNMENT 
)
inline

构造一个新的限制资源适配器,使用 upstream 满足分配请求并限制可能的总分配量。

参数
upstream用于分配/释放设备内存的资源
allocation_limit此分配器允许的最大内存量
alignment每个已分配缓冲区起始的对齐字节数

◆ limiting_resource_adaptor() [2/2]

template<typename Upstream >
rmm::mr::limiting_resource_adaptor< Upstream >::limiting_resource_adaptor ( Upstream *  upstream,
std::size_t  allocation_limit,
std::size_t  alignment = CUDA_ALLOCATION_ALIGNMENT 
)
inline

构造一个新的限制资源适配器,使用 upstream 满足分配请求并限制可能的总分配量。

异常
rmm::logic_error如果 upstream == nullptr
参数
upstream用于分配/释放设备内存的资源
allocation_limit此分配器允许的最大内存量
alignment每个已分配缓冲区起始的对齐字节数

成员函数文档

◆ get_allocated_bytes()

template<typename Upstream >
std::size_t rmm::mr::limiting_resource_adaptor< Upstream >::get_allocated_bytes ( ) const
inline

查询已分配的字节数。注意,由于可能的碎片以及此分配器未跟踪的内部页面大小和对齐方式,不能使用此函数来了解可能的最大分配量。

返回值
通过此分配器已分配的字节数 (std::size_t)。

◆ get_allocation_limit()

template<typename Upstream >
std::size_t rmm::mr::limiting_resource_adaptor< Upstream >::get_allocation_limit ( ) const
inline

查询此分配器允许分配的最大字节数。这是对分配器的限制,并非底层设备的表示。设备可能无法支持此限制。

返回值
此分配器允许的最大字节数 (std::size_t)

◆ get_upstream_resource()

template<typename Upstream >
device_async_resource_ref rmm::mr::limiting_resource_adaptor< Upstream >::get_upstream_resource ( ) const
inlinenoexcept

上游资源的 device_async_resource_ref

返回值
上游资源的 device_async_resource_ref

◆ operator=()

template<typename Upstream >
limiting_resource_adaptor& rmm::mr::limiting_resource_adaptor< Upstream >::operator= ( limiting_resource_adaptor< Upstream > &&  )
defaultnoexcept

默认移动赋值运算符。

返回值
limiting_resource_adaptor& 被赋值对象的引用

此类的文档生成自以下文件: