CUDA 8.0 within Ubuntu 16 LTS KVM virtual machine, CentOS 6 host

I have a large and popular HP DL980 that currently runs CentOS 6. A while back we installed a K40c GPU and CUDA 7.5 and later 8.0.

We’ve recently gotten requests for software like TensorFlow, whose installation favors Ubuntu. I haven’t gotten TensorFlow working with CentOS 6.

Would it be reasonable to install things like TensorFlow inside an Ubuntu or debian virtual machine using KVM?

It’s not clear whether it’s a good idea to have the host OS be Ubuntu or debian.

Also, if I use debian instead of Ubuntu, should I expect Ubuntu GPU projects to work?

I have gotten tensorflow working on CentOS using instructions like what is here:

http://www.nvidia.com/object/gpu-accelerated-applications-tensorflow-installation.html

You have to build many things from scratch, so its not a complete set of instructions, but a pretty good roadmap.

Another alternative would be to use docker containers:

https://devblogs.nvidia.com/parallelforall/nvidia-docker-gpu-server-application-deployment-made-easy/

You can effectively have ubuntu running inside a docker container that is on CentOS.

Finally, yes, it should be possible to use a K40c on KVM in CentOS. This is not a perfectly exact set of instructions, but pretty close:

https://github.com/dholt/kvm-gpu