我使用一些NVIDIA管理库特性在我的应用程序中生成度量标准。
每隔1秒,我就在线程中调用nvmlDeviceGetMemoryInfo(),几分钟后,在Visual的输出中,我可以读取数百个:
'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'
...来自NVML的其他函数,如nvmlDeviceGetCount()、nvmlDeviceGetHandleByIndex()、nvmlDeviceGetClockInfo()或nvmlDeviceGetUtilizationRates(),不会产生nevi64.dll的这个重要的加载/卸载。
是否有可能避免卸载这个dll,让它在我下一次调用nvmlDeviceGetMemoryInfo()时可用?
编辑:
我调用此函数是为了恢复gpu内存统计数据,如:
nvmlMemory_t memInfo;
if (nvmlDeviceGetMemoryInfo(device, &memInfo) == NVML_SUCCESS) {
this->gpuMemUsed = memInfo.used;
this->gpuMemTotal = memInfo.total;
}我在调试和发行版中看到了这些输出行,每次我调用nvmlDeviceGetMemoryInfo()时,都有一对已加载的nevi64.dll/卸载的nvasi64.dll。
NVML配备了库达V10.2。
发布于 2020-10-30 14:54:27
您可以简单地调用LoadLibraryW(L“nevi64.dll”);在这个dll之后已经没有卸载(RbMm)
这招成功了
https://stackoverflow.com/questions/64462814
复制相似问题