cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

tugrul_512bit
Adept III

Kernel Compiling Corruption When Concurrent Compiling Enabled

I have an opencl wrapper that can act as a server or a client and uses all devices per pc.

But I have only 1 pc.

When I increase number of server instances in same pc to 9 or greater, it bugs at the kernel compiling part. If I put compiling part in a lock to elliminate race of something, it works flawlessly and all server instances calculate right.

Is this non-thread-safeness of "kernel compiling" (on different contexts in same windows-10 64 bit machine), about process scope? Device scope? Shared memory scope(such as numa)?

Device: R7_240. Cpu could trigger same behaviour but it is so fast compiling compared to gpu, I'm not sure.

Opencl 1.2 bindings used in 64-bit C# program.

0 Likes
1 Solution

I forgot to use CL_DEVICE_COMPILER_AVAILABLE on all threads. My bad.

View solution in original post

0 Likes
3 Replies
dipak
Big Boss

Hi,

As per OpenCL spec:

"All OpenCL API calls are thread-safe except clSetKernelArg. These thread-safe APIs allow an application to call these functions in multiple host threads without having to implement mutual exclusion across these host threads."

[For details, please refer the "Note" section of clSetKernelArg.html ]

So, I think, multiple clBuildProgram calls should work without any race condition. Are you running each instance as a separate process or thread? Can I assume that it works fine when there are upto 8 instances running on that machine?

It would be helpful if you could share the compilation error or bug you are getting. Just make sure you are using the latest driver version.

Regards,

0 Likes

I'm sorry for very late answering, I just found out that opencl-c compiler is not ready always and needs to be queried which I didn't know.

0 Likes

I forgot to use CL_DEVICE_COMPILER_AVAILABLE on all threads. My bad.

0 Likes