public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() { DeviceBenchmarkConfig ret = new DeviceBenchmarkConfig(); ret.DeviceName = this.Name; ret.DeviceUUID = this.UUID; // init algo settings foreach (var algo in this.AlgorithmSettings) { // create/setup AlgorithmConfig conf = new AlgorithmConfig(); conf.Name = algo.AlgorithmStringID; conf.NiceHashID = algo.NiceHashID; conf.SecondaryNiceHashID = algo.SecondaryNiceHashID; conf.MinerBaseType = algo.MinerBaseType; conf.MinerName = algo.MinerName; // TODO probably not needed conf.BenchmarkSpeed = algo.BenchmarkSpeed; conf.SecondaryBenchmarkSpeed = algo.SecondaryBenchmarkSpeed; conf.ExtraLaunchParameters = algo.ExtraLaunchParameters; conf.Enabled = algo.Enabled; conf.LessThreads = algo.LessThreads; // insert ret.AlgorithmSettings.Add(conf); } return(ret); }
/// <summary> /// The GetAlgorithmDeviceConfig /// </summary> /// <returns>The <see cref="DeviceBenchmarkConfig"/></returns> public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() { DeviceBenchmarkConfig ret = new DeviceBenchmarkConfig { DeviceName = Name, DeviceUUID = UUID }; // init algo settings foreach (var algo in AlgorithmSettings) { // create/setup AlgorithmConfig conf = new AlgorithmConfig { Name = algo.AlgorithmStringID, CryptoMiner937ID = algo.CryptoMiner937ID, SecondaryCryptoMiner937ID = algo.SecondaryCryptoMiner937ID, MinerBaseType = algo.MinerBaseType, MinerName = algo.MinerName, // TODO probably not needed BenchmarkSpeed = algo.BenchmarkSpeed, SecondaryBenchmarkSpeed = algo.SecondaryBenchmarkSpeed, ExtraLaunchParameters = algo.ExtraLaunchParameters, Enabled = algo.Enabled, LessThreads = algo.LessThreads }; // insert ret.AlgorithmSettings.Add(conf); } return(ret); }
// TODO add file check and stuff like that public void SetDeviceBenchmarkConfig(DeviceBenchmarkConfig deviceBenchmarkConfig, bool forceSet = false) { DeviceBenchmarkConfig = deviceBenchmarkConfig; // check initialization if (!DeviceBenchmarkConfig.IsAlgorithmSettingsInit || forceSet) { DeviceBenchmarkConfig.IsAlgorithmSettingsInit = true; // only AMD has extra initialization if (_amdDevice != null) { // Check for optimized version if (_amdDevice.UseOptimizedVersion) { DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 512 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; } else { // this is not the same as the constructor values?? check! DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 128 --gpu-threads 4" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 256 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam; } if (!_amdDevice.Codename.Contains("Tahiti")) { DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.NeoScrypt].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 2 --thread-concurrency 8192 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam; Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + _amdDevice.Codename + ") is not Tahiti. Changing default gpu-threads to 2."); } } } }
public static void AfterDeviceQueryInitialization() { // extra check (probably will never happen but just in case) { List <ComputeDevice> invalidDevices = new List <ComputeDevice>(); foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { if (CDev.IsAlgorithmSettingsInitialized() == false) { Helpers.ConsolePrint(TAG, "CRITICAL ISSUE!!! Device has AlgorithmSettings == null. Will remove"); invalidDevices.Add(CDev); } } // remove invalids foreach (var invalid in invalidDevices) { ComputeDeviceManager.Avaliable.AllAvaliableDevices.Remove(invalid); } } // set enabled/disabled devs foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { foreach (var devConf in GeneralConfig.LastDevicesSettup) { CDev.SetFromComputeDeviceConfig(devConf); } } // create/init device benchmark configs files and configs foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { string keyUUID = CDev.UUID; BenchmarkConfigFiles[keyUUID] = new DeviceBenchmarkConfigFile(keyUUID); // init { DeviceBenchmarkConfig currentConfig = null; if (BenchmarkConfigFiles[keyUUID].IsFileExists()) { currentConfig = BenchmarkConfigFiles[keyUUID].ReadFile(); } // config exists and file load success set from file if (currentConfig != null) { CDev.SetAlgorithmDeviceConfig(currentConfig); // if new version create backup if (IsNewVersion) { BenchmarkConfigFiles[keyUUID].CreateBackup(); } } else { // no config file or not loaded, create new BenchmarkConfigFiles[keyUUID].Commit(CDev.GetAlgorithmDeviceConfig()); } } } // save settings GeneralConfigFileCommit(); }
public void SetAlgorithmDeviceConfig(DeviceBenchmarkConfig config) { if (config != null && config.DeviceUUID == Uuid && config.AlgorithmSettings != null) { // TODO why replace AlgorithmSettings? //AlgorithmSettings = DefaultAlgorithms.GetAlgorithmsForDevice(this); foreach (var conf in config.AlgorithmSettings) { var setAlgo = GetAlgorithm(conf.MinerBaseType, conf.NiceHashID, conf.SecondaryNiceHashID); if (setAlgo != null) { setAlgo.BenchmarkSpeed = conf.BenchmarkSpeed; setAlgo.ExtraLaunchParameters = conf.ExtraLaunchParameters; setAlgo.Enabled = conf.Enabled; setAlgo.LessThreads = conf.LessThreads; setAlgo.PowerUsage = conf.PowerUsage; if (setAlgo is DualAlgorithm dualSA) { dualSA.SecondaryBenchmarkSpeed = conf.SecondaryBenchmarkSpeed; var dualConf = config.DualAlgorithmSettings?.Find(a => a.SecondaryNiceHashID == dualSA.SecondaryNiceHashID); if (dualConf != null) { dualConf.FixSettingsBounds(); dualSA.IntensitySpeeds = dualConf.IntensitySpeeds; dualSA.SecondaryIntensitySpeeds = dualConf.SecondaryIntensitySpeeds; dualSA.TuningEnabled = dualConf.TuningEnabled; dualSA.TuningStart = dualConf.TuningStart; dualSA.TuningEnd = dualConf.TuningEnd; dualSA.TuningInterval = dualConf.TuningInterval; dualSA.IntensityPowers = dualConf.IntensityPowers; dualSA.UseIntensityPowers = dualConf.UseIntensityPowers; } } } } if (config == null || config.DeviceUUID != Uuid || config.PluginAlgorithmSettings == null) { return; } // plugin algorithms var pluginAlgos = AlgorithmSettings.Where(algo => algo is PluginAlgorithm).Cast <PluginAlgorithm>(); foreach (var pluginConf in config.PluginAlgorithmSettings) { var pluginAlgo = pluginAlgos .Where(pAlgo => pluginConf.PluginUUID == pAlgo.BaseAlgo.MinerID && pluginConf.AlgorithmIDs.Except(pAlgo.BaseAlgo.IDs).Count() == 0) .FirstOrDefault(); if (pluginAlgo == null) { continue; } // set plugin algo pluginAlgo.BenchmarkSpeed = pluginConf.Speeds.FirstOrDefault(); pluginAlgo.Enabled = pluginConf.Enabled; pluginAlgo.ExtraLaunchParameters = pluginConf.ExtraLaunchParameters; pluginAlgo.PowerUsage = pluginConf.PowerUsage; } } }
public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() { var ret = new DeviceBenchmarkConfig { DeviceName = Name, DeviceUUID = Uuid }; // init algo settings foreach (var algo in AlgorithmSettings) { // create/setup var conf = new AlgorithmConfig { Name = algo.AlgorithmStringID, NiceHashID = algo.NiceHashID, MinerBaseType = algo.MinerBaseType, MinerName = algo.MinerName, BenchmarkSpeed = algo.BenchmarkSpeed, ExtraLaunchParameters = algo.ExtraLaunchParameters, Enabled = algo.Enabled, LessThreads = algo.LessThreads, PowerUsage = algo.PowerUsage }; // insert ret.AlgorithmSettings.Add(conf); if (algo is DualAlgorithm dualAlgo) { conf.SecondaryNiceHashID = dualAlgo.SecondaryNiceHashID; conf.SecondaryBenchmarkSpeed = dualAlgo.SecondaryBenchmarkSpeed; DualAlgorithmConfig dualConf = new DualAlgorithmConfig { Name = algo.AlgorithmStringID, SecondaryNiceHashID = dualAlgo.SecondaryNiceHashID, IntensitySpeeds = dualAlgo.IntensitySpeeds, SecondaryIntensitySpeeds = dualAlgo.SecondaryIntensitySpeeds, TuningEnabled = dualAlgo.TuningEnabled, TuningStart = dualAlgo.TuningStart, TuningEnd = dualAlgo.TuningEnd, TuningInterval = dualAlgo.TuningInterval, IntensityPowers = dualAlgo.IntensityPowers, UseIntensityPowers = dualAlgo.UseIntensityPowers }; ret.DualAlgorithmSettings.Add(dualConf); } } return(ret); }
// TODO add file check and stuff like that public void SetDeviceBenchmarkConfig(DeviceBenchmarkConfig deviceBenchmarkConfig) { DeviceBenchmarkConfig = deviceBenchmarkConfig; // check initialization if (!DeviceBenchmarkConfig.IsAlgorithmSettingsInit) { DeviceBenchmarkConfig.IsAlgorithmSettingsInit = true; // only AMD has extra initialization if (_amdDevice != null) { // Check for optimized version if (_amdDevice.UseOptimizedVersion) { DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 1024 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 512 --thread-concurrency 0 --worksize 64 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; } else { // this is not the same as the constructor values?? check! DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Qubit].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 128 --gpu-threads 4" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Quark].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 256 --gpu-threads 1" + AmdGpuDevice.TemperatureParam; DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.Lyra2REv2].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 64 --thread-concurrency 0 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam; } if (!_amdDevice.Codename.Contains("Tahiti")) { DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.NeoScrypt].ExtraLaunchParameters = AmdGpuDevice.DefaultParam + "--nfactor 10 --xintensity 2 --thread-concurrency 8192 --worksize 64 --gpu-threads 2" + AmdGpuDevice.TemperatureParam; Helpers.ConsolePrint("ComputeDevice", "The GPU detected (" + _amdDevice.Codename + ") is not Tahiti. Changing default gpu-threads to 2."); } } // CUDA extra initializations if (_cudaDevice != null) { if (DeviceBenchmarkConfig.AlgorithmSettings.ContainsKey(AlgorithmType.CryptoNight)) { var CryptoNightAlgo = DeviceBenchmarkConfig.AlgorithmSettings[AlgorithmType.CryptoNight]; if (CryptoNightAlgo.ExtraLaunchParameters == "") { if (_cudaDevice.SM_major >= 5) { CryptoNightAlgo.ExtraLaunchParameters = "--bsleep=0 --bfactor=0 --launch=32x" + _cudaDevice.SMX.ToString(); } } } } } }
public void SetAlgorithmDeviceConfig(DeviceBenchmarkConfig config) { if (config != null && config.DeviceUUID == UUID && config.AlgorithmSettings != null) { foreach (var algoSetting in config.AlgorithmSettings) { AlgorithmType key = algoSetting.Key; AlgorithmConfig conf = algoSetting.Value; if (this.AlgorithmSettings.ContainsKey(key)) { this.AlgorithmSettings[key].BenchmarkSpeed = conf.BenchmarkSpeed; this.AlgorithmSettings[key].ExtraLaunchParameters = conf.ExtraLaunchParameters; this.AlgorithmSettings[key].Skip = conf.Skip; this.AlgorithmSettings[key].LessThreads = conf.LessThreads; } } } }
public void SetAlgorithmDeviceConfig(DeviceBenchmarkConfig config) { if (config != null && config.DeviceUUID == UUID && config.AlgorithmSettings != null) { this.AlgorithmSettings = GroupAlgorithms.CreateForDeviceList(this); foreach (var conf in config.AlgorithmSettings) { var setAlgo = GetAlgorithm(conf.MinerBaseType, conf.NiceHashID); if (setAlgo != null) { setAlgo.BenchmarkSpeed = conf.BenchmarkSpeed; setAlgo.ExtraLaunchParameters = conf.ExtraLaunchParameters; setAlgo.Enabled = conf.Enabled; setAlgo.LessThreads = conf.LessThreads; } } } }
public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() { DeviceBenchmarkConfig ret = new DeviceBenchmarkConfig(); ret.DeviceName = this.Name; ret.DeviceUUID = this.UUID; // init algo settings foreach (var algo in this.AlgorithmSettings.Values) { AlgorithmType key = algo.NiceHashID; // create/setup AlgorithmConfig conf = new AlgorithmConfig(); conf.NiceHashID = key; conf.MinerName = algo.MinerName; // TODO probably not needed conf.BenchmarkSpeed = algo.BenchmarkSpeed; conf.ExtraLaunchParameters = algo.ExtraLaunchParameters; conf.Skip = algo.Skip; conf.LessThreads = algo.LessThreads; // insert ret.AlgorithmSettings[key] = conf; } return(ret); }
public void SetAlgorithmDeviceConfig(DeviceBenchmarkConfig config) { if (config != null && config.DeviceUUID == Uuid && config.AlgorithmSettings != null) { AlgorithmSettings = GroupAlgorithms.CreateForDeviceList(this); foreach (var conf in config.AlgorithmSettings) { var setAlgo = GetAlgorithm(conf.MinerBaseType, conf.NiceHashID, conf.SecondaryNiceHashID); if (setAlgo != null) { setAlgo.BenchmarkSpeed = conf.BenchmarkSpeed; setAlgo.ExtraLaunchParameters = conf.ExtraLaunchParameters; setAlgo.Enabled = conf.Enabled; setAlgo.LessThreads = conf.LessThreads; setAlgo.PowerUsage = conf.PowerUsage; if (setAlgo is DualAlgorithm dualSA) { dualSA.SecondaryBenchmarkSpeed = conf.SecondaryBenchmarkSpeed; var dualConf = config.DualAlgorithmSettings?.Find(a => a.SecondaryNiceHashID == dualSA.SecondaryNiceHashID); if (dualConf != null) { dualConf.FixSettingsBounds(); dualSA.IntensitySpeeds = dualConf.IntensitySpeeds; dualSA.SecondaryIntensitySpeeds = dualConf.SecondaryIntensitySpeeds; dualSA.TuningEnabled = dualConf.TuningEnabled; dualSA.TuningStart = dualConf.TuningStart; dualSA.TuningEnd = dualConf.TuningEnd; dualSA.TuningInterval = dualConf.TuningInterval; dualSA.IntensityPowers = dualConf.IntensityPowers; dualSA.UseIntensityPowers = dualConf.UseIntensityPowers; } } } } } }
public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() { var ret = new DeviceBenchmarkConfig { DeviceName = Name, DeviceUUID = Uuid }; // init algo settings foreach (var algo in AlgorithmSettings) { if (algo is PluginAlgorithm pluginAlgo) { var pluginConf = new PluginAlgorithmConfig { Name = pluginAlgo.PluginName, PluginUUID = pluginAlgo.BaseAlgo.MinerID, AlgorithmIDs = pluginAlgo.BaseAlgo.IDs.ToList(), Enabled = pluginAlgo.Enabled, ExtraLaunchParameters = pluginAlgo.ExtraLaunchParameters, PluginVersion = "N/A", PowerUsage = pluginAlgo.PowerUsage, // TODO dual not supported ATM Speeds = new List <double> { pluginAlgo.BenchmarkSpeed } }; ret.PluginAlgorithmSettings.Add(pluginConf); continue; } // create/setup var conf = new AlgorithmConfig { Name = algo.AlgorithmStringID, NiceHashID = algo.NiceHashID, MinerBaseType = algo.MinerBaseType, MinerName = algo.MinerName, BenchmarkSpeed = algo.BenchmarkSpeed, ExtraLaunchParameters = algo.ExtraLaunchParameters, Enabled = algo.Enabled, LessThreads = algo.LessThreads, PowerUsage = algo.PowerUsage }; // insert ret.AlgorithmSettings.Add(conf); if (algo is DualAlgorithm dualAlgo) { conf.SecondaryNiceHashID = dualAlgo.SecondaryNiceHashID; conf.SecondaryBenchmarkSpeed = dualAlgo.SecondaryBenchmarkSpeed; DualAlgorithmConfig dualConf = new DualAlgorithmConfig { Name = algo.AlgorithmStringID, SecondaryNiceHashID = dualAlgo.SecondaryNiceHashID, IntensitySpeeds = dualAlgo.IntensitySpeeds, SecondaryIntensitySpeeds = dualAlgo.SecondaryIntensitySpeeds, TuningEnabled = dualAlgo.TuningEnabled, TuningStart = dualAlgo.TuningStart, TuningEnd = dualAlgo.TuningEnd, TuningInterval = dualAlgo.TuningInterval, IntensityPowers = dualAlgo.IntensityPowers, UseIntensityPowers = dualAlgo.UseIntensityPowers }; ret.DualAlgorithmSettings.Add(dualConf); } } return(ret); }