CUDA to OpenCL : '__any'


I’m searching for the best way to convert the ‘__any’ instruction from CUDA to OpenCL, but honnestly I find nothing !
Do you have an idea ?


This post suggests that there is no direct equivalent and that you would have to use “__local arrays and parallel reduction”. However, I wonder what OpenCL code Swan would generate for CUDA code containing __any (or __all).


Swan is not able to convert everything !

The solution I have now is something like this :

// CUDA : bool searchingLeaf = true;

__local int searchingLeaf;

if (lid < 1) searchingLeaf = 0;

// CUDA : searchingLeaf = false;


// CUDA : if (!__any(searchingLeaf)) break;

if (searchingLeaf > 31) break;