Running OpenCL programs in Emulation mode on CPU

Is there a way I can run OpenCL programs in emulation mode on CPU itself without having to install driver or graphics card.
If there is such a mode, is the code genearted by the OpenCL compiler in emulation mode diffirent.

If there is a way to generate assembly without having the graphics card installed it is fine with me. I don’t really need to run the code.


It is possible to run OpenCL programs on the CPU, however you’ll have to install an OpenCL CPU backend / driver, like those from Intel or AMD. NVIDIA does not currently offer a way to run OpenCL kernels on the CPU. That said, running your program on the CPU will not allow you to debug any issues you might currently have with running the OpenCL kernel on the GPU in particular, simply because the OpenCL runtime / compiler is a completely different one then, with completely different bugs :-)

When you say assembly, for which architecture? PTX or x86 assembly? In the latter case, the Intel OpenCL SDK comes with an offline compiler tool. Regarding PTX / NVIDIA GPU assembly, I guess there is no way to generate it without a GPU unless you have a Tesla card and a headless driver.

BTW, AMD also includes an offline kernel compiler for x86 assembly

I am looking to generate PTX assembly. Please correct me if I am wrong. NVIDIA cuda compiler (atleast on linux) does have a -deviceemu option which allows you to build and run your code on CPU.

I was looking for a similar option which if not allow me to run my code will atleast allow me to build my source code.
Rightnow my program fails in clGetDeviceIDs call itself.


As the -deviceemu option is deprecated you’re probably better off retrieving the PTX assembly for your OpenCL code via clGetProgramInfo() and using gpuocelot, see

However, I doubt this will help you debugging your issue.

The issue is I dont possess the NVIDIA card and I just wished to compile my code and check the assembly generated. So I cannot use clGetProgramInfo. I have a windows development enviornement and gpuocelot i think is only avaialaible for linux (specifically Ubuntu).


could you tell me how to install openCL if i don’t have a GPU?. I have an intel i3 processor. I have a dual boot with Windows 7 and Ubuntu 12.04.