Question on passthough Nvidia GPU and CUDA driver

I have 2 video cards on laptop, Intel and Nvidia optimus.
I want to run some CUDA program in LXD.

I read from that needs to install the CUDA tools and Nvidia driver on host.

My question is, if on host I install Nvidia optimus driver but not CUDA library/tool, then in container I install CUDA, will CUDA program work in container?

My host is openSUSE 15.1, I want to run CUDA program in Ubuntu 16.04 container. NVidia provides driver for my host, but they provide CUDA only for openSUSE 15.0 ( I guess I can’t eaily install CUDA on host. I choose Ubuntu 16.04 for container cause Nvidia provides all drivers needed.

The instructions you are seeing are from 2007.
The status now is to set up the closed-source drivers on the host as usual, then configure the container with nvidia.runtime: "true". The last step will setup for you the client software in the container. LXD will autodownload and mount to the container the Nvidia runtime that Nvidia provides.

There is a guide that describes how to run x11 apps in a container with hw acceleration for Nvidia, at It is similar to what you are doing (note the capabilities setting, where you enable compute).