cuda.core.GraphMemoryResource#

class cuda.core.GraphMemoryResource(device_id: int | Device)#

A memory resource for memory related to graphs.

The only supported operations are allocation, deallocation, and a limited set of status queries.

This memory resource should be used when building graphs. Using this when graphs capture is not enabled will result in a runtime error.

Conversely, allocating memory from a DeviceMemoryResource when graph capturing is enabled results in a runtime error.

Parameters:

device_id (int | Device) – Device or Device ordinal for which a graph memory resource is obtained.

Methods

__init__()#
allocate(
self,
size_t size,
*,
stream: Stream | GraphBuilder,
) Buffer#

Allocate a buffer of the requested size. See documentation for MemoryResource.

close(self)#

No operation (provided for compatibility).

deallocate(
self,
ptr: 'DevicePointerType',
size_t size,
*,
stream: Stream | GraphBuilder,
)#

Deallocate a buffer of the requested size. See documentation for MemoryResource.

trim(self)#

Free unused memory that was cached on the specified device for use with graphs back to the OS.

Attributes

attributes#

Asynchronous allocation attributes related to graphs.

device_id#

The associated device ordinal.

is_device_accessible#

Return True. This memory resource provides device-accessible buffers.

is_host_accessible#

Return False. This memory resource does not provide host-accessible buffers.

is_managed#

Whether buffers allocated by this resource are CUDA managed (unified) memory.