rmm.allocators#

rmm.allocators.cupy.rmm_cupy_allocator(nbytes)#

A CuPy allocator that makes use of RMM.

Examples

>>> from rmm.allocators.cupy import rmm_cupy_allocator
>>> import cupy
>>> cupy.cuda.set_allocator(rmm_cupy_allocator)
class rmm.allocators.numba.RMMNumbaManager(*args, **kwargs)#

Bases: HostOnlyCUDAMemoryManager

External Memory Management Plugin implementation for Numba. Provides on-device allocation only.

See https://numba.readthedocs.io/en/stable/cuda/external-memory.html for details of the interface being implemented here.

Attributes:
interface_version

Returns an integer specifying the version of the EMM Plugin interface supported by the plugin implementation.

Methods

defer_cleanup()

Returns a context manager that disables cleanup of mapped or pinned host memory in the current context whilst it is active.

get_ipc_handle(memory)

Get an IPC handle for the MemoryPointer memory with offset modified by the RMM memory pool.

get_memory_info()

Returns (free, total) memory in bytes in the context.

initialize()

Perform any initialization required for the EMM plugin instance to be ready to use.

memalloc(size)

Allocate an on-device array from the RMM pool.

memhostalloc(size[, mapped, portable, wc])

Implements the allocation of pinned host memory.

mempin(owner, pointer, size[, mapped])

Implements the pinning of host memory.

reset()

Clears up all host memory (mapped and/or pinned) in the current context.

memallocmanaged

defer_cleanup()#

Returns a context manager that disables cleanup of mapped or pinned host memory in the current context whilst it is active.

EMM Plugins that override this method must obtain the context manager from this method before yielding to ensure that cleanup of host allocations is also deferred.

get_ipc_handle(memory)#

Get an IPC handle for the MemoryPointer memory with offset modified by the RMM memory pool.

get_memory_info()#

Returns (free, total) memory in bytes in the context.

This implementation raises NotImplementedError because the allocation will be performed using rmm’s currently set default mr, which may be a pool allocator.

initialize()#

Perform any initialization required for the EMM plugin instance to be ready to use.

Returns:

None

property interface_version#

Returns an integer specifying the version of the EMM Plugin interface supported by the plugin implementation. Should always return 1 for implementations of this version of the specification.

memalloc(size)#

Allocate an on-device array from the RMM pool.

memallocmanaged(size, attach_global)#
memhostalloc(size, mapped=False, portable=False, wc=False)#

Implements the allocation of pinned host memory.

It is recommended that this method is not overridden by EMM Plugin implementations - instead, use the numba.cuda.BaseCUDAMemoryManager.

mempin(owner, pointer, size, mapped=False)#

Implements the pinning of host memory.

It is recommended that this method is not overridden by EMM Plugin implementations - instead, use the numba.cuda.BaseCUDAMemoryManager.

reset()#

Clears up all host memory (mapped and/or pinned) in the current context.

EMM Plugins that override this method must call super().reset() to ensure that host allocations are also cleaned up.