arena_memory_resource.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
7 #include <rmm/detail/export.hpp>
8 #include <rmm/mr/detail/arena_memory_resource_impl.hpp>
9 #include <rmm/resource_ref.hpp>
10 
11 #include <cuda/memory_resource>
12 
13 #include <cstddef>
14 #include <optional>
15 
16 namespace RMM_NAMESPACE {
17 namespace mr {
63 class RMM_EXPORT arena_memory_resource
64  : public cuda::mr::shared_resource<detail::arena_memory_resource_impl> {
65  using shared_base = cuda::mr::shared_resource<detail::arena_memory_resource_impl>;
66 
67  public:
71  RMM_CONSTEXPR_FRIEND void get_property(arena_memory_resource const&,
72  cuda::mr::device_accessible) noexcept
73  {
74  }
75 
84  explicit arena_memory_resource(cuda::mr::any_resource<cuda::mr::device_accessible> upstream,
85  std::optional<std::size_t> arena_size = std::nullopt,
86  bool dump_log_on_failure = false);
87 
88  ~arena_memory_resource() = default;
89 };
90 
91 static_assert(cuda::mr::resource_with<arena_memory_resource, cuda::mr::device_accessible>,
92  "arena_memory_resource does not satisfy the cuda::mr::resource concept");
93  // end of group
95 } // namespace mr
96 } // namespace RMM_NAMESPACE
A suballocator that emphasizes fragmentation avoidance and scalable concurrency support.
Definition: arena_memory_resource.hpp:64
friend void get_property(arena_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: arena_memory_resource.hpp:71
arena_memory_resource(cuda::mr::any_resource< cuda::mr::device_accessible > upstream, std::optional< std::size_t > arena_size=std::nullopt, bool dump_log_on_failure=false)
Construct an arena_memory_resource.