The problem I'm having with running OpenCL code on an Intel CPU using Intel's SDK on Linux is the following:
My code often hangs at the call to 'clCreateContext'. This means it never returns and thus also not return any error code. It uses 120% CPU according to the information provided by 'top'. I've tried numerous things, but the only solution so far is to kill the process and try again. The call to 'clCreateContext' works fine say ~75% of the time, but hangs the other ~25%. If it works fine, then my whole program exectutes fine.
I don't think the actual algorithm I want to execute is very relevant, because the same problem occurs for other examples as well. Anyhow, I've attached the code, because maybe I'm doing something wrong at initialisation. If the code hangs, it hangs at the first call to 'clCreateContext' (line 118 of saxpy_host.c), the second call (line 164) always works fine.
I'm running on the following system:
OS: Ubuntu 12.04 server
Intel Core i7-3770 (target for OpenCL code - The CPU, not the GPU)
Intel SDK OpenCL 2012(target for OpenCL code)
AMD 7950 (running X server, not used in this case)
AMD APP SDK 2.7 (not used in this case, but still installed)
No screens attached (not to the AMD GPU, not to the Intel integrated GPU)
Things I've tried:
Re-install the Intel SDK (using Alien).
Use 'clCreateContextFromType' instead of 'clCreateContext'
Tried to use a callback function 'pfn_notify', but it never prints anything.
Test without actual execution of the kernel
Due to the random nature of the problem, I'm not sure what to do next. Any suggestions for anything I should try?
For some reason, the problem is gone now. I'm not sure what exactly. However, a few things have changed in the meantime to the code. Attached you will find the new version of the code, which does not give any problems.The new version of the code (it's generated code) now has global variables for context, queue and program.
Anyway, my problem is solved, and apparently nobody else experienced this problem.