Omp critical within a target region


Please let me know if omp critical is supported within an omp target region. With the 22.1 HPC SDK I get the following error

NVC+±F-1196-OpenMP - omp critical is not supported in GPU region

I have a function call within the critical region, so any workarounds will be of much help. Or do we know which SDK version will provide support for it.

Thanks and regards


Hi Nitya,

Correct, critical regions are not supported in device code. This requires global barriers which are not supported. Even if they were supported, the performance would be extremely poor so you wouldn’t want to use it.

You’ll need to rethink your algorithm to use atomics or split the offload into two sections, the section before and after the critical.