static void Main(string[] args) { var numGPUs = GetNumberOfGPUs(); if (numGPUs <= 0) { Console.WriteLine("Could not get GPU data!"); } else { Console.WriteLine("Num GPUs: " + numGPUs + "\n"); for (UInt32 i = 1; i <= numGPUs; i++) { var gpuInfo = new GPUInfo(); if (GetGPUInfo(i, ref gpuInfo)) { Console.WriteLine("GPU " + i + ":"); Console.WriteLine("\tName: " + gpuInfo.name); Console.WriteLine("\tBIOS: " + gpuInfo.bios); Console.WriteLine("\tvRam: " + (gpuInfo.ramSize / 1024) + "MB " + gpuInfo.ramType); Console.WriteLine("\tCore Clock: " + (gpuInfo.currentCoreClock / 1000) + "MHz"); Console.WriteLine("\tvRam Clock: " + (gpuInfo.currentRamClock / 1000) + "MHz"); Console.WriteLine("\tCore Overclock: " + (gpuInfo.currentCoreOverclock / 1000) + "MHz"); Console.WriteLine("\tvRam Overclock: " + (gpuInfo.currentRamOverclock / 1000) + "MHz"); Console.WriteLine(""); } else { Console.WriteLine("Could not get info for GPU " + i + "!\n"); } } } }
static extern bool GetGPUInfo([In] UInt32 gpuIndex, [In, Out] ref GPUInfo gpuInfo);