I've been trying to create a basic application that displays the total amount of graphics cards onboard the computer running the program, but have been unable to find any way to do this? Is there any framework such as NvAPI
from Nvidia that would allow for me to do this? I've already checked this question, which seems to mainly appeal to single graphics cards.
CodePudding user response:
You want to use a generic request (WMI), in order to count all the GPUs of your system.
I have two GPUs and this test passes:
// using System.Management;
private int GetGPUCount()
{
var searcher = new ManagementObjectSearcher("select * from Win32_VideoController");
return searcher.Get().Count;
}
[TestMethod]
public void CountGPUs()
{
Assert.AreEqual(2, GetGPUCount());
}