diff --git a/NiceHashMiner/Devices/GroupAlgorithms.cs b/NiceHashMiner/Devices/GroupAlgorithms.cs index cca0baf..7947cf4 100644 --- a/NiceHashMiner/Devices/GroupAlgorithms.cs +++ b/NiceHashMiner/Devices/GroupAlgorithms.cs @@ -170,14 +170,14 @@ public static Dictionary> CreateDefaultsForGroup( if (DeviceGroupType.AMD_OpenCL == deviceGroupType) { // DisableAMDTempControl = false; TemperatureParam must be appended lastly string RemDis = " --remove-disabled "; - string DefaultParam = AmdGpuDevice.DefaultParam; + string DefaultParam = RemDis + AmdGpuDevice.DefaultParam; return new Dictionary>() { { MinerBaseType.sgminer, new List() { //new Algorithm(MinerBaseType.sgminer, AlgorithmType.NeoScrypt, "neoscrypt") { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity 2 --thread-concurrency 8192 --worksize 64 --gpu-threads 4" }, //new Algorithm(MinerBaseType.sgminer, AlgorithmType.Lyra2REv2, "Lyra2REv2") { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity 160 --thread-concurrency 0 --worksize 64 --gpu-threads 1" }, new Algorithm(MinerBaseType.sgminer, AlgorithmType.DaggerHashimoto, "ethash") { ExtraLaunchParameters = RemDis + "--xintensity 512 -w 192 -g 1" }, - new Algorithm(MinerBaseType.sgminer, AlgorithmType.Decred, "decred") { ExtraLaunchParameters = RemDis + "--gpu-threads 1 --remove-disabled --xintensity 256 --lookup-gap 2 --worksize 64" }, + new Algorithm(MinerBaseType.sgminer, AlgorithmType.Decred, "decred") { ExtraLaunchParameters = RemDis + "--gpu-threads 1 --xintensity 256 --lookup-gap 2 --worksize 64" }, new Algorithm(MinerBaseType.sgminer, AlgorithmType.Lbry, "lbry") { ExtraLaunchParameters = DefaultParam + "--xintensity 512 --worksize 128 --gpu-threads 2" }, new Algorithm(MinerBaseType.sgminer, AlgorithmType.CryptoNight, "cryptonight") { ExtraLaunchParameters = DefaultParam + "--rawintensity 512 -w 4 -g 2" }, new Algorithm(MinerBaseType.sgminer, AlgorithmType.Pascal, "pascal") { ExtraLaunchParameters = DefaultParam + "--intensity 21 -w 64 -g 2" }, diff --git a/NiceHashMiner/Forms/Form_Benchmark.cs b/NiceHashMiner/Forms/Form_Benchmark.cs index 399cfd0..9ce85a1 100644 --- a/NiceHashMiner/Forms/Form_Benchmark.cs +++ b/NiceHashMiner/Forms/Form_Benchmark.cs @@ -54,9 +54,43 @@ private enum BenchmarkSettingsStatus : int { // CPU benchmarking helpers private class CPUBenchmarkStatus { - public bool HasAlreadyBenchmarked = false; // after first benchmark set to true - public double BenchmarkSpeed; - public int LessTreads = 0; + private class benchmark { + public benchmark(int lt, double bench) { + LessTreads = lt; + Benchmark = bench; + } + public readonly int LessTreads; + public readonly double Benchmark; + } + public CPUBenchmarkStatus(int max_threads) { + _max_threads = max_threads; + } + + public bool HasTest() { + return _cur_less_threads < _max_threads; + } + + public void SetNextSpeed(double speed) { + if (HasTest()) { + _benchmarks.Add(new benchmark(_cur_less_threads, speed)); + ++_cur_less_threads; + } + } + + public void FindFastest() { + _benchmarks.Sort((a, b) => - a.Benchmark.CompareTo(b.Benchmark)); + } + public double GetBestSpeed() { + return _benchmarks[0].Benchmark; + } + public int GetLessThreads() { + return _benchmarks[0].LessTreads; + } + + private readonly int _max_threads; + private int _cur_less_threads = 0; + private List _benchmarks = new List(); + public int LessTreads { get { return _cur_less_threads; } } public int Time; } private CPUBenchmarkStatus __CPUBenchmarkStatus = null; @@ -458,8 +492,8 @@ void NextBenchmark() { if (_currentDevice != null && _currentAlgorithm != null) { _currentMiner = MinerFactory.CreateMiner(_currentDevice, _currentAlgorithm); - if (_currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU && _currentAlgorithm.NiceHashID == AlgorithmType.CryptoNight && string.IsNullOrEmpty(_currentAlgorithm.ExtraLaunchParameters)) { - __CPUBenchmarkStatus = new CPUBenchmarkStatus(); + if (_currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU && _currentAlgorithm.NiceHashID == AlgorithmType.CryptoNight && string.IsNullOrEmpty(_currentAlgorithm.ExtraLaunchParameters) && _currentAlgorithm.ExtraLaunchParameters.Contains("enable_ht=true") == false) { + __CPUBenchmarkStatus = new CPUBenchmarkStatus(Globals.ThreadsPerCPU); _currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads; } else { __CPUBenchmarkStatus = null; @@ -553,20 +587,13 @@ public void OnBenchmarkComplete(bool success, string status) { _bechmarkedSuccessCount += success ? 1 : 0; bool rebenchSame = false; if(success && __CPUBenchmarkStatus != null && CPUAlgos.Contains(_currentAlgorithm.NiceHashID) && _currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU) { - if (__CPUBenchmarkStatus.HasAlreadyBenchmarked && __CPUBenchmarkStatus.BenchmarkSpeed > _currentAlgorithm.BenchmarkSpeed) { - rebenchSame = false; - _currentAlgorithm.BenchmarkSpeed = __CPUBenchmarkStatus.BenchmarkSpeed; - _currentAlgorithm.LessThreads--; - } else { - __CPUBenchmarkStatus.HasAlreadyBenchmarked = true; - __CPUBenchmarkStatus.BenchmarkSpeed = _currentAlgorithm.BenchmarkSpeed; - __CPUBenchmarkStatus.LessTreads++; - if(__CPUBenchmarkStatus.LessTreads < Globals.ThreadsPerCPU) { - _currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads; - rebenchSame = true; - } else { - rebenchSame = false; - } + __CPUBenchmarkStatus.SetNextSpeed(_currentAlgorithm.BenchmarkSpeed); + rebenchSame = __CPUBenchmarkStatus.HasTest(); + _currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads; + if (rebenchSame == false) { + __CPUBenchmarkStatus.FindFastest(); + _currentAlgorithm.BenchmarkSpeed = __CPUBenchmarkStatus.GetBestSpeed(); + _currentAlgorithm.LessThreads = __CPUBenchmarkStatus.GetLessThreads(); } } diff --git a/NiceHashMiner/Forms/Form_Main.cs b/NiceHashMiner/Forms/Form_Main.cs index 67a04b5..a00861f 100644 --- a/NiceHashMiner/Forms/Form_Main.cs +++ b/NiceHashMiner/Forms/Form_Main.cs @@ -51,7 +51,7 @@ public partial class Form_Main : Form, Form_Loading.IAfterInitializationCaller, int flowLayoutPanelVisibleCount = 0; int flowLayoutPanelRatesIndex = 0; - const string _betaAlphaPostfixString = "-Pre-Release_01"; + const string _betaAlphaPostfixString = "-Pre-Release_03"; private bool _isDeviceDetectionInitialized = false; diff --git a/NiceHashMiner/Miners/XmrStackCPUMiner.cs b/NiceHashMiner/Miners/XmrStackCPUMiner.cs index c603a84..11736e4 100644 --- a/NiceHashMiner/Miners/XmrStackCPUMiner.cs +++ b/NiceHashMiner/Miners/XmrStackCPUMiner.cs @@ -202,13 +202,15 @@ private string GetConfigFileName() { private void prepareConfigFile(string pool, string wallet) { if (this.MiningSetup.MiningPairs.Count > 0) { try { + bool IsHyperThreadingEnabled = this.MiningSetup.MiningPairs[0].CurrentExtraLaunchParameters.Contains("enable_ht=true"); int numTr = ExtraLaunchParametersParser.GetThreadsNumber(this.MiningSetup.MiningPairs[0]); - //if (ComputeDeviceManager.Avaliable.IsHyperThreadingEnabled) { - // numTr /= 2; - //} + if (IsHyperThreadingEnabled) { + numTr /= 2; + } var config = new XmrStackCPUMinerConfig(numTr, pool, wallet, this.APIPort); + //config.Inti_cpu_threads_conf(false, false, true, ComputeDeviceManager.Avaliable.IsHyperThreadingEnabled); - config.Inti_cpu_threads_conf(false, false, false, false); + config.Inti_cpu_threads_conf(false, false, false, IsHyperThreadingEnabled); var confJson = JObject.FromObject(config); string writeStr = confJson.ToString(); int start = writeStr.IndexOf("{");