7 #include <rmm/detail/export.hpp>
8 #include <rmm/mr/detail/tracking_resource_adaptor_impl.hpp>
11 #include <cuda/memory_resource>
18 namespace RMM_NAMESPACE {
35 :
public cuda::mr::shared_resource<detail::tracking_resource_adaptor_impl> {
36 using shared_base = cuda::mr::shared_resource<detail::tracking_resource_adaptor_impl>;
42 using read_lock_t = detail::tracking_resource_adaptor_impl::read_lock_t;
44 using write_lock_t = detail::tracking_resource_adaptor_impl::write_lock_t;
50 cuda::mr::device_accessible) noexcept
61 bool capture_stacks =
false);
75 [[nodiscard]] std::map<
void*,
allocation_info> const& get_outstanding_allocations()
83 [[nodiscard]] std::
size_t get_allocated_bytes() const noexcept;
90 [[nodiscard]] std::
string get_outstanding_allocations_str() const;
95 void log_outstanding_allocations() const;
Resource that uses an upstream resource to allocate memory and tracks allocations.
Definition: tracking_resource_adaptor.hpp:35
detail::tracking_resource_adaptor_impl::allocation_info allocation_info
Allocation info type (pointer, size, optional stack trace).
Definition: tracking_resource_adaptor.hpp:40
device_async_resource_ref get_upstream_resource() const noexcept
rmm::device_async_resource_ref to the upstream resource
detail::tracking_resource_adaptor_impl::read_lock_t read_lock_t
Shared-reader lock type used to protect the allocations map.
Definition: tracking_resource_adaptor.hpp:42
friend void get_property(tracking_resource_adaptor const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: tracking_resource_adaptor.hpp:49
detail::tracking_resource_adaptor_impl::write_lock_t write_lock_t
Exclusive-writer lock type used to protect the allocations map.
Definition: tracking_resource_adaptor.hpp:44
tracking_resource_adaptor(cuda::mr::any_resource< cuda::mr::device_accessible > upstream, bool capture_stacks=false)
Construct a tracking resource adaptor using upstream to satisfy allocation requests.
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