IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python class

DeviceSpec

DeviceSpec​

class max.driver.DeviceSpec(id, device_type='cpu')

source

Bases: object

A device specification containing an ID and device type.

Parameters:

  • id (int) – The device identifier.
  • device_type (Literal['cpu', 'gpu']) – The device type, either cpu or gpu. Defaults to cpu.

accelerator()​

static accelerator(id=0)

source

Creates an accelerator (GPU) device specification.

Parameters:

id (int)

cpu()​

static cpu(id=-1)

source

Creates a CPU device specification.

Parameters:

id (int)

device_type​

device_type: Literal['cpu', 'gpu'] = 'cpu'

source

The device type, either cpu or gpu.

id​

id: int

source

The device identifier.