Sam*_*amT 5 c++ windows dll nvml
我使用一些 NVIDIA 管理库功能在我的应用程序中生成指标。
每 1 秒我在一个线程中调用 nvmlDeviceGetMemoryInfo(),几分钟后,在 Visual Studio 的输出中,我可以读取数百个:
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
Run Code Online (Sandbox Code Playgroud)
来自 NVML 的其他函数,如 nvmlDeviceGetCount()、nvmlDeviceGetHandleByIndex()、nvmlDeviceGetClockInfo() 或 nvmlDeviceGetUtilizationRates() 不会产生这种实时加载/卸载 nvapi64.dll。
是否可以避免卸载此 dll,以使其可用于我下次调用 nvmlDeviceGetMemoryInfo() ?
编辑 :
我调用这个函数来检索这样的 gpu 内存统计信息:
nvmlMemory_t memInfo;
if (nvmlDeviceGetMemoryInfo(device, &memInfo) == NVML_SUCCESS) {
this->gpuMemUsed = memInfo.used;
this->gpuMemTotal = memInfo.total;
}
Run Code Online (Sandbox Code Playgroud)
我在 Debug 和 Release 中看到这些输出行,每次我调用 nvmlDeviceGetMemoryInfo() 时都会有几个 Loaded nvapi64.dll / Unloaded nvapi64.dll
NVML 随 Cuda V10.2 一起提供。
| 归档时间: |
|
| 查看次数: |
270 次 |
| 最近记录: |