I'm looking for a reliable way to determine current GPU memory usage preferably in C++/C . I have found many ways of obtaining usage like the following methods:
- Direct Draw
- DxDiag
- WMI
- DXGI
- D3D9
Those methods are not accurate enough (most off by a hundred megabytes). I tried nvapi.h
but I didn't see anything that I could use to query for memory. I was thinking only the methods listed above were the only options but then I ran into a tool called GPU-Z
that gives me accurate memory readings to the nearest megabyte even when OpenCL runs almost full load on my 580GTX. I can verify I am at the peak of my memory usage by allocating a few more megabytes before OpenCL returns Object_Allocation fail
return code.
Looking at the imports from GPU-Z, I see nothing interesting other than:
kernel32.dll: LoadLibraryA, GetProcAddress, VirtualAlloc, VirtualFree
My guess is LoadLibraryA
must be used to load a dll for querying the GPU memory and sensors. If this dll exists, where does it live? I'm looking for a solution for AMD and NVidia if possible (using different APIs is ok).