namespace cg = cooperative_groups;
int tid = cg::this_grid().thread_rank();
It’s strange that the tid
retrieved using cg::this_grid().thread_rank()
only seems to work when blockIdx.x == 0
. When I try to use this in blockIdx.x == 1
, nothing gets printed. However, if I switch to using threadIdx.x
, everything works as expected.
Why does this happen? Is cg::this_grid().thread_rank()
limited to blockIdx.x == 0
by default?