18 #include <rmm/cuda_stream_view.hpp>
19 #include <rmm/detail/aligned.hpp>
108 return do_allocate(rmm::detail::align_up(bytes, allocation_size_alignment), stream);
131 do_deallocate(ptr, rmm::detail::align_up(bytes, allocation_size_alignment), stream);
149 return do_is_equal(other);
177 return do_get_mem_info(stream);
182 static constexpr
auto allocation_size_alignment = std::size_t{8};
209 virtual void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream) = 0;
225 [[nodiscard]]
virtual bool do_is_equal(device_memory_resource
const& other)
const noexcept
227 return this == &other;
238 [[nodiscard]]
virtual std::pair<std::size_t, std::size_t> do_get_mem_info(
239 cuda_stream_view stream)
const = 0;
virtual bool supports_streams() const noexcept=0
Query whether the resource supports use of non-null CUDA streams for allocation/deallocation.
void * allocate(std::size_t bytes, cuda_stream_view stream=cuda_stream_view{})
Allocates memory of size at least bytes.
Definition: device_memory_resource.hpp:106
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:34
void deallocate(void *ptr, std::size_t bytes, cuda_stream_view stream=cuda_stream_view{})
Deallocate memory pointed to by p.
Definition: device_memory_resource.hpp:129
bool is_equal(device_memory_resource const &other) const noexcept
Compare this resource to another.
Definition: device_memory_resource.hpp:147
virtual bool supports_get_mem_info() const noexcept=0
Query whether the resource supports the get_mem_info API.
std::pair< std::size_t, std::size_t > get_mem_info(cuda_stream_view stream) const
Queries the amount of free and total memory for the resource.
Definition: device_memory_resource.hpp:175
Base class for all libcudf device memory allocation.
Definition: device_memory_resource.hpp:82