Is there an easy and reliable way to get the total amount of the physical GPU memory?
I have tried this, but the problem is it returns 4096MB and I'm using a GTX 780 with 6144MB, so yeah not displaying correctly.
Code:
using System.Management;
private void getGpuMem()
{
ManagementClass c = new ManagementClass("Win32_VideoController");
foreach (ManagementObject o in c.GetInstances())
{
string gpuTotalMem = String.Format("{0} ", o["AdapterRam"]);
Debug.Write(gpuTotalMem);
}
}
As it is said in the MSDN
Hardware that is not compatible with Windows Display Driver Model (WDDM) returns inaccurate property values for instances of this class.
That is why it returns 4gb.
You can try to use CUDAfy.net
GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
var c = gpu.GetDeviceProperties(true);
var p = c.TotalMemory;
Console.WriteLine(p);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With