atomicAdd on uint8_t or unsigned char

Hello,

Is there was any way to preform an atomicadd on an uint8_t or unsigned char.

I am assigning an array to shared memory “shared int Board[Dim*Dim];” however the numbers that the array is filled with are all <=255 and im ruining out of memory per block. So to use a 1 byte variable is more than sufficient for me.

If you have any advice please reply. Thanks!

See this thread: How to use atomicCAS() to implement atomicAdd(short)?.

Sorry to revive a super-old thread, just linking a more detailed answer here for posterity: https://stackoverflow.com/a/59329536/844728 (also based on tera’s work)