Block ids and SM ids

Is there any mechanism to get the ids of the currently activate SMs and possibly the ids of the blocks that are resident on a particular SM?


I don’t think there is a variable like blockIdx you can get. But I think as long as you get the id of the block and also know the number of SMs in your GPU. You can get the SM id by your self. Because CUDA assign blocks into SMs in order.

This is not true as far as I know, especially when your blocks have differing runtime.

As for your question of how the get which sm your block is running on:

I see. Thanks.

Thanks for your information.