cuda.core.ManagedMemoryResourceOptions#

class cuda.core.ManagedMemoryResourceOptions(
preferred_location: int | None = None,
preferred_location_type: str | None = None,
)#

Customizable ManagedMemoryResource options.

preferred_location#

A location identifier (device ordinal or NUMA node ID) whose meaning depends on preferred_location_type. (Default to None)

Type:

int | None, optional

preferred_location_type#

Controls how preferred_location is interpreted.

When set to None (the default), legacy behavior is used: preferred_location is interpreted as a device ordinal, -1 for host, or None for no preference.

When set explicitly, the type determines both the kind of preferred location and the valid values for preferred_location:

  • "device": prefer a specific GPU. preferred_location must be a device ordinal (>= 0).

  • "host": prefer host memory (OS-managed NUMA placement). preferred_location must be None.

  • "host_numa": prefer a specific host NUMA node. preferred_location must be a NUMA node ID (>= 0), or None to derive the NUMA node from the current CUDA device’s host_numa_id attribute (requires an active CUDA context).

(Default to None)

Type:

"device" | "host" | "host_numa" | None, optional