It appears that clBuildProgram is not thread-safe, which is rather unfortunate. Can anyone confirm this?
You had my full attention since it sounded like what I do, & I only have multiple GPU’s to test with on OSX. I remembered though that during setup / compile tasks, I am not using a thread pool yet. I am just looping through each of the contexts/devs and compiling serially. You might be able to back off and do the same without a major hit to performance. Parallelizing compilation should not be that significant if only done once at the beginning.
If you compile as part of your process & it is not thread-safe, then you have few alternatives.
The specification indicates that only creation, retain, and release of objects are thread safe. So I’d assume that clBuildProgram is not thread safe.