View Full Version : How can i create or use a critical section in OpenCL?

03-02-2011, 09:30 AM

Already exist a critical section sentence in OpenCL?
If there is not, how can i create a critical section in OpenCL?

Very Thanks,

Luiz Drumond.

03-02-2011, 04:06 PM
There is no builtin function to create a critical section. Notice that by definition a critical section runs sequentially and will hurt performance a lot.

03-03-2011, 12:14 PM
You can use the atomic functions (if your platform/device supports the extension) to implement a critical section (look at wikipedias critical section page, you can use atomic instructions to create a mutex).

But, as David mentioned, it will really hurt performance. Some algorithms have no alternative, but make sure it's your last resort.