一个使用 cudaMallocHost
分配 固定/页锁定 主机内存的 host_memory_resource
。 更多...
#include <pinned_memory_resource.hpp>
公有成员函数 | |
pinned_memory_resource (pinned_memory_resource const &)=default | |
默认拷贝构造函数。 | |
pinned_memory_resource (pinned_memory_resource &&)=default | |
默认移动构造函数。 | |
pinned_memory_resource & | operator= (pinned_memory_resource const &)=default |
默认拷贝赋值运算符。 更多... | |
pinned_memory_resource & | operator= (pinned_memory_resource &&)=default |
默认移动赋值运算符。 更多... | |
void * | allocate_async (std::size_t bytes, std::size_t alignment, cuda_stream_view) |
假装支持 allocate_async 接口,实际回退到 stream 0。 更多... | |
void * | allocate_async (std::size_t bytes, cuda_stream_view) |
假装支持 allocate_async 接口,实际回退到 stream 0。 更多... | |
void | deallocate_async (void *ptr, std::size_t bytes, std::size_t alignment, cuda_stream_view) |
假装支持 deallocate_async 接口,实际回退到 stream 0。 更多... | |
![]() | |
host_memory_resource (host_memory_resource const &)=default | |
默认拷贝构造函数。 | |
host_memory_resource (host_memory_resource &&) noexcept=default | |
默认移动构造函数。 | |
host_memory_resource & | operator= (host_memory_resource const &)=default |
默认拷贝赋值运算符。 更多... | |
host_memory_resource & | operator= (host_memory_resource &&) noexcept=default |
默认移动赋值运算符。 更多... | |
void * | allocate (std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
在主机上分配至少 bytes 大小的内存。 更多... | |
void | deallocate (void *ptr, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
释放 ptr 指向的内存。 更多... | |
bool | is_equal (host_memory_resource const &other) const noexcept |
将此资源与另一个资源进行比较。 更多... | |
bool | operator== (host_memory_resource const &other) const noexcept |
与另一个 host_memory_resource 的比较运算符。 更多... | |
bool | operator!= (host_memory_resource const &other) const noexcept |
与另一个 host_memory_resource 的比较运算符。 更多... | |
友元 | |
void | get_property (pinned_memory_resource const &, cuda::mr::device_accessible) noexcept |
启用 cuda::mr::device_accessible 属性。 更多... | |
一个使用 cudaMallocHost
分配 固定/页锁定 主机内存的 host_memory_resource
。
参见 https://devblogs.nvidia.com/how-optimize-data-transfers-cuda-cc/
|
inline |
假装支持 allocate_async 接口,实际回退到 stream 0。
rmm::bad_alloc | 当无法在指定的 stream 上分配请求的 bytes 时。 |
bytes | 分配的大小 |
|
inline |
假装支持 allocate_async 接口,实际回退到 stream 0。
rmm::bad_alloc | 当无法在指定的 stream 上分配请求的 bytes 时。 |
bytes | 分配的大小 |
alignment | 分配的预期对齐方式 |
|
inline |
假装支持 deallocate_async 接口,实际回退到 stream 0。
ptr | 待释放的指针 |
bytes | 分配的字节大小。这必须等于返回 p 的 allocate 调用传递的 bytes 值。 |
alignment | 返回 p 的 allocate 调用传递的对齐方式 |
|
default |
默认移动赋值运算符。
|
default |
默认拷贝赋值运算符。
|
friend |
启用 cuda::mr::device_accessible
属性。
此属性声明 pinned_memory_resource
提供设备可访问内存