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 | None = None,
) Buffer#

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

close(self)#

No operation (provided for compatibility).

deallocate(
self,
ptr: DevicePointerT,
size_t size,
stream: Stream | GraphBuilder | None = None,
)#

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