20 #include <rmm/detail/export.hpp>
26 #include <type_traits>
28 namespace RMM_NAMESPACE {
77 : mr_{other.get_upstream_resource()}
91 get_upstream_resource().allocate_async(num *
sizeof(T), stream));
106 get_upstream_resource().deallocate_async(ptr, num *
sizeof(T), stream);
133 template <
typename T,
typename U>
151 template <
typename T,
typename U>
154 return not(lhs == rhs);
179 template <
typename Allocator>
183 typename std::allocator_traits<Allocator>::value_type;
198 : alloc_{allocator}, stream_{stream}
210 template <
typename OtherAllocator>
221 template <
typename T>
224 Allocator>::template rebind_alloc<T>>;
273 template <
typename A,
typename O>
290 template <
typename A,
typename O>
293 return not(lhs == rhs);
306 template <
typename Allocator>
308 "make_stream_allocator_adaptor is deprecated in RMM 24.10. Use the stream_allocator_adaptor "
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:41
A stream ordered Allocator using a rmm::mr::device_memory_resource to satisfy (de)allocations.
Definition: polymorphic_allocator.hpp:50
T value_type
T, the value type of objects allocated by this allocator.
Definition: polymorphic_allocator.hpp:52
rmm::device_async_resource_ref get_upstream_resource() const noexcept
rmm::device_async_resource_ref to the upstream resource
Definition: polymorphic_allocator.hpp:112
polymorphic_allocator()=default
Construct a polymorphic_allocator using the return value of rmm::mr::get_current_device_resource_ref(...
void deallocate(value_type *ptr, std::size_t num, cuda_stream_view stream)
Deallocates storage pointed to by ptr.
Definition: polymorphic_allocator.hpp:104
value_type * allocate(std::size_t num, cuda_stream_view stream)
Allocates storage for num objects of type T using the underlying memory resource.
Definition: polymorphic_allocator.hpp:88
polymorphic_allocator(device_async_resource_ref mr)
Construct a polymorphic_allocator using the provided memory resource.
Definition: polymorphic_allocator.hpp:67
polymorphic_allocator(polymorphic_allocator< U > const &other) noexcept
Construct a polymorphic_allocator using the underlying memory resource of other.
Definition: polymorphic_allocator.hpp:76
Adapts a stream ordered allocator to provide a standard Allocator interface.
Definition: polymorphic_allocator.hpp:180
value_type * allocate(std::size_t num)
Allocates storage for num objects of type T using the underlying allocator on stream().
Definition: polymorphic_allocator.hpp:234
typename std::allocator_traits< Allocator >::value_type value_type
Definition: polymorphic_allocator.hpp:184
void deallocate(value_type *ptr, std::size_t num)
Deallocates storage pointed to by ptr using the underlying allocator on stream().
Definition: polymorphic_allocator.hpp:245
Allocator underlying_allocator() const noexcept
The underlying allocator.
Definition: polymorphic_allocator.hpp:255
stream_allocator_adaptor(Allocator const &allocator, cuda_stream_view stream)
Construct a stream_allocator_adaptor using a as the underlying allocator.
Definition: polymorphic_allocator.hpp:197
stream_allocator_adaptor(stream_allocator_adaptor< OtherAllocator > const &other)
Construct a stream_allocator_adaptor using other.underlying_allocator() and other....
Definition: polymorphic_allocator.hpp:211
cuda_stream_view stream() const noexcept
The stream on which calls to the underlying allocator are made.
Definition: polymorphic_allocator.hpp:250
bool operator==(stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs)
Compare two stream_allocator_adaptors for equality.
Definition: polymorphic_allocator.hpp:274
auto make_stream_allocator_adaptor(Allocator const &allocator, cuda_stream_view stream)
Factory to construct a stream_allocator_adaptor from an existing stream-ordered allocator.
Definition: polymorphic_allocator.hpp:311
bool operator!=(stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs)
Compare two stream_allocator_adaptors for inequality.
Definition: polymorphic_allocator.hpp:291
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::device_accessible.
Definition: resource_ref.hpp:41
device_async_resource_ref get_current_device_resource_ref()
Get the device_async_resource_ref for the current device.
Definition: per_device_resource.hpp:411
Management of per-device device_memory_resources.
Rebinds the allocator to the specified type.
Definition: polymorphic_allocator.hpp:222