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

从与 bin 大小关联的上游资源分配内存。 更多...

#include <binning_memory_resource.hpp>

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

公共成员函数

 binning_memory_resource (device_async_resource_ref upstream_resource)
 构造一个新的 binning 内存资源对象。 更多...
 
 binning_memory_resource (Upstream *upstream_resource)
 构造一个新的 binning 内存资源对象。 更多...
 
 binning_memory_resource (device_async_resource_ref upstream_resource, int8_t min_size_exponent, int8_t max_size_exponent)
 构造一个新的 binning 内存资源对象,包含一系列初始 bin。 更多...
 
 binning_memory_resource (Upstream *upstream_resource, int8_t min_size_exponent, int8_t max_size_exponent)
 构造一个新的 binning 内存资源对象,包含一系列初始 bin。 更多...
 
 ~binning_memory_resource () override=default
 销毁 binning_memory_resource 并释放从上游资源分配的所有内存。
 
 binning_memory_resource (binning_memory_resource const &)=delete
 
 binning_memory_resource (binning_memory_resource &&)=delete
 
binning_memory_resourceoperator= (binning_memory_resource const &)=delete
 
binning_memory_resourceoperator= (binning_memory_resource &&)=delete
 
device_async_resource_ref get_upstream_resource () const noexcept
 指向上游资源的 device_async_resource_ref 更多...
 
void add_bin (std::size_t allocation_size, std::optional< device_async_resource_ref > bin_resource=std::nullopt)
 向此资源添加一个 bin 分配器。 更多...
 
- 从 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::binning_memory_resource< Upstream >

从与 bin 大小关联的上游资源分配内存。

模板参数
UpstreamResource用于分配不属于任何已配置 bin 大小的 memory_resource。实现了 rmm::mr::device_memory_resource 接口。

构造函数与析构函数文档

◆ binning_memory_resource() [1/4]

template<typename Upstream >
rmm::mr::binning_memory_resource< Upstream >::binning_memory_resource ( device_async_resource_ref  upstream_resource)
inlineexplicit

构造一个新的 binning 内存资源对象。

初始时没有 bin,因此只使用 upstream_resource,直到使用 add_bin 添加 bin 资源。

参数
upstream_resource用于分配 bin 池的上游内存资源。

◆ binning_memory_resource() [2/4]

template<typename Upstream >
rmm::mr::binning_memory_resource< Upstream >::binning_memory_resource ( Upstream *  upstream_resource)
inlineexplicit

构造一个新的 binning 内存资源对象。

初始时没有 bin,因此只使用 upstream_resource,直到使用 add_bin 添加 bin 资源。

异常
rmm::logic_error如果 upstream_resource 为 nullptr
参数
upstream_resource用于分配 bin 池的上游内存资源。

◆ binning_memory_resource() [3/4]

template<typename Upstream >
rmm::mr::binning_memory_resource< Upstream >::binning_memory_resource ( device_async_resource_ref  upstream_resource,
int8_t  min_size_exponent,
int8_t  max_size_exponent 
)
inline

构造一个新的 binning 内存资源对象,包含一系列初始 bin。

构造一个新的 binning 内存资源,并添加由 fixed_size_memory_resource 支持的 bin,范围在 [2^min_size_exponent, 2^max_size_exponent] 内。例如,如果 min_size_exponent==18max_size_exponent==22,将创建大小为 256KiB、512KiB、1024KiB、2048KiB 和 4096KiB 的 bin。

参数
upstream_resource用于分配 bin 池的上游内存资源。
min_size_exponent最小的以 2 为底的指数 bin 大小。
max_size_exponent最大的以 2 为底的指数 bin 大小。

◆ binning_memory_resource() [4/4]

template<typename Upstream >
rmm::mr::binning_memory_resource< Upstream >::binning_memory_resource ( Upstream *  upstream_resource,
int8_t  min_size_exponent,
int8_t  max_size_exponent 
)
inline

构造一个新的 binning 内存资源对象,包含一系列初始 bin。

构造一个新的 binning 内存资源,并添加由 fixed_size_memory_resource 支持的 bin,范围在 [2^min_size_exponent, 2^max_size_exponent] 内。例如,如果 min_size_exponent==18max_size_exponent==22,将创建大小为 256KiB、512KiB、1024KiB、2048KiB 和 4096KiB 的 bin。

异常
rmm::logic_error如果 upstream_resource 为 nullptr
参数
upstream_resource用于分配 bin 池的上游内存资源。
min_size_exponent最小的以 2 为底的指数 bin 大小。
max_size_exponent最大的以 2 为底的指数 bin 大小。

成员函数文档

◆ add_bin()

template<typename Upstream >
void rmm::mr::binning__memory__resource< Upstream >::add_bin ( std::size_t  allocation_size,
std::optional< device_async_resource_ref bin_resource = std::nullopt 
)
inline

向此资源添加一个 bin 分配器。

如果提供了 bin_resource 则添加,否则构造并添加一个 fixed_size_memory_resource

此 bin 将用于任何小于 allocation_size 且大于下一个更小 bin 的分配大小的分配。

如果已存在指定大小的 bin,则不做任何更改。

此函数不是线程安全的。

参数
allocation_size此 bin 分配的最大大小
bin_resource此 bin 的内存资源

◆ get_upstream_resource()

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

指向上游资源的 device_async_resource_ref

返回
指向上游资源的 device_async_resource_ref

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