I'm working on getting a CUDA application to also monitor the GPU's core temp. That information is accessible via NVAPI.
A problem is that I want to make sure I'm monitoring the same GPU as I'm running my code on.
However, there seems to be information suggesting that the device IDs I get from NvAPI_EnumPhysicalGPUs
does not correspond to the ones used with SetDeviceId
.
Could anyone clarify?
The canonical way to select a device in the runtime API is using cudaSetDevice . That will configure the runtime to perform lazy context establishment on the nominated device. Prior to CUDA 4.0, this call didn't actually establish a context, it just told the runtime which GPU to try and use.
or CUDA Driver API cuDeviceGetByPCIBusId cuDeviceGetPCIBusId . But IMO the most reliable way to know which device is which would be to use NVML or nvidia-smi to get each device's unique identifier (UUID) using nvmlDeviceGetUUID and then match it do CUDA device with pciBusId using nvmlDeviceGetPciInfo .
I saw an interesting discussion about it here.
As far as I can tell, these numbers don't have a direct correlation.
I test it in my computer with two NVIDIA GPUs GTX 550 ti.
The result is, there all information is the same, except for Bus ID.
So, in nvapi, use NvAPI_GPU_GetBusId, this will get an integer, like 1, 2,...
then, in cuda API, use cudaDeviceGetPCIBusId, this will get a string, like 0000:01:00.0.
compare the busID integer with the BusID String's second part,
you can get their relationship.
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