c++cudanvidiareturn-typenvml

Which function returns "nvmlDevice_t" type variable in cuda/nvml library?


I am working with gpu's and want to get the serial numbers of the gpu's.In NVIDIA Management Library there is a function that I can use. The function prototype is. nvmlReturn_t nvmlDeviceGetSerial ( nvmlDevice_t device, char* serial, unsigned int length ); The first parameter is "nvmlDevice_t device".I have searched a lot but does not find any function which returns this type.So how can I get this?


Solution

  • Quoting from the documentation preamble:

    This chapter describes that queries that NVML can perform against each device. In each case the device is identified with an nvmlDevice_t handle. This handle is obtained by calling one of nvmlDeviceGetHandleByIndex(), nvmlDeviceGetHandleBySerial(), nvmlDeviceGetHandleByPciBusId(). or nvmlDeviceGetHandleByUUID().

    With that, it should be fairly self-explanatory to get the handle you require.