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 call cudaGetDeviceProperties
to get the properties of that device. In code that would be something like:
int device;
cudaGetDevice(&device);
struct cudaDeviceProp props;
cudaGetDeviceProperties(&props, device);
[disclaimer: written in browser, never compiled or tested. Use at own risk]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With