Unable to add GPU through PCI ID

On a multi-GPU node I am trying to add 2 GPUs in my lxd container using the PCI ID of each GPU instead of the base GPU ID.
I got the PCI IDs of my GPUs as follows:
GPU 0: 0000:67:00.0
GPU 1: 0000:1A:00.0

When I try to add GPU 0 with the following command:

lxc config device add test gpu0 gpu pci=0000:67:00.0

It gets added successfully with the following output:

Device gpu0 added to test

But when I try adding GPU 1 with its PCI ID with the following command:

lxc config device add test gpu1 gpu pci=0000:1A:00.0

It displays the following error:

Error: Invalid devices: Device validation failed for “gpu1”: Invalid value for device option “pci”: Invalid PCI address

The strange part is that both these PCI IDs were returned using the nvidia-smi query on the system and while first one works smoothly the second fails. Is there any reason for why this might be happening?

Resolved:
The issue is that in case of a PCI ID having alphabets, lxd takes lowercase value instead of uppercase.

So for the GPU 1 with PCI ID: 0000:1A:00.0

The following command adds the GPU:
lxc config device add test gpu1 gpu pci=0000:1a:00.0

Output:

Device gpu1 added to test

The only reason I could think of was when I ran the following command:
lspci -nnn | grep "VGA compatible controller"

The GPU PCI IDs were displayed in lowercase instead of uppercase.

What LXD version is that? I thought we made things a bit more flexible in that regard recently.

@monstermunchkin

@stgraber it is the latest 4.12 lxd version installed with snap.

We’ve made things a bit more flexible. You can now use uppercase PCI addresses as well.

1 Like

@monstermunchkin great to know that. Would it be part of the upcoming 4.13 version? As it currently doesn’t work in 4.12.

Yes, it will work in 4.13.

1 Like