Enable LXD GPU pass-through in Ubuntu 18.04 (Bionic Beaver)


One of the biggest challenge (aside from upgrading nvidia & cuda) in upgrading from Ubuntu 16.04 to Ubuntu 18.04 is enabling GPU passthrough in LXD Containers. Due to a bug in parsing logic, it cannot properly parse Blacklisted line in nvidia-410 drivers.


The simplest solution is to upgrade lxd to 3.0.2. To do that you have to enable pre-released updates (bionic-proposed).

Enable Pre-released updates from Ubuntu Software

Then just upgrade lxd:

sudo apt upgrade lxd

Reboot and you are done.

Why GPU Passthrough?

I have explained how to enable GPU Passthrough from LXD container but would you like to know what exactly am I doing with it?

I am using it to fine-tune Deep Learning algorithms from LXD containers. Having them in containers makes it very easy to move them to a different server with better GPU(s) and well as to Cloud.