7 #include <rmm/detail/cuda_memory_resource.hpp>
8 #include <rmm/detail/export.hpp>
9 #include <rmm/detail/nvtx/ranges.hpp>
14 namespace RMM_NAMESPACE {
59 #ifdef RMM_ENABLE_LEGACY_MR_INTERFACE
72 void* allocate(std::size_t bytes, std::size_t alignment =
alignof(std::max_align_t))
75 return do_allocate(bytes, alignment);
91 void deallocate(
void* ptr,
93 std::size_t alignment =
alignof(std::max_align_t)) noexcept
96 do_deallocate(ptr, bytes, alignment);
112 void*
allocate_sync(std::size_t bytes, std::size_t alignment =
alignof(std::max_align_t))
115 return do_allocate(bytes, alignment);
133 std::size_t alignment =
alignof(std::max_align_t)) noexcept
136 do_deallocate(ptr, bytes, alignment);
153 return do_is_equal(other);
165 return do_is_equal(other);
177 return !do_is_equal(other);
200 virtual void* do_allocate(std::size_t bytes,
201 std::size_t alignment =
alignof(std::max_align_t)) = 0;
216 virtual void do_deallocate(
void* ptr,
218 std::size_t alignment =
alignof(std::max_align_t)) noexcept = 0;
234 return this == &other;
240 rmm::detail::polyfill::resource_with<host_memory_resource, cuda::mr::host_accessible>);
Base class for host memory allocation.
Definition: host_memory_resource.hpp:48
bool is_equal(host_memory_resource const &other) const noexcept
Compare this resource to another.
Definition: host_memory_resource.hpp:151
void * allocate_sync(std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
Allocates memory on the host of size at least bytes bytes.
Definition: host_memory_resource.hpp:112
host_memory_resource(host_memory_resource &&) noexcept=default
Default move constructor.
host_memory_resource(host_memory_resource const &)=default
Default copy constructor.
bool operator==(host_memory_resource const &other) const noexcept
Comparison operator with another host_memory_resource.
Definition: host_memory_resource.hpp:163
friend void get_property(host_memory_resource const &, cuda::mr::host_accessible) noexcept
Enables the cuda::mr::host_accessible property.
Definition: host_memory_resource.hpp:185
void deallocate_sync(void *ptr, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) noexcept
Deallocate memory pointed to by ptr.
Definition: host_memory_resource.hpp:131
bool operator!=(host_memory_resource const &other) const noexcept
Comparison operator with another host_memory_resource.
Definition: host_memory_resource.hpp:175