cuda.core.Host#

class cuda.core.Host(numa_id: int | None = None, *, is_numa_current: bool = False)#

Host (CPU) location for managed-memory operations.

Use one of the following forms:

  • Host() — generic host (any NUMA node).

  • Host(numa_id=N) — specific NUMA node N.

  • Host.numa_current() or Host(is_numa_current=True) — NUMA node of the calling thread. numa_id and is_numa_current are mutually exclusive.

Host is the symmetric counterpart of Device for managed-memory prefetch, advise, and discard_prefetch targets. Pass either a Device or a Host to those operations and to ManagedBuffer.preferred_location / accessed_by.

Host is a singleton class, mirroring Device: constructor calls with the same arguments return the same instance, so Host() is Host() and Host(numa_id=1) is Host(numa_id=1). Host.numa_current() returns its own singleton, distinct from Host() because it represents a thread-relative location rather than a fixed one.

Methods

__init__()#
classmethod numa_current() Host#

Construct a Host referring to the calling thread’s NUMA node.

Attributes

property is_numa_current: bool#
property numa_id: int | None#