20 #include <rmm/detail/export.hpp>
110 static std::map<cuda_device_id::value_type, device_memory_resource*> device_id_to_resource;
111 return device_id_to_resource;
139 std::lock_guard<std::mutex> lock{detail::map_lock()};
140 auto& map = detail::get_map();
142 auto const found = map.find(device_id.
value());
143 return (found == map.end()) ? (map[device_id.
value()] = detail::initial_resource())
177 std::lock_guard<std::mutex> lock{detail::map_lock()};
178 auto& map = detail::get_map();
179 auto const old_itr = map.find(device_id.
value());
181 auto* old_mr = (old_itr == map.end()) ? detail::initial_resource() : old_itr->second;
182 map[device_id.
value()] = (new_mr ==
nullptr) ? detail::initial_resource() : new_mr;
device_memory_resource derived class that uses cudaMalloc/Free for allocation/deallocation.
Definition: cuda_memory_resource.hpp:35
Base class for all libcudf device memory allocation.
Definition: device_memory_resource.hpp:89
cuda_device_id get_current_cuda_device()
Returns a cuda_device_id for the current device.
Definition: cuda_device.hpp:86
device_memory_resource * set_current_device_resource(device_memory_resource *new_mr)
Set the memory resource for the current device.
Definition: per_device_resource.hpp:236
device_memory_resource * get_current_device_resource()
Get the memory resource for the current device.
Definition: per_device_resource.hpp:207
device_memory_resource * set_per_device_resource(cuda_device_id device_id, device_memory_resource *new_mr)
Set the device_memory_resource for the specified device.
Definition: per_device_resource.hpp:174
device_memory_resource * get_per_device_resource(cuda_device_id device_id)
Get the resource for the specified device.
Definition: per_device_resource.hpp:137
std::mutex & map_lock()
Reference to the lock.
Definition: per_device_resource.hpp:98
device_memory_resource * initial_resource()
Returns a pointer to the initial resource.
Definition: per_device_resource.hpp:89
RMM_EXPORT auto & get_map()
Reference to the map from device id -> resource.
Definition: per_device_resource.hpp:108
Strong type for a CUDA device identifier.
Definition: cuda_device.hpp:33
constexpr value_type value() const noexcept
The wrapped integer value.
Definition: cuda_device.hpp:44