I’m trying to initialize a unique counter in global memory that is shared by all blocks.
int bx = blockId.x; int tx = threadId.x; // done only once for entire launch if (!bx && !tx) counter = 0;
Would it ever be the case that block 0 was not in the first set of blocks to be executed on the device? If so, this initialization would not work correctly. I don’t know how blocks are scheduled.