public bool GetFreqDelta(ref GpuInfo info) { // Get current GPU core and memory frequency delta values int gpuDelta = 0; int memDelta = 0; ushort pStateId = 0; var result = NvApiLib.GetPStatesInfoGpuFrequencyDelta(info.Index, out gpuDelta, out pStateId); if (result == 0) { info.GpuFreqDelta = (double)gpuDelta / 1000; } else { info.GpuFreqDelta = 0; } result = NvApiLib.GetPStatesInfoMemFrequencyDelta(info.Index, out memDelta, out pStateId); if (result == 0) { info.MemFreqDelta = (double)memDelta / 1000; } else { info.MemFreqDelta = 0; } return(result == 0); }
public bool SetFreqDelta(double gpuDelta, double memDelta, ref GpuInfo info) { if (gpuDelta != info.GpuFreqDelta) { var result = NvApiLib.SetPStatesInfoGpuFrequencyDelta(info.Index, (int)(gpuDelta * 1000)); if (result == 0) { info.GpuFreqDelta = gpuDelta; } else { return(false); } } if (memDelta != info.MemFreqDelta) { var result = NvApiLib.SetPStatesInfoMemFrequencyDelta(info.Index, (int)(memDelta * 1000)); if (result == 0) { info.MemFreqDelta = memDelta; } else { return(false); } } //Set value succeeded or nothing changed return(true); }
public bool GetGpuInformation(uint index, out GpuInfo info) { StringBuilder name = new StringBuilder(64); StringBuilder bios = new StringBuilder(64); uint pid = 0; uint sid = 0; var result = NvApiLib.GetGpuInformation(index, name, bios, out pid, out sid); if (result == 0) { info = new GpuInfo(index, name.ToString(), pid, sid, bios.ToString()); } else { info = null; } return(result == 0); }
public bool GetCoolerInfo(ref GpuInfo info) { // Get fan duty uint duty = 0; uint rpm = 0; var result = NvApiLib.GetCoolerSettings(info.Index, 0, out duty, out rpm); if (result == 0) { info.CoolerLevels = duty; info.CoolerFanRpm = rpm; } else { info.CoolerLevels = 0; info.CoolerFanRpm = 0; } return(result == 0); }
/// <summary> /// Set power limit must be larger then 0 /// </summary> /// <param name="pl"></param> /// <param name="info"></param> /// <returns></returns> public bool SetPowerLimit(double pl, ref GpuInfo info) { if (pl <= 0) { return(false); } if (pl != info.PowerLimit) { var result = NvApiLib.SetDevicePowerLimit(info.Index, (uint)(pl * 1000)); if (result == 0) { info.PowerLimit = pl; } else { return(false); } } //Set value succeeded or nothing changed return(true); }
public bool GetPStateInfo(ref GpuInfo info) { var pstate = new PStateProp(); // Get PState info editable abilities var result = NvApiLib.GetPStatesInfo(info.Index, out pstate.PStateInfoEditable, out pstate.PStateEditable, out pstate.GpuFreqEditable, out pstate.MemFreqEditable, out pstate.BaseVoltEditable, out pstate.OverVoltEditable); if (result == 0) { info.PStateInfo = pstate; } else { info.PStateInfo = PStateProp.GetDefault(); } return(result == 0); }
public bool GetPowerLimit(ref GpuInfo info) { // Get power limitation uint pl = 0; uint defpl = 0; uint enfpl = 0; var result = NvApiLib.GetDevicePowerLimit(info.Index, out pl, out defpl, out enfpl); if (result == 0) { info.PowerLimit = (double)pl / 1000; info.DefaultPowerLimit = (double)defpl / 1000; info.EnforcedPowerLimit = (double)enfpl / 1000; } else { info.PowerLimit = 0; info.DefaultPowerLimit = 0; info.EnforcedPowerLimit = 0; } return(result == 0); }
/// <summary> /// Set cooler levels(fan duty), set auto fan if levels is 0 /// </summary> /// <param name="levels"></param> /// <param name="info"></param> /// <returns></returns> public bool SetCoolerInfo(uint levels, ref GpuInfo info) { if (levels == 0) { var result = NvApiLib.SetCoolerLevels(info.Index, 0, false, 0); return(result == 0); } if (info.CoolerLevels != levels) { var result = NvApiLib.SetCoolerLevels(info.Index, 0, true, levels); if (result == 0) { info.CoolerLevels = levels; } else { return(false); } } //Set value succeeded or nothing changed return(true); }