[Lxc-users] provide access to GPU capabilites to container

Guillaume Thouvenin guillaume.thouvenin at polymtl.ca
Mon Feb 18 15:47:58 UTC 2013


Hello,

I'm trying to build a container that will be able to use the GPU 
capabilites of my nvidia graphic card. My distribution is an Ubuntu 
12.04 and I downloaded the package 
"cuda_5.0.35_linux_64_ubuntu11.10-1.run". From the nvidia site. I've 
installed the nvidia driver, the nvidia devkit and also some samples. 
Everything run fine on the host. Then I installed a container and I 
added the following in my config file:

lxc.cgroup.devices.allow = c 195:* rwm  # for nvidia

I can start and log into my container. Then I created /dev/nvidia0, 
/dev/nvidia1 and /dev/nvidiactl in the container. I installed the cuda 
development kit and some samples but when I run a test I get:

~/NVIDIA_CUDA-5.0_Samples/0_Simple/clock$ ./clock
CUDA Clock sample
CUDA error at ../../common/inc/helper_cuda.h:930 
code=35(cudaErrorInsufficientDriver) "cudaSetDevice(devID)" CUDA error 
at ../../common/inc/helper_cuda.h:931 
code=35(cudaErrorInsufficientDriver) "cudaGetDeviceProperties(&deviceP
rop, devID)" GPU Device 0: "" with compute capability 8592.1001


I've also tested to remove the nvidia driver from the host and install 
it into the container but insmod failed into the container. I get the 
following error:

Kernel module compilation complete.
Kernel module load error: insmod: error inserting './kernel/nvidia.ko': -1
Operation not permitted

So in short:
- when I installed the nvidia driver into the host, I cannot access GPU 
from the container
- when I tried to install the nvidia driver into the container I cannot 
do the insmod.

In both cases I let "lxc.cgroup.devices.allow = c 195:* rwm  # for 
nvidia" into the config file of the container.

What can I try next?

Thanks for your help,
Regards,
Guillaume





More information about the lxc-users mailing list