20 #include <rmm/detail/export.hpp>
27 namespace RMM_NAMESPACE {
76 : mr_{other.get_upstream_resource()}
90 get_upstream_resource().allocate_async(num *
sizeof(T), stream));
105 get_upstream_resource().deallocate_async(ptr, num *
sizeof(T), stream);
132 template <
typename T,
typename U>
150 template <
typename T,
typename U>
153 return not(lhs == rhs);
178 template <
typename Allocator>
182 typename std::allocator_traits<Allocator>::value_type;
197 : alloc_{allocator}, stream_{stream}
209 template <
typename OtherAllocator>
220 template <
typename T>
223 Allocator>::template rebind_alloc<T>>;
272 template <
typename A,
typename O>
289 template <
typename A,
typename O>
292 return not(lhs == rhs);
CUDA 流的强类型非拥有包装器,带有默认构造函数。
定义: cuda_stream_view.hpp:39
使用 rmm::mr::device_memory_resource 满足(解除)分配的流有序分配器。
定义: polymorphic_allocator.hpp:49
T value_type
T,此分配器分配的对象的类型。
定义: polymorphic_allocator.hpp:51
rmm::device_async_resource_ref get_upstream_resource() const noexcept
rmm::device_async_resource_ref 到上游资源。
定义: polymorphic_allocator.hpp:111
polymorphic_allocator()=default
使用 rmm::mr::get_current_device_resource_ref(...) 的返回值构造一个 polymorphic_allocator。
void deallocate(value_type *ptr, std::size_t num, cuda_stream_view stream)
解除分配 ptr 指向的存储。
定义: polymorphic_allocator.hpp:103
value_type * allocate(std::size_t num, cuda_stream_view stream)
使用底层内存资源为 num 个类型为 T 的对象分配存储。
定义: polymorphic_allocator.hpp:87
polymorphic_allocator(device_async_resource_ref mr)
使用提供的内存资源构造一个 polymorphic_allocator。
定义: polymorphic_allocator.hpp:66
polymorphic_allocator(polymorphic_allocator< U > const &other) noexcept
使用 other 的底层内存资源构造一个 polymorphic_allocator。
定义: polymorphic_allocator.hpp:75
使流有序分配器适应,以提供标准分配器接口。
定义: polymorphic_allocator.hpp:179
value_type * allocate(std::size_t num)
使用 stream() 上的底层分配器为 num 个类型为 T 的对象分配存储。
定义: polymorphic_allocator.hpp:233
typename std::allocator_traits< Allocator >::value_type value_type
定义: polymorphic_allocator.hpp:183
void deallocate(value_type *ptr, std::size_t num)
使用 stream() 上的底层分配器解除分配 ptr 指向的存储。
定义: polymorphic_allocator.hpp:244
Allocator underlying_allocator() const noexcept
底层分配器。
定义: polymorphic_allocator.hpp:254
stream_allocator_adaptor(Allocator const &allocator, cuda_stream_view stream)
使用 a 作为底层分配器构造一个 stream_allocator_adaptor。
定义: polymorphic_allocator.hpp:196
stream_allocator_adaptor(stream_allocator_adaptor< OtherAllocator > const &other)
使用 other.underlying_allocator() 和 other... 构造一个 stream_allocator_adaptor。
定义: polymorphic_allocator.hpp:210
cuda_stream_view stream() const noexcept
调用底层分配器所使用的流。
定义: polymorphic_allocator.hpp:249
bool operator==(stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs)
比较两个 stream_allocator_adaptor 是否相等。
定义: polymorphic_allocator.hpp:273
bool operator!=(stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs)
比较两个 stream_allocator_adaptor 是否不相等。
定义: polymorphic_allocator.hpp:290
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
带有 cuda::mr::device_accessible 属性的 cuda::mr::async_resource_ref 的别名。
定义: resource_ref.hpp:40
device_async_resource_ref get_current_device_resource_ref()
获取当前设备的 device_async_resource_ref。
定义: per_device_resource.hpp:411
每设备 device_memory_resource 的管理。
将分配器重新绑定到指定的类型。
定义: polymorphic_allocator.hpp:221