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

John lxc at jelmail.com
Tue Feb 19 16:53:43 UTC 2013


On 18/02/13 15:47, Guillaume Thouvenin wrote:
> 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
This is what I have too. I am on Arch Linux.
>
> I can start and log into my container. Then I created /dev/nvidia0,
> /dev/nvidia1 and /dev/nvidiactl in the container.
I have
     /dev/nvidia0 c 195 0 mode 666
     /dev/nvidiactl c 195 255 mode 666

I install the packages in the container:
     nvidia

You have to have the same version of the driver in the host and guest. 
I've hit problems with that during updates before.

I have been running my everyday desktop inside a container for as long 
as I have been using LXC. I am not doing gpu development work so my 
experience is as a user.

It look like you're doing the same as me so I can't see why it would not 
work. Have you tried just running a basic xorg desktop inside the 
container to see if that works? I install the following to test: 
xorg-server xorg-xinit. I found it necessary to install xorg-server and 
nvidia on the host as well (although it's never run there).



> 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
>
>
> ------------------------------------------------------------------------------
> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
> is your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials, tech docs,
> whitepapers, evaluation guides, and opinion stories. Check out the most
> recent posts - join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
>





More information about the lxc-users mailing list