1 of 1 people found this helpful
OpenCL is with exeption of clSetKernelArg() fully thread safe. You can try multi device example from SDK.
That explains a lot ... There are many clSetKernelArg() calls in my program. Thanks.
edit: Quote from OpenCL documentation:
"An OpenCL API call is considered to be thread-safe if the internal state as managed by OpenCL remains consistent when called simultaneously by multiple host threads. OpenCL API calls that are thread-safe allow an application to call these functions in multiple host threads without having to implement mutual exclusion across these host threads i.e. they are also re-entrant-safe.
All OpenCL API calls are thread-safe except
clSetKernelArg, which is safe to call from any host thread, and is safe to call re-entrantly so long as concurrent calls operate on different cl_kernel objects. However, the behavior of the cl_kernel object is undefined if
clSetKernelArgis called from multiple host threads on the same cl_kernel object at the same time. "
Since each thread in my program has its own cl_kernel objects clSetKernelArg() shouldn't cause any problems.
problem with clSetKernelarg() is that between setting argument and queuing another thread can change argument so you end up with wrong arguments. if you manage lock cl_kernel during whole set-queue you can share one kernel between threads.
did you run multi device example from SDK? you should create simple test case which can be tested by AMD. otherwise they can't help you.
Since the threads use a separate context -- I dont think clSetKernelArg() is a problem for you.
Multi-threading was introduced in OpenCL 1.1. Please read the appendix section for more information on this.
Can you tell the following?
1. Which GPU cards you are using?
2. If AMD, which version of Catalyst driver are you using?
3. Which OS? Bitness?
If possible, Please post a small repro-case. We can validate it from our end.