8 #include <rmm/detail/aligned.hpp>
9 #include <rmm/detail/cccl_adaptors.hpp>
10 #include <rmm/detail/cuda_memory_resource.hpp>
11 #include <rmm/detail/error.hpp>
12 #include <rmm/detail/export.hpp>
13 #include <rmm/detail/nvtx/ranges.hpp>
16 #include <cuda/stream_ref>
17 #include <cuda_runtime_api.h>
21 namespace RMM_NAMESPACE {
66 void* do_allocate(std::size_t bytes, [[maybe_unused]]
cuda_stream_view stream)
override
69 if (0 == bytes) {
return nullptr; }
73 return rmm::detail::aligned_host_allocate(bytes, alignment, [](std::size_t size) {
75 RMM_CUDA_TRY_ALLOC(cudaHostAlloc(&ptr, size, cudaHostAllocDefault), size);
90 void do_deallocate(
void* ptr,
96 rmm::detail::aligned_host_deallocate(
97 ptr, bytes, alignment, [](
void* ptr) { RMM_ASSERT_CUDA_SUCCESS(cudaFreeHost(ptr)); });
110 [[nodiscard]]
bool do_is_equal(device_memory_resource
const& other)
const noexcept
override
112 return dynamic_cast<pinned_host_memory_resource const*
>(&other) !=
nullptr;
134 static_assert(rmm::detail::polyfill::async_resource_with<pinned_host_memory_resource,
135 cuda::mr::device_accessible,
136 cuda::mr::host_accessible>);
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:28
Base class for all librmm device memory allocation.
Definition: device_memory_resource.hpp:83
Memory resource class for allocating pinned host memory.
Definition: pinned_host_memory_resource.hpp:37
pinned_host_memory_resource(pinned_host_memory_resource &&)=default
Default move constructor.
friend void get_property(pinned_host_memory_resource const &, cuda::mr::host_accessible) noexcept
Enables the cuda::mr::host_accessible property.
Definition: pinned_host_memory_resource.hpp:129
pinned_host_memory_resource & operator=(pinned_host_memory_resource &&)=default
Default move assignment operator.
pinned_host_memory_resource(pinned_host_memory_resource const &)=default
Default copy constructor.
friend void get_property(pinned_host_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: pinned_host_memory_resource.hpp:120
pinned_host_memory_resource & operator=(pinned_host_memory_resource const &)=default
Default copy assignment operator.
static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT
Default alignment used for CUDA memory allocation.
Definition: aligned.hpp:31