NVIDIA NVML NVMLUNIT_T查询
找到NVIDIA卡的NVML API的代码示例确实很少。
可以进行任何 nvml调用,需要cmake:
target_link_libraries(04_nvml_testing "/usr/lib/x86_64-linux-gnu/libnvidia-ml.so")
代码段:
nvmlReturn_t result;
unsigned int temp;
nvmlDevice_t device;
result = nvmlInit();
nvmlUnit_t unit;
unsigned int myint;
result = nvmlUnitGetHandleByIndex(0, &unit);
我可以阅读GPU温度罚款,但是在进行大量API调用之前,需要获得该卡的NVMLUNIT_T值。
Clion内部的此代码块正在踢:NVML_ERROR_INVALID_ARGUMENT
也有“可用于S系列设备”的参考。
Finding that code examples for the nvml API for nvidia cards is just really sparse.
Before any nvml calls could be conducted CMAKE required:
target_link_libraries(04_nvml_testing "/usr/lib/x86_64-linux-gnu/libnvidia-ml.so")
Code snippet:
nvmlReturn_t result;
unsigned int temp;
nvmlDevice_t device;
result = nvmlInit();
nvmlUnit_t unit;
unsigned int myint;
result = nvmlUnitGetHandleByIndex(0, &unit);
I can read the GPU temperature fine, but getting the nvmlUnit_t value of the card is required before a lot of API calls can be made.
This code block inside Clion is kicking: NVML_ERROR_INVALID_ARGUMENT
Also there is references to 'available to s-Series devices' whatever that is..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个完整的答案,而是API参考。
'''
nvmlreturn_t nvmlunitgethandlebyIndex(unsigned int index,nvmlunit_t *单元)
目标单位的索引,> = 0 and<单位单位参考
返回单元手柄的
返回
‣nvml_success是否已设置单位
‣nvml_error_uninitialialized如果未成功初始化库,
则‣nvml_error_invalid_argument(如果索引无效或单位为null null null null null
nvml_error_error_unknown null‣nvml_error_unknown上的任何出乎意料的错误
描述
都会在其特定的单位上获得其特定单位的index,则该单位。
对于S级产品。<< - 什么是S级产品。
返回的UnitCount得出的
有效索引是从NVMlunitGetCount() 。例如,如果UnitCount为2,则有效索引
为0和1,对应于单元0和单元1。
This is not a full answer but a the API reference for this.
'''
nvmlReturn_t nvmlUnitGetHandleByIndex (unsigned int index, nvmlUnit_t *unit)
The index of the target unit, >= 0 and < unitCount unit Reference in
which to return the unit handle
Returns
‣ NVML_SUCCESS if unit has been set
‣ NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
‣ NVML_ERROR_INVALID_ARGUMENT if index is invalid or unit is NULL
‣ NVML_ERROR_UNKNOWN on any unexpected error
Description
Acquire the handle for a particular unit, based on its index.
For S-class products. << - what is a S-class product.
Valid indices are derived from the unitCount returned by
nvmlUnitGetCount(). For example, if unitCount is 2 the valid indices
are 0 and 1, corresponding to UNIT 0 and UNIT 1.