Home
librmm
libucxx
ucxx
nightly (26.12)
nightly (26.12)
stable (26.10)
legacy (26.08)
Toggle main menu visibility
Loading...
Searching...
No Matches
include
rmm
mr
cuda_async_view_memory_resource.hpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
* SPDX-License-Identifier: Apache-2.0
4
*/
5
#pragma once
6
7
#include <
rmm/aligned.hpp
>
8
#include <rmm/detail/export.hpp>
9
10
#include <cuda/memory_resource>
11
#include <cuda/stream>
12
#include <cuda_runtime_api.h>
13
14
#include <cstddef>
15
16
RMM_NAMESPACE_BEGIN
17
namespace
mr {
23
28
class
RMM_EXPORT
cuda_async_view_memory_resource
final {
29
public
:
40
cuda_async_view_memory_resource
(cudaMemPool_t
pool_handle
);
41
47
[[nodiscard]] cudaMemPool_t
pool_handle
() const noexcept;
48
49
cuda_async_view_memory_resource
() = default;
50
~
cuda_async_view_memory_resource
() = default;
51
cuda_async_view_memory_resource
(
cuda_async_view_memory_resource
const&) =
52
default;
53
cuda_async_view_memory_resource
(
cuda_async_view_memory_resource
&&) =
54
default;
55
cuda_async_view_memory_resource
& operator=(
cuda_async_view_memory_resource
const&) =
56
default;
57
cuda_async_view_memory_resource
& operator=(
cuda_async_view_memory_resource
&&) =
58
default;
59
70
[[nodiscard]]
void
*
allocate
(cuda::stream_ref stream,
71
std::
size_t
bytes,
72
std::
size_t
alignment =
rmm
::CUDA_ALLOCATION_ALIGNMENT);
73
83
void
deallocate
(cuda::stream_ref stream,
84
void
* ptr,
85
std::
size_t
bytes,
86
std::
size_t
alignment =
rmm
::CUDA_ALLOCATION_ALIGNMENT) noexcept;
87
95
[[nodiscard]]
void
*
allocate_sync
(std::
size_t
bytes,
96
std::
size_t
alignment =
rmm
::CUDA_ALLOCATION_ALIGNMENT);
97
105
void
deallocate_sync
(
void
* ptr,
106
std::
size_t
bytes,
107
std::
size_t
alignment =
rmm
::CUDA_ALLOCATION_ALIGNMENT) noexcept;
108
116
[[nodiscard]]
bool
operator==(
cuda_async_view_memory_resource
const& other) const noexcept;
117
121
[[nodiscard]]
bool
operator!=(
cuda_async_view_memory_resource
const& other) const noexcept;
122
129
RMM_CONSTEXPR_FRIEND
void
get_property
(
cuda_async_view_memory_resource
const&,
130
cuda::
mr
::device_accessible) noexcept
131
{
132
}
133
134
private
:
135
cudaMemPool_t cuda_pool_handle_{};
136
};
137
138
// static property checks
139
static_assert
(cuda::mr::synchronous_resource<cuda_async_view_memory_resource>);
140
static_assert
(cuda::mr::resource<cuda_async_view_memory_resource>);
141
static_assert
(cuda::mr::synchronous_resource_with<cuda_async_view_memory_resource,
142
cuda::mr::device_accessible>);
143
static_assert
(
144
cuda::mr::resource_with<cuda_async_view_memory_resource, cuda::mr::device_accessible>);
145
// end of group
147
}
// namespace mr
148
RMM_NAMESPACE_END
aligned.hpp
rmm::mr::cuda_async_view_memory_resource::allocate_sync
void * allocate_sync(std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes synchronously.
rmm::mr::cuda_async_view_memory_resource::deallocate_sync
void deallocate_sync(void *ptr, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr synchronously.
rmm::mr::cuda_async_view_memory_resource::pool_handle
cudaMemPool_t pool_handle() const noexcept
Returns the underlying native handle to the CUDA pool.
rmm::mr::cuda_async_view_memory_resource::cuda_async_view_memory_resource
cuda_async_view_memory_resource(cudaMemPool_t pool_handle)
Constructs a cuda_async_view_memory_resource which uses an existing CUDA memory pool....
rmm::mr::cuda_async_view_memory_resource::allocate
void * allocate(cuda::stream_ref stream, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes.
rmm::mr::cuda_async_view_memory_resource::get_property
friend void get_property(cuda_async_view_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition
cuda_async_view_memory_resource.hpp:129
rmm::mr::cuda_async_view_memory_resource::deallocate
void deallocate(cuda::stream_ref stream, void *ptr, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr.
rmm::mr
Memory Resource classes and adaptors.
rmm
The top-level namespace containing all RMM functionality.
Generated by
1.18.0