How to get properties from an active CUDA device?

Well-known code to get properties from CUDA devices (!) Will list all the devices and then get the properties. Then I see the part that activates this device.

I have a problem in the reverse order - let's say the device is already selected, and I would like to get properties for it (active), and not for all devices present in the system.

Hope I wrote this correctly because I am new to CUDA.

+5
source share
1 answer

Just call cudaGetDevice()to get the device number of the active context, then call cudaGetDevicePropertiesto get the properties of this device. In code that will look something like this:

int device;
cudaGetDevice(&device);

struct cudaDeviceProp props;
cudaGetDeviceProperties(&props, device);

[ : , . ]

+9

All Articles