Classes | |
| class | rmm::mr::arena_memory_resource< Upstream > |
| A suballocator that emphasizes fragmentation avoidance and scalable concurrency support. More... | |
| class | rmm::mr::binning_memory_resource< Upstream > |
| Allocates memory from upstream resources associated with bin sizes. More... | |
| class | rmm::mr::callback_memory_resource |
| A device memory resource that uses the provided callbacks for memory allocation and deallocation. More... | |
| class | rmm::mr::cuda_async_managed_memory_resource |
device_memory_resource derived class that uses cudaMallocFromPoolAsync/cudaFreeFromPoolAsync with a managed memory pool for allocation/deallocation. More... | |
| class | rmm::mr::cuda_async_memory_resource |
device_memory_resource derived class that uses cudaMallocAsync/cudaFreeAsync for allocation/deallocation. More... | |
| class | rmm::mr::cuda_async_view_memory_resource |
device_memory_resource derived class that uses cudaMallocAsync/cudaFreeAsync for allocation/deallocation. More... | |
| class | rmm::mr::cuda_memory_resource |
device_memory_resource derived class that uses cudaMalloc/Free for allocation/deallocation. More... | |
| class | rmm::mr::device_memory_resource |
| Base class for all librmm device memory allocation. More... | |
| class | rmm::mr::fixed_size_memory_resource< Upstream > |
A device_memory_resource which allocates memory blocks of a single fixed size. More... | |
| class | rmm::mr::managed_memory_resource |
device_memory_resource derived class that uses cudaMallocManaged/Free for allocation/deallocation. More... | |
| class | rmm::mr::pinned_host_memory_resource |
| Memory resource class for allocating pinned host memory. More... | |
| class | rmm::mr::polymorphic_allocator< T > |
A stream ordered Allocator using a rmm::mr::device_memory_resource to satisfy (de)allocations. More... | |
| class | rmm::mr::stream_allocator_adaptor< Allocator > |
Adapts a stream ordered allocator to provide a standard Allocator interface. More... | |
| class | rmm::mr::pool_memory_resource< Upstream > |
| A coalescing best-fit suballocator which uses a pool of memory allocated from an upstream memory_resource. More... | |
| class | rmm::mr::sam_headroom_memory_resource |
| Resource that uses system memory resource to allocate memory with a headroom. More... | |
| class | rmm::mr::system_memory_resource |
device_memory_resource derived class that uses malloc/free for allocation/deallocation. More... | |
Typedefs | |
| using | rmm::mr::allocate_callback_t = std::function< void *(std::size_t, cuda_stream_view, void *)> |
| Callback function type used by callback memory resource for allocation. More... | |
| using | rmm::mr::deallocate_callback_t = std::function< void(void *, std::size_t, cuda_stream_view, void *)> |
| Callback function type used by callback_memory_resource for deallocation. More... | |
| using | rmm::device_resource_ref = detail::cccl_resource_ref< cuda::mr::synchronous_resource_ref< cuda::mr::device_accessible > > |
Alias for a cuda::mr::resource_ref with the property cuda::mr::device_accessible. | |
| using | rmm::device_async_resource_ref = detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::device_accessible > > |
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::device_accessible. | |
| using | rmm::host_resource_ref = detail::cccl_resource_ref< cuda::mr::synchronous_resource_ref< cuda::mr::host_accessible > > |
Alias for a cuda::mr::resource_ref with the property cuda::mr::host_accessible. | |
| using | rmm::host_async_resource_ref = detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::host_accessible > > |
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::host_accessible. | |
| using | rmm::host_device_resource_ref = detail::cccl_resource_ref< cuda::mr::synchronous_resource_ref< cuda::mr::host_accessible, cuda::mr::device_accessible > > |
Alias for a cuda::mr::resource_ref with the properties cuda::mr::host_accessible and cuda::mr::device_accessible. | |
| using | rmm::host_device_async_resource_ref = detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::host_accessible, cuda::mr::device_accessible > > |
Alias for a cuda::mr::async_resource_ref with the properties cuda::mr::host_accessible and cuda::mr::device_accessible. | |
Functions | |
| device_memory_resource * | rmm::mr::get_per_device_resource (cuda_device_id device_id) |
| Get the resource for the specified device. More... | |
| device_memory_resource * | rmm::mr::set_per_device_resource (cuda_device_id device_id, device_memory_resource *new_mr) |
Set the device_memory_resource for the specified device. More... | |
| device_memory_resource * | rmm::mr::get_current_device_resource () |
| Get the memory resource for the current device. More... | |
| device_memory_resource * | rmm::mr::set_current_device_resource (device_memory_resource *new_mr) |
| Set the memory resource for the current device. 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... | |
| device_async_resource_ref | 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... | |
| device_async_resource_ref | 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... | |
| device_async_resource_ref | 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... | |
| device_async_resource_ref | rmm::mr::reset_current_device_resource_ref () |
Reset the device_async_resource_ref for the current device to the initial resource. More... | |
| template<typename T , typename U > | |
| bool | rmm::mr::operator== (polymorphic_allocator< T > const &lhs, polymorphic_allocator< U > const &rhs) |
Compare two polymorphic_allocators for equality. More... | |
| template<typename T , typename U > | |
| bool | rmm::mr::operator!= (polymorphic_allocator< T > const &lhs, polymorphic_allocator< U > const &rhs) |
Compare two polymorphic_allocators for inequality. More... | |
| template<typename A , typename O > | |
| bool | rmm::mr::operator== (stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs) |
Compare two stream_allocator_adaptors for equality. More... | |
| template<typename A , typename O > | |
| bool | rmm::mr::operator!= (stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs) |
Compare two stream_allocator_adaptors for inequality. More... | |
| template<class Resource > | |
| device_async_resource_ref | rmm::to_device_async_resource_ref_checked (Resource *res) |
Convert pointer to memory resource into device_async_resource_ref, checking for nullptr More... | |
Variables | |
| template<class Resource , class = void> | |
| constexpr bool | rmm::mr::is_resource_adaptor = false |
Concept to check whether a resource is a resource adaptor by checking for get_upstream_resource. | |
| using rmm::mr::allocate_callback_t = typedef std::function<void*(std::size_t, cuda_stream_view, void*)> |
Callback function type used by callback memory resource for allocation.
The signature of the callback function is: void* allocate_callback_t(std::size_t bytes, cuda_stream_view stream, void* arg);
bytes usable immediately on stream. The stream-ordered behavior requirements are identical to device_memory_resource::allocate.do_allocate but adds the extra function parameter arg. The arg is provided to the constructor of the callback_memory_resource and will be forwarded along to every invocation of the callback function. | using rmm::mr::deallocate_callback_t = typedef std::function<void(void*, std::size_t, cuda_stream_view, void*)> |
Callback function type used by callback_memory_resource for deallocation.
The signature of the callback function is: void deallocate_callback_t(void* ptr, std::size_t bytes, cuda_stream_view stream, void* arg);
ptr. bytes specifies the size of the allocation in bytes, and must equal the value of bytes that was passed to the allocate callback function. The stream-ordered behavior requirements are identical to device_memory_resource::deallocate.do_deallocate but adds the extra function parameter arg. The arg is provided to the constructor of the callback_memory_resource and will be forwarded along to every invocation of the callback function.
|
inline |
Get the memory resource for the current device.
Returns a pointer to the resource set for the current device. The initial resource is a cuda_memory_resource.
The "current device" is the device returned by cudaGetDevice.
This function is thread-safe with respect to concurrent calls to set_per_device_resource, get_per_device_resource, get_current_device_resource, and set_current_device_resource. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
device_memory_resource should only be used with the current CUDA device. Changing the current device (e.g. using cudaSetDevice()) and then using the returned resource can result in undefined behavior. The behavior of a device_memory_resource is undefined if used while the active CUDA device is a different device from the one that was active when the device_memory_resource was created.
|
inline |
Get the device_async_resource_ref for the current device.
Returns the device_async_resource_ref set for the current device. The initial resource_ref references a cuda_memory_resource.
The "current device" is the device returned by cudaGetDevice.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and `reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
device_async_resource_ref should only be used with the current CUDA device. Changing the current device (e.g. using cudaSetDevice()) and then using the returned resource_ref can result in undefined behavior. The behavior of a device_async_resource_ref is undefined if used while the active CUDA device is a different device from the one that was active when the memory resource was created.device_async_resource_ref active for the current device
|
inline |
Get the resource for the specified device.
Returns a pointer to the device_memory_resource for the specified device. The initial resource is a cuda_memory_resource.
device_id.value() must be in the range [0, cudaGetDeviceCount()), otherwise behavior is undefined.
This function is thread-safe with respect to concurrent calls to set_per_device_resource, get_per_device_resource, get_current_device_resource, and set_current_device_resource. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
device_memory_resource should only be used when CUDA device device_id is the current device (e.g. set using cudaSetDevice()). The behavior of a device_memory_resource is undefined if used while the active CUDA device is a different device from the one that was active when the device_memory_resource was created.| device_id | The id of the target device |
device_memory_resource for device device_id
|
inline |
Get the device_async_resource_ref for the specified device.
Returns a device_async_resource_ref for the specified device. The initial resource_ref references a cuda_memory_resource.
device_id.value() must be in the range [0, cudaGetDeviceCount()), otherwise behavior is undefined.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
device_async_resource_ref should only be used when CUDA device device_id is the current device (e.g. set using cudaSetDevice()). The behavior of a device_async_resource_ref is undefined if used while the active CUDA device is a different device from the one that was active when the memory resource was created.| device_id | The id of the target device |
device_async_resource_ref for device device_id | bool rmm::mr::operator!= | ( | polymorphic_allocator< T > const & | lhs, |
| polymorphic_allocator< U > const & | rhs | ||
| ) |
Compare two polymorphic_allocators for inequality.
Two polymorphic_allocators are not equal if their underlying memory resources compare not equal.
| T | Type of the first allocator |
| U | Type of the second allocator |
| lhs | The first allocator to compare |
| rhs | The second allocator to compare |
| bool rmm::mr::operator!= | ( | stream_allocator_adaptor< A > const & | lhs, |
| stream_allocator_adaptor< O > const & | rhs | ||
| ) |
Compare two stream_allocator_adaptors for inequality.
Two stream_allocator_adaptors are not equal if their underlying allocators compare not equal.
| A | Type of the first allocator |
| O | Type of the second allocator |
| lhs | The first allocator to compare |
| rhs | The second allocator to compare |
| bool rmm::mr::operator== | ( | polymorphic_allocator< T > const & | lhs, |
| polymorphic_allocator< U > const & | rhs | ||
| ) |
Compare two polymorphic_allocators for equality.
Two polymorphic_allocators are equal if their underlying memory resources compare equal.
| T | Type of the first allocator |
| U | Type of the second allocator |
| lhs | The first allocator to compare |
| rhs | The second allocator to compare |
| bool rmm::mr::operator== | ( | stream_allocator_adaptor< A > const & | lhs, |
| stream_allocator_adaptor< O > const & | rhs | ||
| ) |
Compare two stream_allocator_adaptors for equality.
Two stream_allocator_adaptors are equal if their underlying allocators compare equal.
| A | Type of the first allocator |
| O | Type of the second allocator |
| lhs | The first allocator to compare |
| rhs | The second allocator to compare |
|
inline |
Reset the device_async_resource_ref for the current device to the initial resource.
Resets to a reference to the initial cuda_memory_resource. The "current device" is the device returned by cudaGetDevice.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and `reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
device_async_resource_ref for device_id
|
inline |
Reset the device_async_resource_ref for the specified device to the initial resource.
Resets to a reference to the initial cuda_memory_resource.
device_id.value() must be in the range [0, cudaGetDeviceCount()), otherwise behavior is undefined.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and `reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
| device_id | The id of the target device |
device_async_resource_ref for device_id
|
inline |
Set the memory resource for the current device.
If new_mr is not nullptr, sets the resource pointer for the current device to new_mr. Otherwise, resets the resource to the initial cuda_memory_resource.
The "current device" is the device returned by cudaGetDevice.
The object pointed to by new_mr must 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.
This function is thread-safe with respect to concurrent calls to set_per_device_resource, get_per_device_resource, get_current_device_resource, and set_current_device_resource. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
new_mr must have been created for the current CUDA device. The behavior of a device_memory_resource is undefined if used while the active CUDA device is a different device from the one that was active when the device_memory_resource was created.| new_mr | If not nullptr, pointer to new resource to use for the current device |
|
inline |
Set the device_async_resource_ref for the current device.
The "current device" is the device returned by cudaGetDevice.
The object referenced by new_resource_ref must 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.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and `reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
new_resource must have been created for the current CUDA device. The behavior of a device_async_resource_ref is undefined if used while the active CUDA device is a different device from the one that was active when the memory resource was created.| new_resource_ref | New device_async_resource_ref to use for the current device |
device_async_resource_ref for the current device
|
inline |
Set the device_memory_resource for the specified device.
If new_mr is not nullptr, sets the memory resource pointer for the device specified by id to new_mr. Otherwise, resets ids resource to the initial cuda_memory_resource.
id.value() must be in the range [0, cudaGetDeviceCount()), otherwise behavior is undefined.
The object pointed to by new_mr must 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.
This function is thread-safe with respect to concurrent calls to set_per_device_resource, get_per_device_resource, get_current_device_resource, and set_current_device_resource. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
new_mr must have been created when device id was the current CUDA device (e.g. set using cudaSetDevice()). The behavior of a device_memory_resource is undefined if used while the active CUDA device is a different device from the one that was active when the device_memory_resource was created.| device_id | The id of the target device |
| new_mr | If not nullptr, pointer to new device_memory_resource to use as new resource for id |
id
|
inline |
Set the device_async_resource_ref for the specified device to new_resource_ref
device_id.value() must be in the range [0, cudaGetDeviceCount()), otherwise behavior is undefined.
The object referenced by new_resource_ref must 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.
This function is thread-safe with respect to concurrent calls to set_per_device_resource_ref, get_per_device_resource_ref, get_current_device_resource_ref, set_current_device_resource_ref and `reset_current_device_resource_ref. Concurrent calls to any of these functions will result in a valid state, but the order of execution is undefined.
new_resource_ref must have been created when device device_id was the current CUDA device (e.g. set using cudaSetDevice()). The behavior of a device_async_resource_ref is undefined if used while the active CUDA device is a different device from the one that was active when the memory resource was created.| device_id | The id of the target device |
| new_resource_ref | new device_async_resource_ref to use as new resource for device_id |
device_async_resource_ref for device_id | device_async_resource_ref rmm::to_device_async_resource_ref_checked | ( | Resource * | res | ) |
Convert pointer to memory resource into device_async_resource_ref, checking for nullptr
| Resource | The type of the memory resource. |
| res | A pointer to the memory resource. |
device_async_resource_ref to the memory resource. | std::logic_error | if the memory resource pointer is null. |