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
limiting_resource_adaptor.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/limiting_resource_adaptor_impl.hpp>
10
#include <
rmm/resource_ref.hpp
>
11
12
#include <cuda/memory_resource>
13
14
#include <cstddef>
15
16
RMM_NAMESPACE_BEGIN
17
namespace
mr {
35
class
RMM_EXPORT
limiting_resource_adaptor
36
:
public
cuda::mr::shared_resource<detail::limiting_resource_adaptor_impl> {
37
using
shared_base = cuda::mr::shared_resource<detail::limiting_resource_adaptor_impl>;
38
39
public
:
43
RMM_CONSTEXPR_FRIEND
void
get_property
(
limiting_resource_adaptor
const
&,
44
cuda::mr::device_accessible)
noexcept
45
{
46
}
47
56
limiting_resource_adaptor
(cuda::mr::any_resource<cuda::mr::device_accessible> upstream,
57
std::size_t allocation_limit,
58
std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT);
59
60
~limiting_resource_adaptor
() =
default
;
61
65
[[nodiscard]]
device_async_resource_ref
get_upstream_resource
() const noexcept;
66
76
[[nodiscard]] std::
size_t
get_allocated_bytes
() const;
77
85
[[nodiscard]] std::
size_t
get_allocation_limit
() const;
86
};
87
88
static_assert(cuda::
mr
::resource_with<
limiting_resource_adaptor
, cuda::
mr
::device_accessible>,
89
"limiting_resource_adaptor does not satisfy the cuda::mr::resource concept"
);
90
// end of group
92
}
// namespace mr
93
RMM_NAMESPACE_END
aligned.hpp
rmm::mr::limiting_resource_adaptor::limiting_resource_adaptor
limiting_resource_adaptor(cuda::mr::any_resource< cuda::mr::device_accessible > upstream, std::size_t allocation_limit, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Construct a new limiting resource adaptor using upstream to satisfy allocation requests and limiting ...
rmm::mr::limiting_resource_adaptor::get_upstream_resource
device_async_resource_ref get_upstream_resource() const noexcept
device_async_resource_ref to the upstream resource
rmm::mr::limiting_resource_adaptor::get_property
friend void get_property(limiting_resource_adaptor const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition
limiting_resource_adaptor.hpp:43
rmm::mr::limiting_resource_adaptor::get_allocation_limit
std::size_t get_allocation_limit() const
Query the maximum number of bytes that this allocator is allowed to allocate. This is the limit on th...
rmm::mr::limiting_resource_adaptor::get_allocated_bytes
std::size_t get_allocated_bytes() const
Query the number of bytes that have been allocated. Note that this can not be used to know how large ...
rmm::device_async_resource_ref
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
Alias for a cuda::mr::resource_ref with the property cuda::mr::device_accessible.
Definition
resource_ref.hpp:30
rmm::mr
Memory Resource classes and adaptors.
resource_ref.hpp
Generated by
1.18.0