Namespaces | Functions
per_device_resource.hpp File Reference

Management of per-device memory resources. More...

#include <rmm/cuda_device.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/detail/runtime_shutdown.hpp>
#include <rmm/mr/cuda_memory_resource.hpp>
#include <rmm/resource_ref.hpp>
#include <cuda/memory_resource>
#include <map>
#include <mutex>
#include <utility>
Include dependency graph for per_device_resource.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 rmm
 RAPIDS Memory Manager - The top-level namespace for all RMM functionality.
 
 rmm::mr
 Memory Resource classes and adaptors.
 

Functions

cuda_memory_resource & rmm::mr::detail::initial_resource ()
 Returns a reference to the initial resource. More...
 
std::mutex & rmm::mr::detail::ref_map_lock ()
 Reference to the lock. More...
 
auto & rmm::mr::detail::get_ref_map ()
 Reference to the map from device id -> any_resource. More...
 
device_async_resource_ref rmm::mr::get_per_device_resource_ref (cuda_device_id device_id)
 Get the device_async_resource_ref for the specified device. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::set_per_device_resource (cuda_device_id device_id, cuda::mr::any_resource< cuda::mr::device_accessible > new_resource)
 Set the memory resource for the specified device. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::set_per_device_resource_ref (cuda_device_id device_id, device_async_resource_ref new_resource_ref)
 Set the device_async_resource_ref for the specified device to new_resource_ref More...
 
device_async_resource_ref rmm::mr::get_current_device_resource_ref ()
 Get the device_async_resource_ref for the current device. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::set_current_device_resource (cuda::mr::any_resource< cuda::mr::device_accessible > new_resource)
 Set the memory resource for the current device. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::set_current_device_resource_ref (device_async_resource_ref new_resource_ref)
 Set the device_async_resource_ref for the current device. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::reset_per_device_resource (cuda_device_id device_id)
 Reset the memory resource for the specified device to the initial resource. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::reset_current_device_resource ()
 Reset the memory resource for the current device to the initial resource. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::reset_per_device_resource_ref (cuda_device_id device_id)
 Reset the device_async_resource_ref for the specified device to the initial resource. More...
 
cuda::mr::any_resource< cuda::mr::device_accessible > rmm::mr::reset_current_device_resource_ref ()
 Reset the device_async_resource_ref for the current device to the initial resource. More...
 

Detailed Description

Management of per-device memory resources.

Provides functions to get/set the default device_async_resource_ref for each CUDA device. The initial resource for each device is a cuda_memory_resource.

Note
Memory resources make CUDA API calls without setting the current CUDA device. Therefore a memory resource should only be used with the current CUDA device set to the device that was active when the memory resource was created.

Function Documentation

◆ get_ref_map()

auto& rmm::mr::detail::get_ref_map ( )
inline

Reference to the map from device id -> any_resource.

Returns
Reference to the map from device id -> any_resource

◆ initial_resource()

cuda_memory_resource& rmm::mr::detail::initial_resource ( )
inline

Returns a reference to the initial resource.

Returns a global instance of a cuda_memory_resource as a function local static.

Returns
Reference to the static cuda_memory_resource used as the initial, default resource

◆ ref_map_lock()

std::mutex& rmm::mr::detail::ref_map_lock ( )
inline

Reference to the lock.

Returns
Reference to the lock