cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bubu
Adept II

CL contexts doubts

1. Can a context have devices from different platforms? Or is it restricted to an unique platform?

2. 1 context = 1 thread? Or can I call CL functions for a context from multiple threads? For instance: can I launch two kernels from the same context, one from threadA and the other from threadB.

thx

0 Likes
4 Replies
nou
Exemplar

1. no all devices in context must belongs to same platform.

2. OpenCL calls are all thread safe. if you use different kernels then you can launch it from multiple threads. there is race condition in clSetKernelArg() so you must use mutexs or distinct kernels.

0 Likes
himanshu_gautam
Grandmaster

Hi Please go through the opencl spec 1.2 for more details.

0 Likes

I ask here cuz it's not really clear to me what spec 1.2 says

0 Likes

Ok not a problem. 1. You can not have devices from different platforms. All the devices should be from the same platform. 2. you can have as many kernels you want in a single context and can be launched with multiple threads. But you must be careful when the output of one kernel is input to the other.

0 Likes