A device memory resource that calls a callback function when allocations throw a specified exception type. More...
#include <failure_callback_resource_adaptor.hpp>


Public Types | |
| using | exception_type = ExceptionType |
| The type of exception this object catches/throws. | |
Public Member Functions | |
| 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. More... | |
| device_async_resource_ref | get_upstream_resource () const noexcept |
| rmm::device_async_resource_ref to the upstream resource More... | |
Friends | |
| void | get_property (failure_callback_resource_adaptor const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::device_accessible property. | |
A device memory resource that calls a callback function when allocations throw a specified exception type.
An instance of this resource must be constructed with an existing, upstream resource in order to satisfy allocation requests.
The callback function takes an allocation size and a callback argument and returns a bool representing whether to retry the allocation (true) or re-throw the caught exception (false).
This class is copyable and shares ownership of its internal state via cuda::mr::shared_resource.
| ExceptionType | The type of exception that this adaptor should respond to |
|
inline |
Construct a new failure_callback_resource_adaptor using upstream to satisfy allocation requests.
| upstream | The resource used for allocating/deallocating device memory |
| callback | Callback function |
| callback_arg | Extra argument passed to callback |
|
inlinenoexcept |
rmm::device_async_resource_ref to the upstream resource