cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

ryta1203
Journeyman III

Help with reading back single value

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.

0 Likes
2 Replies

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.
0 Likes

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.

0 Likes