20 #include <rmm/detail/cuda_memory_resource.hpp>
21 #include <rmm/detail/export.hpp>
22 #include <rmm/detail/thrust_namespace.h>
26 #include <thrust/device_malloc_allocator.h>
27 #include <thrust/device_ptr.h>
28 #include <thrust/memory.h>
30 namespace RMM_NAMESPACE {
81 using Base = thrust::device_malloc_allocator<T>;
90 using size_type =
typename Base::size_type;
117 : _stream{stream}, _mr(mr)
127 template <
typename U>
129 : _mr(other.resource()), _stream{other.stream()}, _device{other._device}
151 return thrust::device_pointer_cast(
152 static_cast<T*
>(_mr.allocate_async(num *
sizeof(T), _stream)));
161 return _mr.deallocate_async(thrust::raw_pointer_cast(ptr), num *
sizeof(T), _stream);
定义: cuda_stream_view.hpp:39
rmm::mr::thrust_allocator
与使用 device_async_resource_ref 进行内存分配的 Thrust 容器和算法兼容的分配器...
定义: thrust_allocator_adaptor.hpp:51
rmm::mr::thrust_allocator::thrust_allocator
使用设备内存资源和流构造 thrust_allocator。
定义: thrust_allocator_adaptor.hpp:89
rmm::mr::thrust_allocator::pointer
指针类型。
定义: thrust_allocator_adaptor.hpp:54
thrust_allocator(thrust_allocator< U > const &other)
定义: thrust_allocator_adaptor.hpp:100
rmm::mr::thrust_allocator::allocate
pointer allocate(size_type num)
定义: thrust_allocator_adaptor.hpp:111
rmm::mr::thrust_allocator::stream
cuda_stream_view stream() const noexcept
此分配器使用的流。
定义: thrust_allocator_adaptor.hpp:142
rmm::mr::thrust_allocator::get_upstream_resource
定义: thrust_allocator_adaptor.hpp:134
thrust_allocator()=default
默认构造函数使用默认内存资源和默认流创建分配器。
typename Base::size_type size_type
大小类型。
定义: thrust_allocator_adaptor.hpp:55
thrust::device_malloc_allocator< T > Base
此分配器的基类型。
定义: thrust_allocator_adaptor.hpp:53
friend void get_property(thrust_allocator const &, cuda::mr::device_accessible) noexcept
rmm::mr::thrust_allocator::deallocate
void deallocate(pointer ptr, size_type num)
定义: thrust_allocator_adaptor.hpp:125
thrust_allocator(cuda_stream_view stream)