int lane = threadIdx.x % 32;
int warp_id = threadIdx.x / 32;
int warp_num = blockDim.x / 32;
Is there a more elegant way to write this, perhaps using cooperative_groups
or similar utilities like thread_rank
?
int lane = threadIdx.x % 32;
int warp_id = threadIdx.x / 32;
int warp_num = blockDim.x / 32;
Is there a more elegant way to write this, perhaps using cooperative_groups
or similar utilities like thread_rank
?
I don’t think your code is not elegant. cooperative groups does nothing different, and even looks more verbose.
auto warp = cooperative_groups::tiled_partition<32>(cooperative_groups::this_thread_block());
int lane = warp.thread_rank();
int warp_id = warp.meta_group_rank();
int warp_num = warp.meta_group_size();
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.