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

03-02-2011, 08: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, 03: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, 11:14 AM
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.