Python class
Accelerator
Accelerator
class max.driver.Accelerator(self, id: int = -1)
Bases: Device
Creates an accelerator device with the specified ID and memory limit.
Provides access to GPU or other hardware accelerators in the system.
Repeated instantiations with a previously-used device-id will still refer to the first such instance that was created. This is especially important when providing a different memory limit: only the value (implicitly or explicitly) provided in the first such instantiation is effective.
from max import driver
device = driver.Accelerator()
# Or specify GPU id
device = driver.Accelerator(id=0) # First GPU
device = driver.Accelerator(id=1) # Second GPU
# Get device id
device_id = device.id-
Parameters:
-
id (int, optional) – The device ID to use. Defaults to -1, which selects the first available accelerator.
-
Returns:
-
A new Accelerator device object.
-
Return type:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!