Classes | Typedefs | Functions | Variables
rmm::mr Namespace Reference

Memory Resource classes and adaptors. More...

Classes

class  aligned_resource_adaptor
 Resource that adapts Upstream memory resource to allocate memory in a specified alignment size. More...
 
class  arena_memory_resource
 A suballocator that emphasizes fragmentation avoidance and scalable concurrency support. More...
 
class  binning_memory_resource
 Allocates memory from upstream resources associated with bin sizes. More...
 
class  callback_memory_resource
 A device memory resource that uses the provided callbacks for memory allocation and deallocation. More...
 
class  cuda_async_managed_memory_resource
 device_memory_resource derived class that uses cudaMallocFromPoolAsync/cudaFreeFromPoolAsync with a managed memory pool for allocation/deallocation. More...
 
class  cuda_async_memory_resource
 device_memory_resource derived class that uses cudaMallocAsync/cudaFreeAsync for allocation/deallocation. More...
 
class  cuda_async_view_memory_resource
 device_memory_resource derived class that uses cudaMallocAsync/cudaFreeAsync for allocation/deallocation. More...
 
class  cuda_memory_resource
 device_memory_resource derived class that uses cudaMalloc/Free for allocation/deallocation. More...
 
class  device_memory_resource
 Base class for all librmm device memory allocation. More...
 
class  failure_callback_resource_adaptor
 A device memory resource that calls a callback function when allocations throw a specified exception type. More...
 
class  fixed_size_memory_resource
 A device_memory_resource which allocates memory blocks of a single fixed size. More...
 
class  host_memory_resource
 Base class for host memory allocation. More...
 
class  new_delete_resource
 A host_memory_resource that uses the global operator new and operator delete to allocate host memory. More...
 
class  pinned_memory_resource
 A host_memory_resource that uses cudaMallocHost to allocate pinned/page-locked host memory. More...
 
class  limiting_resource_adaptor
 Resource that uses Upstream to allocate memory and limits the total allocations possible. More...
 
class  logging_resource_adaptor
 Resource that uses Upstream to allocate memory and logs information about the requested allocation/deallocations. More...
 
class  managed_memory_resource
 device_memory_resource derived class that uses cudaMallocManaged/Free for allocation/deallocation. More...
 
class  owning_wrapper
 Resource adaptor that maintains the lifetime of upstream resources. More...
 
class  pinned_host_memory_resource
 Memory resource class for allocating pinned host memory. More...
 
class  polymorphic_allocator
 A stream ordered Allocator using a rmm::mr::device_memory_resource to satisfy (de)allocations. More...
 
class  stream_allocator_adaptor
 Adapts a stream ordered allocator to provide a standard Allocator interface. More...
 
class  pool_memory_resource
 A coalescing best-fit suballocator which uses a pool of memory allocated from an upstream memory_resource. More...
 
class  prefetch_resource_adaptor
 Resource that prefetches all memory allocations. More...
 
class  sam_headroom_memory_resource
 Resource that uses system memory resource to allocate memory with a headroom. More...
 
class  statistics_resource_adaptor
 Resource that uses Upstream to allocate memory and tracks statistics on memory allocations. More...
 
class  system_memory_resource
 device_memory_resource derived class that uses malloc/free for allocation/deallocation. More...
 
class  thread_safe_resource_adaptor
 Resource that adapts Upstream memory resource adaptor to be thread safe. More...
 
class  thrust_allocator
 An allocator compatible with Thrust containers and algorithms using a device_async_resource_ref for memory (de)allocation. More...
 
class  tracking_resource_adaptor
 Resource that uses Upstream to allocate memory and tracks allocations. More...
 

Typedefs

using 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 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 failure_callback_t = std::function< bool(std::size_t, void *)>
 Callback function type used by failure_callback_resource_adaptor. More...
 

Functions

template<template< typename... > class Resource, typename... Upstreams, typename... Args>
auto make_owning_wrapper (std::tuple< std::shared_ptr< Upstreams >... > upstreams, Args &&... args)
 Constructs a resource of type Resource wrapped in an owning_wrapper using upstreams as the upstream resources and args as the additional parameters for the constructor of Resource. More...
 
template<template< typename > class Resource, typename Upstream , typename... Args>
auto make_owning_wrapper (std::shared_ptr< Upstream > upstream, Args &&... args)
 Additional convenience factory for owning_wrapper when Resource has only a single upstream resource. More...
 
device_memory_resourceget_per_device_resource (cuda_device_id device_id)
 Get the resource for the specified device. More...
 
device_memory_resourceset_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_resourceget_current_device_resource ()
 Get the memory resource for the current device. More...
 
device_memory_resourceset_current_device_resource (device_memory_resource *new_mr)
 Set the memory resource for the current device. More...
 
device_async_resource_ref 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 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 get_current_device_resource_ref ()
 Get the device_async_resource_ref for the current device. More...
 
device_async_resource_ref 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 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 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 operator== (polymorphic_allocator< T > const &lhs, polymorphic_allocator< U > const &rhs)
 Compare two polymorphic_allocators for equality. More...
 
template<typename T , typename U >
bool operator!= (polymorphic_allocator< T > const &lhs, polymorphic_allocator< U > const &rhs)
 Compare two polymorphic_allocators for inequality. More...
 
template<typename A , typename O >
bool 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 operator!= (stream_allocator_adaptor< A > const &lhs, stream_allocator_adaptor< O > const &rhs)
 Compare two stream_allocator_adaptors for inequality. More...
 

Variables

template<class Resource , class = void>
constexpr bool is_resource_adaptor = false
 Concept to check whether a resource is a resource adaptor by checking for get_upstream_resource.
 

Detailed Description

Memory Resource classes and adaptors.

The rmm::mr namespace contains all base memory resource classes that implement various CUDA memory allocation strategies, adaptors for suballocation such as pool and arena adaptors, and adaptors that add functionality such as logging, alignment, and statistics tracking to existing memory resources.