9 Replies Latest reply on Sep 13, 2013 7:45 PM by mainul

    porting Cuda atomicInc to OpenCL



      I have started working on OpenCL very recently.

      I was porting some CUDA kernels to OpenCL kernels.

      In one of the kernel, I found a statement like this:


      int res = atomicInc(classified, (unsigned int)objects.cols);


      I want to port this line to OpenCL. OpenCL has an atomic_inc

      function but that does not take two parameters, that only takes one parameter.


      In CUDA, atomicInc first compares and then increment.

      I want to have the same functionality as CUDA in OpenCL.


      Could anyone show me the right way? How can I implement CUDA atomicInc functionality

      in OpenCL's atomicInc?

      Any idea would be appreciated.