Namespaces | Classes | Typedefs | Functions | Variables
rmm Namespace Reference

RAPIDS Memory Manager - The top-level namespace for all RMM functionality. More...

Namespaces

 mr
 Memory Resource classes and adaptors.
 

Classes

struct  cuda_device_id
 Strong type for a CUDA device identifier. More...
 
struct  cuda_set_device_raii
 RAII class that sets the current CUDA device to the specified device on construction and restores the previous device on destruction. More...
 
class  cuda_stream
 Owning wrapper for a CUDA stream. More...
 
class  cuda_stream_pool
 A pool of CUDA streams. More...
 
class  cuda_stream_view
 Strongly-typed non-owning wrapper for CUDA streams with default constructor. More...
 
class  device_buffer
 RAII construct for device memory allocation. More...
 
class  device_scalar
 Container for a single object of type T in device memory. More...
 
class  device_uvector
 An uninitialized vector of elements in device memory. More...
 
struct  logic_error
 Exception thrown when logical precondition is violated. More...
 
struct  cuda_error
 Exception thrown when a CUDA error is encountered. More...
 
class  bad_alloc
 Exception thrown when an RMM allocation fails. More...
 
class  out_of_memory
 Exception thrown when RMM runs out of memory. More...
 
class  out_of_range
 Exception thrown when attempting to access outside of a defined range. More...
 
class  exec_policy
 Helper class usable as a Thrust CUDA execution policy that uses RMM for temporary memory allocation on the specified stream. More...
 
class  exec_policy_nosync
 Helper class usable as a Thrust CUDA execution policy that uses RMM for temporary memory allocation on the specified stream and which allows the Thrust backend to skip stream synchronizations that are not required for correctness. More...
 

Typedefs

template<typename T >
using device_vector = thrust::device_vector< T, rmm::mr::thrust_allocator< T > >
 Alias for a thrust::device_vector that uses RMM for memory allocation.
 
using thrust_exec_policy_t = thrust::detail::execute_with_allocator< mr::thrust_allocator< char >, thrust::cuda_cub::execute_on_stream_base >
 Synchronous execution policy for allocations using Thrust.
 
using thrust_exec_policy_nosync_t = thrust::detail::execute_with_allocator< mr::thrust_allocator< char >, thrust::cuda_cub::execute_on_stream_nosync_base >
 Asynchronous execution policy for allocations using Thrust.
 
using 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 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 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 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 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 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

bool is_pow2 (std::size_t value) noexcept
 Returns whether or not value is a power of 2. More...
 
bool is_supported_alignment (std::size_t alignment) noexcept
 Returns whether or not alignment is a valid memory alignment. More...
 
std::size_t align_up (std::size_t value, std::size_t alignment) noexcept
 Align up to nearest multiple of specified power of 2. More...
 
std::size_t align_down (std::size_t value, std::size_t alignment) noexcept
 Align down to the nearest multiple of specified power of 2. More...
 
bool is_aligned (std::size_t value, std::size_t alignment) noexcept
 Checks whether a value is aligned to a multiple of a specified power of 2. More...
 
bool is_pointer_aligned (void *ptr, std::size_t alignment=CUDA_ALLOCATION_ALIGNMENT) noexcept
 Checks whether the provided pointer is aligned to a specified alignment. More...
 
cuda_device_id get_current_cuda_device ()
 Returns a cuda_device_id for the current device. More...
 
int get_num_cuda_devices ()
 Returns the number of CUDA devices in the system. More...
 
std::pair< std::size_t, std::size_t > available_device_memory ()
 Returns the available and total device memory in bytes for the current device. More...
 
std::size_t percent_of_free_device_memory (int percent)
 Returns the approximate specified percent of available device memory on the current CUDA device, aligned (down) to the nearest CUDA allocation size. More...
 
bool operator== (cuda_stream_view lhs, cuda_stream_view rhs)
 Equality comparison operator for streams. More...
 
bool operator!= (cuda_stream_view lhs, cuda_stream_view rhs)
 Inequality comparison operator for streams. More...
 
std::ostream & operator<< (std::ostream &os, cuda_stream_view stream)
 Output stream operator for printing / logging streams. More...
 
rapids_logger::sink_ptr default_sink ()
 Returns the default sink for the global logger. More...
 
std::string default_pattern ()
 Returns the default log pattern for the global logger. More...
 
rapids_logger::logger & default_logger ()
 Get the default logger. More...
 
void prefetch (void const *ptr, std::size_t size, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
 Prefetch memory to the specified device on the specified stream. More...
 
template<typename T >
void prefetch (cuda::std::span< T const > data, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
 Prefetch a span of memory to the specified device on the specified stream. More...
 
template<class Resource >
device_async_resource_ref to_device_async_resource_ref_checked (Resource *res)
 Convert pointer to memory resource into device_async_resource_ref, checking for nullptr More...
 

Variables

static constexpr std::size_t RMM_DEFAULT_HOST_ALIGNMENT {alignof(std::max_align_t)}
 Default alignment used for host memory allocated by RMM. More...
 
static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT {256}
 Default alignment used for CUDA memory allocation.
 
static constexpr cuda_stream_view cuda_stream_default {}
 Static cuda_stream_view of the default stream (stream 0), for convenience.
 
static const cuda_stream_view cuda_stream_legacy
 Static cuda_stream_view of cudaStreamLegacy, for convenience. More...
 
static const cuda_stream_view cuda_stream_per_thread
 Static cuda_stream_view of cudaStreamPerThread, for convenience. More...
 

Detailed Description

RAPIDS Memory Manager - The top-level namespace for all RMM functionality.

The rmm namespace provides a comprehensive set of memory management utilities for CUDA applications, including memory resources, CUDA stream management, device-side data containers, and memory allocation utilities.

Function Documentation

◆ default_logger()

rapids_logger::logger& rmm::default_logger ( )

Get the default logger.

Returns
logger& The default logger

◆ default_pattern()

std::string rmm::default_pattern ( )

Returns the default log pattern for the global logger.

Returns
std::string The default log pattern.

◆ default_sink()

rapids_logger::sink_ptr rmm::default_sink ( )

Returns the default sink for the global logger.

If the environment variable RMM_DEBUG_LOG_FILE is defined, the default sink is a sink to that file. Otherwise, the default is to dump to stderr.

Returns
sink_ptr The sink to use