Page 1 of 1

OpenCL / CUDA support in guests?

Posted: 27. Feb 2011, 21:49
by kebabbert
How difficult would it be to add OpenCL / CUDA support in guests? And how can I request it?

I use Solaris 11 Express as host, and there are no OpenCL / CUDA available for S-11x. I would like to get that support in Window or Linux guests.

Re: OpenCL / CUDA support in guests?

Posted: 28. Feb 2011, 14:41
by squall leonhart
gpu CL,.... next to impossible at this point.
CPU CL, should be fine.

CUDA, will never happen.

Re: OpenCL / CUDA support in guests?

Posted: 5. Mar 2011, 16:17
by kebabbert
CPU CL? What is that? Do you mean I can run OpenCL on the cpu? And when I have debugged my code in a guest, I startup a Linux or Windows machine and run OpenCL on the GPU?

Re: OpenCL / CUDA support in guests?

Posted: 5. Mar 2011, 17:31
by squall leonhart
Yes, both intel and amd have OpenCL sdk's available for their CPU's.

http://developer.amd.com/gpu/AMDAPPSDK/ ... fault.aspx
http://software.intel.com/en-us/article ... pencl-sdk/

im not to sure on the whole using the cpu during the dev and debugging of a GPU CL program, but it shouldn't be impossible.

Re: OpenCL / CUDA support in guests?

Posted: 6. Mar 2011, 00:21
by kebabbert
Just to confirm: So, I could develop my source code in a Windows guest? The host is Solaris Express. Then, when everything is working, I could switch to a OpenCL GPU and run the code?

Re: OpenCL / CUDA support in guests?

Posted: 22. Jul 2011, 00:15
by rjzak
kebabbert wrote:Just to confirm: So, I could develop my source code in a Windows guest? The host is Solaris Express. Then, when everything is working, I could switch to a OpenCL GPU and run the code?
Theoretically, yes, as long as the system you would be using has the libraries installed. This is because the basic idea of OpenCL is that it'll use whatever is available: CPU and/or GPU.

As for GPU/CUDA support, it should be possible for the VirtualBox developers to implement this. After all, Amazon's EC2 does virtualization with GPUs exposed: https://aws.amazon.com/ec2/#instance.

Re: OpenCL / CUDA support in guests?

Posted: 22. Jul 2011, 09:29
by kebabbert
"Theoretically, yes"

Ok, has anyone tested it? To develop and debug in a guest OS, and when the program is complete I will reboot into Windows and run the program on the GPU?

Re: OpenCL / CUDA support in guests?

Posted: 15. Aug 2011, 15:08
by kebabbert
Ok, it seems that NVIDIA Cuda allows to use Emulation mode even if you have no NVIDIA graphics card. This means that the CUDA program you wrote, will only run on the CPU. This is used when debugging CUDA code. The old way to use Emulation was to specify the compile flag "-deviceemu", but has now changed so you add a library or something similar.

So, it should be possible to install Visual Studio and Nvidia CUDA SDK in Windows in VirtualBox and compile and run the source code on the CPU. And when the source code is debugged, you just stop using the Emulation mode (add another library and recompile) and then move the binary file to a Nvidia graphics card equipped computer. Myself, I will just reboot into Win7 and run the binary from there.

Re: OpenCL / CUDA support in guests?

Posted: 30. Sep 2012, 00:39
by denka
Did anybody try this? I'm also interested in doing some OpenCL work in a VM (where all my homebrew development happens, for convenience of having the toolchain). I think this topic becomes too important to ignore, with mainstream CPUs integrating GPU functionality.

Re: OpenCL / CUDA support in guests?

Posted: 2. Jan 2017, 14:57
by martin_sch
denka wrote:Did anybody try this? I'm also interested in doing some OpenCL work in a VM (where all my homebrew development happens, for convenience of having the toolchain). I think this topic becomes too important to ignore, with mainstream CPUs integrating GPU functionality.
Yes. I used to develop within my debian vbox guest on a Windows host (Intel CPU). I did not manage to get OpenCL working in my debian guest with my NVIDIA GPU, but with the Intel OpenCL sdk (opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25.tgz <- already outdated but works fine for me) on my CPU.

Alternative:
Right now I'm developing on Windows 10 (c++/OpenCL) and do additional compiling/testing using WSL. OpenCL on Intel CPU works fine on WSL, it's more convenient than switching between host/guest while developing and almost everything I need for developing works (for example valgrind doesn't work).
For GPU tests I'm using my Windows host or grab an Amazon EC2-G2 instance.