cupy.cuda.malloc_async#

cupy.cuda.malloc_async(size_t size) MemoryPointer#

(Experimental) Allocate memory from Stream Ordered Memory Allocator.

This method can be used as a CuPy memory allocator. The simplest way to use CUDA’s Stream Ordered Memory Allocator as the default allocator is the following code:

set_allocator(malloc_async)

Using this feature requires CUDA >= 11.2 with a supported GPU and platform. If it is not supported, an error will be raised.

The current CuPy stream is used to allocate/free the memory.

Parameters:

size (int) – Size of the memory allocation in bytes.

Returns:

Pointer to the allocated buffer.

Return type:

MemoryPointer

Warning

This feature is currently experimental and subject to change.