我正在使用 gpu,想获取 gpu 的序列号。在 NVIDIA 管理库中,有一个我可以使用的函数。函数原型(prototype)是。
nvmlReturn_t nvmlDeviceGetSerial(nvmlDevice_t 设备,char* 序列号,无符号整数长度);
第一个参数是“nvmlDevice_t device”。我搜索了很多但没有找到任何返回此类型的函数。那么我怎么才能得到这个呢?
最佳答案
引自documentation序言:
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().
有了它,获得所需句柄应该是不言自明的。
关于c++ - 哪个函数在 cuda/nvml 库中返回 "nvmlDevice_t"类型变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55377048/