Memory Resource Management#
- group Memory Resource Management
Functions
- inline rmm::device_async_resource_ref get_current_device_resource_ref(
Get the current device memory resource reference.
- Returns:
The current device memory resource reference.
- inline cuda::mr::any_resource<cuda::mr::device_accessible> set_current_device_resource(
- cuda::mr::any_resource<cuda::mr::device_accessible> mr
Set the current device memory resource.
- Parameters:
mr – The new device memory resource.
- Returns:
An owning any_resource holding the previous resource.
- inline cuda::mr::any_resource<cuda::mr::device_accessible> set_current_device_resource_ref( )#
Set the current device memory resource reference.
- Deprecated:
Use
set_current_device_resourceinstead.
The object referenced by
mrmust outlive the last use of the resource, otherwise behavior is undefined. It is the caller’s responsibility to maintain the lifetime of the resource object.- Parameters:
mr – The new device memory resource reference.
- Returns:
An owning any_resource holding the previous resource.
- inline cuda::mr::any_resource<cuda::mr::device_accessible> reset_current_device_resource(
Reset the current device memory resource to the initial resource.
- Returns:
An owning any_resource holding the previous resource.
- inline cuda::mr::any_resource<cuda::mr::device_accessible> reset_current_device_resource_ref(
Reset the current device memory resource reference to the initial resource.
- Deprecated:
Use
reset_current_device_resourceinstead.
- Returns:
An owning any_resource holding the previous resource.
-
class memory_resources#
- #include <cudf/utilities/memory_resource.hpp>
Non-owning references to the memory resources used by a cuDF operation.
The output resource allocates memory returned to the caller. The temporary resource allocates intermediate memory that is released before the operation returns. If allocations are made from a resource ref, callers must construct an owning resource from the resource ref, keep that owning resource alive for the allocation’s lifetime, and use it for deallocation.
Public Functions
-
template<typename Resource>
inline memory_resources( - Resource &&output_mr
Construct with an explicit output resource and capture the current resource for temporaries.
This constructor is intentionally implicit so an existing resource object or resource ref can be passed directly to an API accepting
memory_resources.- Template Parameters:
Resource – Type that can construct a device asynchronous resource ref
- Parameters:
output_mr – Resource used for returned allocations
-
template<typename OutputResource, typename TemporaryResource>
inline memory_resources( - OutputResource &&output_mr,
- TemporaryResource &&temporary_mr
Construct with explicit output and temporary resources.
This constructor does not query the current device resource.
- Template Parameters:
OutputResource – Type that can construct the output resource ref
TemporaryResource – Type that can construct the temporary resource ref
- Parameters:
output_mr – Resource used for returned allocations
temporary_mr – Resource used for intermediate allocations
-
inline rmm::device_async_resource_ref get_output_mr() const noexcept#
Return the resource used for allocations returned to the caller.
- Returns:
Output device memory resource reference
- inline rmm::device_async_resource_ref get_temporary_mr(
Return the resource used for intermediate allocations.
- Returns:
Temporary device memory resource reference
-
template<typename Resource>