c++ - Get GPU memory usage progamatically -


i'm looking reliable way determine current gpu memory usage preferably in c++/c . have found many ways of obtaining usage following methods:

  • direct draw
  • dxdiag
  • wmi
  • dxgi
  • d3d9

those methods not accurate enough (most off hundred megabytes). tried nvapi.h didn't see use query memory. thinking methods listed above options ran tool called gpu-z gives me accurate memory readings nearest megabyte when opencl runs full load on 580gtx. can verify @ peak of memory usage allocating few more megabytes before opencl returns object_allocation fail return code.

looking @ imports gpu-z, see nothing interesting other than:

kernel32.dll: loadlibrarya, getprocaddress, virtualalloc, virtualfree

my guess loadlibrarya must used load dll querying gpu memory , sensors. if dll exists, live? i'm looking solution amd , nvidia if possible (using different apis ok).

cudamemgetinfo (documented here) requires nothing other cuda runtime api free memory , total memory on current device.

and erik pointed out, there similar functionality in nvml.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -