The well know code for getting properties from CUDA devices (!) is enumerating over all devices, and getting properties from then. Then I see such piece, that activates given device.
I have problem in reverse — let’s say the device is already chosen, and I would like to get properties for it (the active one), not for all devices present in the system.
I hope I wrote this in correct way, because I am new to CUDA.
Just call
cudaGetDevice()to get the device number of the active context, then callcudaGetDevicePropertiesto get the properties of that device. In code that would be something like:[disclaimer: written in browser, never compiled or tested. Use at own risk]