Take the 2-minute tour ×

I would like to be able to use a feature in PTX 1.3 which is not yet implemented it the C interface. Is there a way to write my own function in PTX and inject into an existing binary?

The feature I'm looking for is getting the value of %smid

share|improve this question

1 Answer 1

up vote 6 down vote accepted

The answer:

__noinline__ __device__ uint get_smid(void)
    uint ret;
    asm("mov.u32 %0, %smid;" : "=r"(ret) );
    return ret;
share|improve this answer

Your Answer


