For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
Accelerator
Accelerator
class max.driver.Accelerator(id: int = -1)
Bases: Device
Represents any hardware accelerator attached to the host.
The graph compiler reaches CUDA, HIP, Metal and plugin-provided
backends alike through this one device class. Use
isinstance(device, Accelerator) to mean “any non-CPU device”,
and api to tell the concrete backends apart.
from max import driver
device = driver.Accelerator()
first = driver.Accelerator(id=0)-
Parameters:
-
id – The zero-based ID of the accelerator to select. Defaults to -1, which selects the first available accelerator.
-
Raises:
-
ValueError – If the device cannot be created, for example when no compatible accelerator is available.