Using VS2022 the following code snippet works in debug mode but not in release mode:
nvmlInit();
nvmlDevice_t devH;
auto ret = nvmlDeviceGetHandleByIndex_v2(0, &devH);
if (ret != NVML_SUCCESS) DPrint("ERROR!");
u32 tt{};
ret = nvmlDeviceGetTemperature(devH, NVML_TEMPERATURE_GPU, &tt);
if (ret != NVML_SUCCESS) DPrint("%s\n\n", nvmlErrorString(ret));
DPrint("TEMP: %u\n", tt);
Sleep(10000);
In release mode I get NOT SUPPORTED
but in debug mode it works fine, printing the temperature. I have checked all the properties especially the linker ones and I cannot find any significant differences that would explain it. DPrint
is a simple utility to print to the output window.
CodePudding user response:
Turns out the release build was loading a different version of nvml.dll. Fixed it and now it works!