Which SM is each block using?

Is it possible for a block of threads to discover which processor its running on?

My reason for asking is that it appears that on some GPU the clocks diverge and
re-initialising the GPU does not re-sync them. I think this happens on C2050
but does not appear to be a big problem on either (some) earlier or
(some) later GPUs.

I have a feeling this has come up before, but I could not find the answer.

All help, advice and comments are most welcome

Thank you


Yes and no.

You can read the SM identifier via the %smid special register.

But according to the notes on the opcode, the SMID “may change during execution”. I am guessing it won’t change on kernels that don’t use Dynamic Parallelism and aren’t running in a debugger.

See the PTX ISA PDF for more on %smid.

There are also a lot of posts about “smid” in this forum.

A recent one with some code is here.