Reputation: 53
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..
Upvotes: 0
Views: 228
Reputation: 53
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.
Upvotes: 0