8 #include <rmm/detail/error.hpp>
9 #include <rmm/detail/export.hpp>
10 #include <rmm/mr/detail/failure_callback_resource_adaptor_impl.hpp>
13 #include <cuda/memory_resource>
18 namespace RMM_NAMESPACE {
42 template <
typename ExceptionType = rmm::out_of_memory>
44 :
public cuda::mr::shared_resource<
45 detail::failure_callback_resource_adaptor_impl<ExceptionType>> {
47 cuda::mr::shared_resource<detail::failure_callback_resource_adaptor_impl<ExceptionType>>;
56 cuda::mr::device_accessible) noexcept
71 : shared_base(cuda::mr::make_shared_resource<
72 detail::failure_callback_resource_adaptor_impl<ExceptionType>>(
73 std::move(upstream), std::move(callback), callback_arg))
84 return this->get().get_upstream_resource();
89 cuda::mr::resource_with<failure_callback_resource_adaptor<>, cuda::mr::device_accessible>,
90 "failure_callback_resource_adaptor does not satisfy the cuda::mr::resource concept");
A device memory resource that calls a callback function when allocations throw a specified exception ...
Definition: failure_callback_resource_adaptor.hpp:45
failure_callback_resource_adaptor(cuda::mr::any_resource< cuda::mr::device_accessible > upstream, failure_callback_t callback, void *callback_arg)
Construct a new failure_callback_resource_adaptor using upstream to satisfy allocation requests.
Definition: failure_callback_resource_adaptor.hpp:68
ExceptionType exception_type
The type of exception this object catches/throws.
Definition: failure_callback_resource_adaptor.hpp:50
device_async_resource_ref get_upstream_resource() const noexcept
rmm::device_async_resource_ref to the upstream resource
Definition: failure_callback_resource_adaptor.hpp:82
friend void get_property(failure_callback_resource_adaptor const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: failure_callback_resource_adaptor.hpp:55
std::function< bool(std::size_t, void *)> failure_callback_t
Callback function type used by failure_callback_resource_adaptor.
Definition: failure_callback_t.hpp:34
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