2 Replies Latest reply on Apr 20, 2011 6:49 PM by ryta1203

    Help with reading back single value

    ryta1203

      I send a single int to the kernel.

      Every thread either updates that int with a '1' or doesn't update the int at all.

      I then want to read the int back.

      1. Is this possible in OpenCL? (I know it's possible in CUDA)

      2. Is there a special way to read back one int that I'm unaware of?

      Thanks in advance.

        • Help with reading back single value
          MicahVillmow
          ryta,
          1) Are all threads attempting to update the same location in memory?

          Most likely you want to use global atomics to atomically update a value in global memory. I'm not sure how CUDA would do it any other way and guarantee consistency.
            • Help with reading back single value
              ryta1203

               

              Originally posted by: MicahVillmow ryta, 1) Are all threads attempting to update the same location in memory? Most likely you want to use global atomics to atomically update a value in global memory. I'm not sure how CUDA would do it any other way and guarantee consistency.


              Sorry Micah, I fixed this already. I just needed to use __global * (not just int) didn't realize this, again, sorry.

              No need for consistency, like I said, they are all writing the same value or not writing at all.