Exemple #1
0
        private void createGPUTemp()
        {
            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuNum   = 2;
                    var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var gpu  = gpuArray[i];
                        var name = gpu.FullName;
                        while (this.isExistTemp(name) == true)
                        {
                            name = gpu.FullName + " #" + gpuNum++;
                        }

                        var temp = new NvAPITemp(name, i);
                        temp.onGetNvAPITemperatureHandler += onGetNvAPITemperature;
                        mSensorList.Add(temp);
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Exemple #2
0
        public override int setSpeed(int value)
        {
            if (value > mMaxSpeed)
            {
                Value = mMaxSpeed;
            }
            else if (value < mMinSpeed)
            {
                Value = mMinSpeed;
            }
            else
            {
                Value = value;
            }

            LockBus();
            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                var info     = gpuArray[mIndex].CoolerInformation;
                info.SetCoolerSettings(mCoolerID, Value);
                IsSetSpeed = true;
                Console.WriteLine("NvAPIFanControl.setSpeed() : {0}, {1}", mCoolerID, Value);
            }
            catch { }
            UnlockBus();

            LastValue = Value;
            return(Value);
        }
Exemple #3
0
        private int onGetNvAPITemperature(int index)
        {
            this.lockBus();
            int temp = 0;

            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                if (index >= gpuArray.Length)
                {
                    this.unlockBus();
                    return(temp);
                }

                var e = gpuArray[index].ThermalInformation.ThermalSensors.GetEnumerator();
                while (e.MoveNext())
                {
                    var value = e.Current;
                    temp = value.CurrentTemperature;
                    break;
                }
            }
            catch { }
            this.unlockBus();
            return(temp);
        }
Exemple #4
0
        public static void Init()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();

                if (gpus.Length == 0)
                {
                    return;
                }

                gpuList = gpus.ToList();

                List <string> gpuNames = new List <string>();

                foreach (PhysicalGPU gpu in gpus)
                {
                    gpuNames.Add(gpu.FullName);
                }

                string gpuNamesList = string.Join(", ", gpuNames);

                Logger.Log($"Initialized Nvidia API. GPU{(gpus.Length > 1 ? "s" : "")}: {gpuNamesList}");
            }
            catch (Exception e)
            {
                Logger.Log("No Nvidia GPU(s) detected. You will not be able to use CUDA implementations.");
                Logger.Log($"Failed to initialize NvApi: {e.Message}\nIgnore this if you don't have an Nvidia GPU.", true);
            }
        }
Exemple #5
0
        private int onGetNvAPIFanSpeed(int index, int coolerID)
        {
            this.lockBus();
            int speed = 0;

            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                if (index >= gpuArray.Length)
                {
                    this.unlockBus();
                    return(speed);
                }

                var e = gpuArray[index].CoolerInformation.Coolers.GetEnumerator();
                while (e.MoveNext())
                {
                    var value = e.Current;
                    if (value.CoolerId == coolerID)
                    {
                        speed = value.CurrentFanSpeedInRPM;
                        break;
                    }
                }
            }
            catch { }
            this.unlockBus();
            return(speed);
        }
Exemple #6
0
        public static Architecture GetArch(PhysicalGPU gpu)
        {
            string gpuCode = gpu.ArchitectInformation.ShortName;

            if (gpuCode.Trim().StartsWith("GF"))
            {
                return(Architecture.Fermi);
            }
            if (gpuCode.Trim().StartsWith("GK"))
            {
                return(Architecture.Kepler);
            }
            if (gpuCode.Trim().StartsWith("GM"))
            {
                return(Architecture.Maxwell);
            }
            if (gpuCode.Trim().StartsWith("GP"))
            {
                return(Architecture.Pascal);
            }
            if (gpuCode.Trim().StartsWith("TU"))
            {
                return(Architecture.Turing);
            }
            if (gpuCode.Trim().StartsWith("GA"))
            {
                return(Architecture.Ampere);
            }

            return(Architecture.Undetected);
        }
Exemple #7
0
        public Devices()
        {
            Cpus = new List <CpuDevice>((int)KokkosLibrary.GetNumaCount());

            OperatingSystem os = Environment.OSVersion;

            for (int i = 0; i < (int)KokkosLibrary.GetNumaCount(); ++i)
            {
                Cpus.Add(new CpuDevice(i,
                                       $"{os.Platform:G}",
                                       (int)KokkosLibrary.GetCoresPerNuma(),
                                       (int)KokkosLibrary.GetCoresPerNuma() * (int)KokkosLibrary.GetThreadsPerCore(),
                                       new DeviceArch(RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "x64" : "x86")));
            }

            Gpus = new List <GpuDevice>((int)KokkosLibrary.GetDeviceCount());

            uint gpuId = 0;

            foreach (PhysicalGPU physicalGpu in PhysicalGPU.GetPhysicalGPUs())
            {
                uint gpuVersion = KokkosLibrary.GetComputeCapability(gpuId);

                Gpus.Add(new CudaGpuDevice((int)gpuId,
                                           "Cuda",
                                           physicalGpu.ArchitectInformation.NumberOfCores,
                                           physicalGpu.ArchitectInformation.NumberOfCores,
                                           new DeviceArch(GetCudaDeviceName(gpuVersion), (int)gpuVersion),
                                           physicalGpu.UsageInformation));

                ++gpuId;
            }
        }
Exemple #8
0
        private void FormInfoPC_Load(object sender, EventArgs e)
        {
            var    infoPC    = new PCInformation();
            string releaseId = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString(); // ~1809 version windows

            label_totalRam.Text = "TotalRAM: " + infoPC.totalRAMGlobal + " Mb";

            label_captionWin.Text = infoPC.captionWindowsGlobal + " (" + infoPC.OSArchitectureGlobal + ")" + " | Version: " + releaseId + " | Build(" + infoPC.versionGlobal + ")";

            label_totalVirtualMemory.Text = "TotalVirtualMemory: " + infoPC.totalVirtualMemoryGlobal + " Mb";

            label_captionProcessor.Text   = "CPU Name: " + infoPC.captionProcessorGlobal;
            label_numCores.Text           = "Count Cores: " + infoPC.numberOfCoresGlobal;
            label_nameUser.Text           = "User Name: " + infoPC.nameUserGlobal;
            label_nameComputer.Text       = "Computer Name: " + infoPC.nameComputerGlobal;
            label_productKey.Text         = "Product-key: " + infoPC.serialNumberGlobal;
            label_captionMotherBoard.Text = "Model: " + infoPC.captionMotherBoardGlobal;
            label_companyMotherBoard.Text = infoPC.companyMotherBoardGlobal;
            label_captionVideoCard.Text   = infoPC.captionVideoAdapterGlobal;
            if (infoPC.captionVideoAdapterGlobal.Contains("NVIDIA"))
            {
                object[] GPU_Info          = PhysicalGPU.GetPhysicalGPUs();
                var      MemoryInformation = GPU_Info[0].GetType().GetProperty("MemoryInformation").GetValue(GPU_Info[0]);
                label_CoolerInforamtion.Text = "Cooler: " + GPU_Info[0].GetType().GetProperty("CoolerInformation").GetValue(GPU_Info[0]) + "\n";
                label_BusInfromation.Text    = GPU_Info[0].GetType().GetProperty("BusInformation").GetValue(GPU_Info[0]) + "\n";
                label_MemoryInformation.Text = "Memory: " + "~" +
                                               (Convert.ToDouble(
                                                    MemoryInformation
                                                    .GetType()
                                                    .GetProperty("AvailableDedicatedVideoMemoryInkB")
                                                    .GetValue(MemoryInformation))
                                                / 1024)
                                               .ToString()
                                               + " Mb";
                label_RAMMake.Text = "RAM Maker: " +
                                     (
                    MemoryInformation
                    .GetType()
                    .GetProperty("RAMMaker")
                    .GetValue(MemoryInformation)
                                     )
                                     .ToString();
                label_RAMType.Text = "RAM Type: " +
                                     (
                    MemoryInformation
                    .GetType()
                    .GetProperty("RAMType")
                    .GetValue(MemoryInformation)
                                     )
                                     .ToString();
            }
            else
            {
                MessageBox.Show("///GPU-Info work only NVIDIA-family///", "Err0R");
                MainForm mf = new MainForm();
                this.Close();
                mf.Show();
            }
        }
Exemple #9
0
 // ReSharper disable once InconsistentNaming
 // ReSharper disable once IdentifierTypo
 private static void PrintTCCGPUs()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetTCCPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetTCCPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.WriteObject(gpu, 0);
     }, "Select a GPU to show additional information");
 }
Exemple #10
0
        public IEnumerable <NvidiaGpuWrapper> GetPhysicalGPUs()
        {
            ICollection <NvidiaGpuWrapper> output = new HashSet <NvidiaGpuWrapper>();

            PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
            gpus.ToList().ForEach(gpu => output.Add(new NvidiaGpuWrapper(gpu)));
            return(output);
        }
Exemple #11
0
 private static void PrintGPUCoolers()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.CoolerInformation");
         ConsoleWriter.Default.WriteObject(gpu.CoolerInformation.Coolers.ToArray());
     }, "Select a GPU to show cooler values");
 }
Exemple #12
0
 private static void PrintGPUPerformanceStates()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.PerformanceStatesInfo");
         ConsoleWriter.Default.WriteObject(gpu.PerformanceStatesInfo, 3);
     }, "Select a GPU to show performance states configuration");
 }
Exemple #13
0
 private static void PrintGPUSensors()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.ThermalSensors");
         ConsoleWriter.Default.WriteObject(gpu.ThermalInformation.ThermalSensors.ToArray());
     }, "Select a GPU to show thermal sensor values");
 }
Exemple #14
0
        private void createGPUControl()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFanControl(ref mControlList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFanControl(ref mControlList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var          value         = e.Current;
                            int          coolerID      = value.CoolerId;
                            int          speed         = value.CurrentLevel;
                            int          minSpeed      = value.DefaultMinimumLevel;
                            int          maxSpeed      = value.DefaultMaximumLevel;
                            CoolerPolicy defaultPolicy = value.DefaultPolicy;

                            var name = "GPU Fan Control #" + gpuFanNum++;
                            while (this.isExistControl(name) == true)
                            {
                                name = "GPU Fan Control #" + gpuFanNum++;
                            }

                            var control = new NvAPIFanControl(name, i, coolerID, speed, minSpeed, maxSpeed, defaultPolicy);
                            control.onSetNvAPIControlHandler += onSetNvApiControl;
                            mControlList.Add(control);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Exemple #15
0
        public GPUStat(PhysicalGPU gpu)
        {
            var usage = gpu.UsageInformation;
            var mem   = gpu.MemoryInformation;

            this.gpuId = gpu.GPUId;
            this.name  = gpu.FullName;

            this.GPUPercentage   = usage.GPU.Percentage;
            this.VideoPercentage = usage.VideoEngine.Percentage;
            this.AvailableMemory = mem.CurrentAvailableDedicatedVideoMemoryInkB;
            this.TotalMemory     = mem.AvailableDedicatedVideoMemoryInkB;
        }
Exemple #16
0
        private static void Main()
        {
            var paths = new Dictionary <object, Action>
            {
                {
                    "View Embedded EDID Sample",
                    () => { BrowseEDID(Resources.EDID, "Embedded EDID Sample"); }
                },
                {
                    "Read From Display Using NVIDIA GPU",
                    () =>
                    {
                        ConsoleNavigation.PrintObject(
                            PhysicalGPU.GetPhysicalGPUs()
                            .SelectMany(gpu => gpu.GetConnectedDisplayDevices(ConnectedIdsFlag.None))
                            .ToArray(),
                            display =>
                        {
                            var edidData = display.PhysicalGPU.ReadEDIDData(display.Output);
                            BrowseEDID(edidData,
                                       $"DisplayDevice #{display.DisplayId} @ {display.PhysicalGPU.FullName} EDID Data");
                        }, "NVIDIA Displays", "Select a Display to parse EDID data.");
                    }
                },
#if !NETCOREAPP
                {
                    "Read From Windows Registry",
                    () =>
                    {
                        ConsoleNavigation.PrintObject(Display.GetDisplays().ToArray(), display =>
                        {
                            byte[] edidData;
                            using (var key = display.OpenDevicePnPKey())
                            {
                                using (var subkey = key.OpenSubKey("Device Parameters"))
                                {
                                    // ReSharper disable once PossibleNullReferenceException
                                    edidData = (byte[])subkey.GetValue("EDID", null);
                                }
                            }
                            BrowseEDID(edidData, $"{display.DisplayName} @ {display.Adapter.DeviceName} EDID Data");
                        }, "Windows Displays", "Select a Display to parse EDID data.");
                    }
                }
#endif
            };

            ConsoleNavigation.PrintNavigation(paths, "EDID Parser Sample",
                                              "Select an option to explore EDID parser functionalities.");
        }
Exemple #17
0
        private void createGPUFan()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFan(ref mFanList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFan(ref mFanList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var value = e.Current;
                            var name  = "GPU Fan #" + gpuFanNum++;
                            while (this.isExistFan(name) == true)
                            {
                                name = "GPU Fan #" + gpuFanNum++;
                            }

                            var fan = new NvAPIFanSpeed(name, i, value.CoolerId);
                            fan.onGetNvAPIFanSpeedHandler += onGetNvAPIFanSpeed;
                            mFanList.Add(fan);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Exemple #18
0
 private void onSetNvApiControl(int index, int coolerID, int value)
 {
     this.lockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         if (index >= gpuArray.Length)
         {
             this.unlockBus();
             return;
         }
         var info = gpuArray[index].CoolerInformation;
         info.SetCoolerSettings(coolerID, value);
     }
     catch { }
     this.unlockBus();
 }
Exemple #19
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].ThermalInformation.ThermalSensors.GetEnumerator();
         while (e.MoveNext())
         {
             var value = e.Current;
             Value = value.CurrentTemperature;
             break;
         }
     }
     catch { }
     UnlockBus();
 }
Exemple #20
0
        public static string GetGpuName()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
                if (gpus.Length == 0)
                {
                    return("");
                }

                return(gpus[0].FullName);
            }
            catch
            {
                return("");
            }
        }
Exemple #21
0
        /// <summary>
        ///     Creates a new DisplayDevice
        /// </summary>
        /// <param name="displayId">Display identification of the device</param>
        public DisplayDevice(uint displayId)
        {
            DisplayId = displayId;
            var extraInformation = PhysicalGPU.GetDisplayDevices().FirstOrDefault(ids => ids.DisplayId == DisplayId);

            if (extraInformation != null)
            {
                IsAvailable           = true;
                ConnectionType        = extraInformation.ConnectionType;
                IsDynamic             = extraInformation.IsDynamic;
                IsMultiStreamRootNode = extraInformation.IsMultiStreamRootNode;
                IsActive              = extraInformation.IsActive;
                IsCluster             = extraInformation.IsCluster;
                IsOSVisible           = extraInformation.IsOSVisible;
                IsWFD                 = extraInformation.IsWFD;
                IsConnected           = extraInformation.IsConnected;
                IsPhysicallyConnected = extraInformation.IsPhysicallyConnected;
            }
        }
Exemple #22
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].CoolerInformation.Coolers.GetEnumerator();
         while (e.MoveNext())
         {
             var cur = e.Current;
             if (cur.CoolerId == mCoolerID)
             {
                 LastValue = Value = cur.CurrentLevel;
                 break;
             }
         }
     }
     catch { }
     UnlockBus();
 }
Exemple #23
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].CoolerInformation.Coolers.GetEnumerator();
         while (e.MoveNext())
         {
             var value = e.Current;
             if (value.CoolerId == mCooerID)
             {
                 Value = value.CurrentFanSpeedInRPM;
                 break;
             }
         }
     }
     catch { }
     UnlockBus();
 }
        private static void PrintGPUSensors()
        {
            // NVIDIA.Initialize();

            var test = PhysicalGPU.GetPhysicalGPUs();

            PhysicalGPU.GetPhysicalGPUs();
            tamerelapute = test[0].ThermalInformation.ThermalSensors.ToArray();
            string _arraytemp = tamerelapute[0].ToString();

            string parseGPUTemp = _arraytemp.Substring(_arraytemp.IndexOf(":") + 2);

            finalGPUTemp = parseGPUTemp.Substring(0, parseGPUTemp.IndexOf("°"));

            zebilamoule = test[0].UsageInformation.GPU.ToString();
            string parseGPUsage = zebilamoule.Substring(zebilamoule.IndexOf(" ") + 1);

            finalGPUSage = parseGPUsage.Remove(parseGPUsage.Length - 1);
            Debug.WriteLine(finalGPUTemp);
            Debug.WriteLine(finalGPUSage);
        }
Exemple #25
0
        private static string GetName(PhysicalGPU physicalGpu)
        {
            string gpuName = null;

            try
            {
                gpuName = physicalGpu.FullName?.Trim();
            }
            catch (NVIDIAApiException)
            { }

            gpuName ??= "Unknown";

            if (gpuName.StartsWith("NVIDIA", StringComparison.OrdinalIgnoreCase))
            {
                return(gpuName);
            }


            return("NVIDIA " + gpuName.Trim());
        }
Exemple #26
0
        public static void GpuThread()
        {
            Debug.WriteLine("Starting Gpu");
            int gpuCycles = 0;
            var GPUs      = PhysicalGPU.GetPhysicalGPUs();



            while (true)
            {
                try
                {
                    System.Threading.Thread.Sleep(waitTime);
                    gpu = GPUs[0].UsageInformation.GPU.Percentage;
                    UpdateGraphs(0, gpu);
                    //Debug.WriteLine("updating gpu: " + gpu);
                    if (gpu > gpuThreshold)
                    {
                        if (gpuCycles < 20)
                        {
                            gpuCycles++;
                        }
                        else
                        {
                            Toast("High GPU usage detected!", "Info");
                            gpuCycles = 0;
                        }
                    }
                    else
                    {
                        gpuCycles = 0;
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    Debug.WriteLine("<---!	GPU inactive !--->");
                }
            }
        }
Exemple #27
0
        public override void setAuto()
        {
            if (IsSetSpeed == false)
            {
                return;
            }

            LockBus();
            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                var info     = gpuArray[mIndex].CoolerInformation;

                //info.RestoreCoolerSettingsToDefault(mCoolerID);
                info.SetCoolerSettings(mCoolerID, mDefaultCoolerPolicy);
                //info.SetCoolerSettings(mCoolerID, NvAPIWrapper.Native.GPU.CoolerPolicy.None);
                IsSetSpeed = false;
                Console.WriteLine("NvAPIFanControl.setAuto() : {0}", mCoolerID);
            }
            catch { }
            UnlockBus();
        }
Exemple #28
0
        public static async void Init()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
                if (gpus.Length == 0)
                {
                    return;
                }
                gpu = gpus[0];

                while (true)
                {
                    RefreshVram();
                    await Task.Delay(1000);
                }
            }
            catch (Exception e)
            {
                Logger.Log($"Failed to initialize NvApi: {e.Message}\nIgnore this if you don't have an Nvidia GPU.");
            }
        }
Exemple #29
0
        public NvidiaGPU(int adapterIndex, NvPhysicalGpuHandle handle,
                         NvDisplayHandle?displayHandle, ISettings settings, PhysicalGPU physicalGPU = null)
            : base(GetName(handle), new Identifier("nvidiagpu",
                                                   adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
        {
            this.adapterIndex  = adapterIndex;
            this.handle        = handle;
            this.displayHandle = displayHandle;
            this.physicalGPU   = physicalGPU;

            NvGPUThermalSettings thermalSettings = GetThermalSettings();

            temperatures = new Sensor[thermalSettings.Count];
            for (int i = 0; i < temperatures.Length; i++)
            {
                NvSensor sensor = thermalSettings.Sensor[i];
                string   name;
                switch (sensor.Target)
                {
                case NvThermalTarget.BOARD: name = "GPU Board"; break;

                case NvThermalTarget.GPU: name = "GPU Core"; break;

                case NvThermalTarget.MEMORY: name = "GPU Memory"; break;

                case NvThermalTarget.POWER_SUPPLY: name = "GPU Power Supply"; break;

                case NvThermalTarget.UNKNOWN: name = "GPU Unknown"; break;

                default: name = "GPU"; break;
                }
                temperatures[i] = new Sensor(name, i, SensorType.Temperature, this,
                                             new ParameterDescription[0], settings);
                ActivateSensor(temperatures[i]);
            }

            clocks    = new Sensor[3];
            clocks[0] = new Sensor("GPU Core", 0, SensorType.Clock, this, settings);
            clocks[1] = new Sensor("GPU Memory", 1, SensorType.Clock, this, settings);
            clocks[2] = new Sensor("GPU Shader", 2, SensorType.Clock, this, settings);
            for (int i = 0; i < clocks.Length; i++)
            {
                ActivateSensor(clocks[i]);
            }

            loads            = new Sensor[4];
            loads[0]         = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
            loads[1]         = new Sensor("GPU Frame Buffer", 1, SensorType.Load, this, settings);
            loads[2]         = new Sensor("GPU Video Engine", 2, SensorType.Load, this, settings);
            loads[3]         = new Sensor("GPU Bus Interface", 3, SensorType.Load, this, settings);
            memoryLoad       = new Sensor("GPU Memory", 4, SensorType.Load, this, settings);
            memoryFree       = new Sensor("GPU Memory Free", 1, SensorType.SmallData, this, settings);
            memoryUsed       = new Sensor("GPU Memory Used", 2, SensorType.SmallData, this, settings);
            memoryAvail      = new Sensor("GPU Memory Total", 3, SensorType.SmallData, this, settings);
            fan              = new Sensor("GPU Fan", 0, SensorType.Fan, this, settings);
            control          = new Sensor("GPU Fan", 1, SensorType.Control, this, settings);
            voltage          = new Sensor("GPU Voltage", 0, SensorType.Voltage, this, settings);
            powerLimit       = new Sensor("GPU Power Limit", 0, SensorType.Factor, this, settings);
            temperatureLimit = new Sensor("GPU Thermal Limit", 1, SensorType.Factor, this, settings);
            voltageLimit     = new Sensor("GPU Voltage Limit", 2, SensorType.Factor, this, settings);

            NvGPUCoolerSettings coolerSettings = GetCoolerSettings();

            if (coolerSettings.Count > 0)
            {
                fanControl = new Control(control, settings,
                                         coolerSettings.Cooler[0].DefaultMin,
                                         coolerSettings.Cooler[0].DefaultMax);
                fanControl.ControlModeChanged          += ControlModeChanged;
                fanControl.SoftwareControlValueChanged += SoftwareControlValueChanged;
                ControlModeChanged(fanControl);
                control.Control = fanControl;
            }

            if (NVML.IsInitialized)
            {
                if (NVAPI.NvAPI_GPU_GetBusId != null &&
                    NVAPI.NvAPI_GPU_GetBusId(handle, out uint busId) == NvStatus.OK)
                {
                    if (NVML.NvmlDeviceGetHandleByPciBusId != null &&
                        NVML.NvmlDeviceGetHandleByPciBusId(
                            "0000:" + busId.ToString("X2") + ":00.0", out var result)
                        == NVML.NvmlReturn.Success)
                    {
                        device           = result;
                        power            = new Sensor("GPU Power", 0, SensorType.Power, this, settings);
                        pcieThroughputRx = new Sensor("GPU PCIE Rx", 0,
                                                      SensorType.Throughput, this, settings);
                        pcieThroughputTx = new Sensor("GPU PCIE Tx", 1,
                                                      SensorType.Throughput, this, settings);
                    }
                }
            }

            Update();
        }
Exemple #30
0
 private int GetCurrentPCIeLanes()
 {
     return(GPUApi.GetCurrentPCIEDownStreamWidth(PhysicalGPU.GetPhysicalGPUs()[0].Handle));
 }