malloc_managed(size_t size) → MemoryPointer¶
Allocate managed memory (unified memory).
This method can be used as a CuPy memory allocator. The simplest way to use a managed memory as the default allocator is the following code:
The advantage using managed memory in CuPy is that device memory oversubscription is possible for GPUs that have a non-zero value for the device attribute cudaDevAttrConcurrentManagedAccess. CUDA >= 8.0 with GPUs later than or equal to Pascal is preferrable.