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_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
#include <rmm/mr/detail/cuda_async_memory_resource_impl.hpp>
10
11
#include <cuda/memory_resource>
12
#include <cuda_runtime_api.h>
13
14
#include <cstddef>
15
#include <cstdint>
16
#include <optional>
17
18
RMM_NAMESPACE_BEGIN
19
namespace
mr {
25
30
class
RMM_EXPORT
cuda_async_memory_resource
final
31
:
public
cuda::mr::shared_resource<detail::cuda_async_memory_resource_impl> {
32
using
shared_base = cuda::mr::shared_resource<detail::cuda_async_memory_resource_impl>;
33
34
public
:
47
enum class
allocation_handle_type
: std::int32_t {
48
none = cudaMemHandleTypeNone,
49
posix_file_descriptor =
50
cudaMemHandleTypePosixFileDescriptor,
52
win32 =
53
cudaMemHandleTypeWin32,
54
win32_kmt = cudaMemHandleTypeWin32Kmt,
56
fabric = 0x8
57
};
58
62
RMM_CONSTEXPR_FRIEND
void
get_property
(
cuda_async_memory_resource
const
&,
63
cuda::mr::device_accessible)
noexcept
64
{
65
}
66
86
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
87
cuda_async_memory_resource
(std::optional<std::size_t> initial_pool_size = {},
88
std::optional<std::size_t> release_threshold = {},
89
std::optional<allocation_handle_type> export_handle_type = {});
90
96
[[nodiscard]] cudaMemPool_t
pool_handle
() const noexcept;
97
98
~
cuda_async_memory_resource
() = default;
99
cuda_async_memory_resource
(
cuda_async_memory_resource
const&) =
100
default;
101
cuda_async_memory_resource
(
cuda_async_memory_resource
&&) =
102
default;
103
cuda_async_memory_resource
& operator=(
cuda_async_memory_resource
const&) =
104
default;
105
cuda_async_memory_resource
& operator=(
cuda_async_memory_resource
&&) =
106
default;
107
};
108
109
// static property checks
110
static_assert(cuda::
mr
::synchronous_resource<
cuda_async_memory_resource
>);
111
static_assert(cuda::
mr
::resource<
cuda_async_memory_resource
>);
112
static_assert(
113
cuda::
mr
::synchronous_resource_with<
cuda_async_memory_resource
, cuda::
mr
::device_accessible>);
114
static_assert(cuda::
mr
::resource_with<
cuda_async_memory_resource
, cuda::
mr
::device_accessible>);
115
// end of group
117
}
// namespace mr
118
RMM_NAMESPACE_END
aligned.hpp
rmm::mr::cuda_async_memory_resource::allocation_handle_type
allocation_handle_type
Flags for specifying memory allocation handle types.
Definition
cuda_async_memory_resource.hpp:47
rmm::mr::cuda_async_memory_resource::get_property
friend void get_property(cuda_async_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition
cuda_async_memory_resource.hpp:62
rmm::mr::cuda_async_memory_resource::cuda_async_memory_resource
cuda_async_memory_resource(std::optional< std::size_t > initial_pool_size={}, std::optional< std::size_t > release_threshold={}, std::optional< allocation_handle_type > export_handle_type={})
Constructs a cuda_async_memory_resource with the optionally specified initial pool size and release t...
rmm::mr::cuda_async_memory_resource::pool_handle
cudaMemPool_t pool_handle() const noexcept
Returns the underlying native handle to the CUDA pool.
rmm::mr
Memory Resource classes and adaptors.
Generated by
1.18.0