Type: gpu

GPU devices make the specified GPU device or devices appear in the instance.

Note

For containers, a gpu device may match multiple GPUs at once. For VMs, each device can match only a single GPU.

The following types of GPUs can be added using the gputype device option:

  • physical (container and VM): Passes an entire GPU through into the instance. This value is the default if gputype is unspecified.

  • mdev (VM only): Creates and passes a virtual GPU through into the instance.

  • mig (container only): Creates and passes a MIG (Multi-Instance GPU) through into the instance.

  • sriov (VM only): Passes a virtual function of an SR-IOV-enabled GPU into the instance.

The available device options depend on the GPU type and are listed in the tables in the following sections.

gputype: physical

Note

The physical GPU type is supported for both containers and VMs. It supports hotplugging only for containers, not for VMs.

A physical GPU device passes an entire GPU through into the instance.

Device options

GPU devices of type physical have the following device options:

gid

GID of the device owner in the container

Key: gid
Type:

integer

Default:

0

Condition:

container

id

DRM card ID of the GPU device

Key: id
Type:

string

mode

Mode of the device in the container

Key: mode
Type:

integer

Default:

0660

Condition:

container

pci

PCI address of the GPU device

Key: pci
Type:

string

productid

Product ID of the GPU device

Key: productid
Type:

string

uid

UID of the device owner in the container

Key: uid
Type:

integer

Default:

0

Condition:

container

vendorid

Vendor ID of the GPU device

Key: vendorid
Type:

string

Configuration examples

Add all GPUs from the host system as a physical GPU device to an instance:

lxc config device add <instance_name> <device_name> gpu gputype=physical

Add a specific GPU from the host system as a physical GPU device to an instance by specifying its PCI address:

lxc config device add <instance_name> <device_name> gpu gputype=physical pci=<pci_address>

See Configure devices for more information.

gputype: mdev

Note

The mdev GPU type is supported only for VMs. It does not support hotplugging.

An mdev GPU device creates and passes a virtual GPU through into the instance. You can check the list of available mdev profiles by running lxc info --resources.

Device options

GPU devices of type mdev have the following device options:

id

DRM card ID of the GPU device

Key: id
Type:

string

mdev

The mdev profile to use

Key: mdev
Type:

string

Default:

0

Required:

yes

For example: i915-GVTg_V5_4

pci

PCI address of the GPU device

Key: pci
Type:

string

productid

Product ID of the GPU device

Key: productid
Type:

string

vendorid

Vendor ID of the GPU device

Key: vendorid
Type:

string

Configuration examples

Add an mdev GPU device to an instance by specifying its mdev profile and the PCI address of the GPU:

lxc config device add <instance_name> <device_name> gpu gputype=mdev mdev=<mdev_profile> pci=<pci_address>

See Configure devices for more information.

gputype: mig

Note

The mig GPU type is supported only for containers. It does not support hotplugging.

A mig GPU device creates and passes a MIG compute instance through into the instance. Currently, this requires NVIDIA MIG instances to be pre-created.

Device options

GPU devices of type mig have the following device options:

id

DRM card ID of the GPU device

Key: id
Type:

string

mig.ci

Existing MIG compute instance ID

Key: mig.ci
Type:

integer

mig.gi

Existing MIG GPU instance ID

Key: mig.gi
Type:

integer

mig.uuid

Existing MIG device UUID

Key: mig.uuid
Type:

string

You can omit the MIG- prefix when specifying this option.

pci

PCI address of the GPU device

Key: pci
Type:

string

productid

Product ID of the GPU device

Key: productid
Type:

string

vendorid

Vendor ID of the GPU device

Key: vendorid
Type:

string

You must set either mig.uuid (NVIDIA drivers 470+) or both mig.ci and mig.gi (old NVIDIA drivers).

Configuration examples

Add a mig GPU device to an instance by specifying its UUID and the PCI address of the GPU:

lxc config device add <instance_name> <device_name> gpu gputype=mig mig.uuid=<mig_uuid> pci=<pci_address>

See Configure devices for more information.

gputype: sriov

Note

The sriov GPU type is supported only for VMs. It does not support hotplugging.

An sriov GPU device passes a virtual function of an SR-IOV-enabled GPU into the instance.

Device options

GPU devices of type sriov have the following device options:

id

DRM card ID of the parent GPU device

Key: id
Type:

string

pci

PCI address of the parent GPU device

Key: pci
Type:

string

productid

Product ID of the parent GPU device

Key: productid
Type:

string

vendorid

Vendor ID of the parent GPU device

Key: vendorid
Type:

string

Configuration examples

Add a sriov GPU device to an instance by specifying the PCI address of the parent GPU:

lxc config device add <instance_name> <device_name> gpu gputype=sriov pci=<pci_address>

See Configure devices for more information.