Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit f48d54b

Browse files
committed
xmr full range test, ht mode added
1 parent 725d29f commit f48d54b

File tree

4 files changed

+55
-26
lines changed

4 files changed

+55
-26
lines changed

NiceHashMiner/Devices/GroupAlgorithms.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ public static Dictionary<MinerBaseType, List<Algorithm>> CreateDefaultsForGroup(
170170
if (DeviceGroupType.AMD_OpenCL == deviceGroupType) {
171171
// DisableAMDTempControl = false; TemperatureParam must be appended lastly
172172
string RemDis = " --remove-disabled ";
173-
string DefaultParam = AmdGpuDevice.DefaultParam;
173+
string DefaultParam = RemDis + AmdGpuDevice.DefaultParam;
174174
return new Dictionary<MinerBaseType, List<Algorithm>>() {
175175
{ MinerBaseType.sgminer,
176176
new List<Algorithm>() {
177177
//new Algorithm(MinerBaseType.sgminer, AlgorithmType.NeoScrypt, "neoscrypt") { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity 2 --thread-concurrency 8192 --worksize 64 --gpu-threads 4" },
178178
//new Algorithm(MinerBaseType.sgminer, AlgorithmType.Lyra2REv2, "Lyra2REv2") { ExtraLaunchParameters = DefaultParam + "--nfactor 10 --xintensity 160 --thread-concurrency 0 --worksize 64 --gpu-threads 1" },
179179
new Algorithm(MinerBaseType.sgminer, AlgorithmType.DaggerHashimoto, "ethash") { ExtraLaunchParameters = RemDis + "--xintensity 512 -w 192 -g 1" },
180-
new Algorithm(MinerBaseType.sgminer, AlgorithmType.Decred, "decred") { ExtraLaunchParameters = RemDis + "--gpu-threads 1 --remove-disabled --xintensity 256 --lookup-gap 2 --worksize 64" },
180+
new Algorithm(MinerBaseType.sgminer, AlgorithmType.Decred, "decred") { ExtraLaunchParameters = RemDis + "--gpu-threads 1 --xintensity 256 --lookup-gap 2 --worksize 64" },
181181
new Algorithm(MinerBaseType.sgminer, AlgorithmType.Lbry, "lbry") { ExtraLaunchParameters = DefaultParam + "--xintensity 512 --worksize 128 --gpu-threads 2" },
182182
new Algorithm(MinerBaseType.sgminer, AlgorithmType.CryptoNight, "cryptonight") { ExtraLaunchParameters = DefaultParam + "--rawintensity 512 -w 4 -g 2" },
183183
new Algorithm(MinerBaseType.sgminer, AlgorithmType.Pascal, "pascal") { ExtraLaunchParameters = DefaultParam + "--intensity 21 -w 64 -g 2" },

NiceHashMiner/Forms/Form_Benchmark.cs

+46-19
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,43 @@ private enum BenchmarkSettingsStatus : int {
5454

5555
// CPU benchmarking helpers
5656
private class CPUBenchmarkStatus {
57-
public bool HasAlreadyBenchmarked = false; // after first benchmark set to true
58-
public double BenchmarkSpeed;
59-
public int LessTreads = 0;
57+
private class benchmark {
58+
public benchmark(int lt, double bench) {
59+
LessTreads = lt;
60+
Benchmark = bench;
61+
}
62+
public readonly int LessTreads;
63+
public readonly double Benchmark;
64+
}
65+
public CPUBenchmarkStatus(int max_threads) {
66+
_max_threads = max_threads;
67+
}
68+
69+
public bool HasTest() {
70+
return _cur_less_threads < _max_threads;
71+
}
72+
73+
public void SetNextSpeed(double speed) {
74+
if (HasTest()) {
75+
_benchmarks.Add(new benchmark(_cur_less_threads, speed));
76+
++_cur_less_threads;
77+
}
78+
}
79+
80+
public void FindFastest() {
81+
_benchmarks.Sort((a, b) => - a.Benchmark.CompareTo(b.Benchmark));
82+
}
83+
public double GetBestSpeed() {
84+
return _benchmarks[0].Benchmark;
85+
}
86+
public int GetLessThreads() {
87+
return _benchmarks[0].LessTreads;
88+
}
89+
90+
private readonly int _max_threads;
91+
private int _cur_less_threads = 0;
92+
private List<benchmark> _benchmarks = new List<benchmark>();
93+
public int LessTreads { get { return _cur_less_threads; } }
6094
public int Time;
6195
}
6296
private CPUBenchmarkStatus __CPUBenchmarkStatus = null;
@@ -458,8 +492,8 @@ void NextBenchmark() {
458492

459493
if (_currentDevice != null && _currentAlgorithm != null) {
460494
_currentMiner = MinerFactory.CreateMiner(_currentDevice, _currentAlgorithm);
461-
if (_currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU && _currentAlgorithm.NiceHashID == AlgorithmType.CryptoNight && string.IsNullOrEmpty(_currentAlgorithm.ExtraLaunchParameters)) {
462-
__CPUBenchmarkStatus = new CPUBenchmarkStatus();
495+
if (_currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU && _currentAlgorithm.NiceHashID == AlgorithmType.CryptoNight && string.IsNullOrEmpty(_currentAlgorithm.ExtraLaunchParameters) && _currentAlgorithm.ExtraLaunchParameters.Contains("enable_ht=true") == false) {
496+
__CPUBenchmarkStatus = new CPUBenchmarkStatus(Globals.ThreadsPerCPU);
463497
_currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads;
464498
} else {
465499
__CPUBenchmarkStatus = null;
@@ -553,20 +587,13 @@ public void OnBenchmarkComplete(bool success, string status) {
553587
_bechmarkedSuccessCount += success ? 1 : 0;
554588
bool rebenchSame = false;
555589
if(success && __CPUBenchmarkStatus != null && CPUAlgos.Contains(_currentAlgorithm.NiceHashID) && _currentAlgorithm.MinerBaseType == MinerBaseType.XmrStackCPU) {
556-
if (__CPUBenchmarkStatus.HasAlreadyBenchmarked && __CPUBenchmarkStatus.BenchmarkSpeed > _currentAlgorithm.BenchmarkSpeed) {
557-
rebenchSame = false;
558-
_currentAlgorithm.BenchmarkSpeed = __CPUBenchmarkStatus.BenchmarkSpeed;
559-
_currentAlgorithm.LessThreads--;
560-
} else {
561-
__CPUBenchmarkStatus.HasAlreadyBenchmarked = true;
562-
__CPUBenchmarkStatus.BenchmarkSpeed = _currentAlgorithm.BenchmarkSpeed;
563-
__CPUBenchmarkStatus.LessTreads++;
564-
if(__CPUBenchmarkStatus.LessTreads < Globals.ThreadsPerCPU) {
565-
_currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads;
566-
rebenchSame = true;
567-
} else {
568-
rebenchSame = false;
569-
}
590+
__CPUBenchmarkStatus.SetNextSpeed(_currentAlgorithm.BenchmarkSpeed);
591+
rebenchSame = __CPUBenchmarkStatus.HasTest();
592+
_currentAlgorithm.LessThreads = __CPUBenchmarkStatus.LessTreads;
593+
if (rebenchSame == false) {
594+
__CPUBenchmarkStatus.FindFastest();
595+
_currentAlgorithm.BenchmarkSpeed = __CPUBenchmarkStatus.GetBestSpeed();
596+
_currentAlgorithm.LessThreads = __CPUBenchmarkStatus.GetLessThreads();
570597
}
571598
}
572599

NiceHashMiner/Forms/Form_Main.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public partial class Form_Main : Form, Form_Loading.IAfterInitializationCaller,
5151
int flowLayoutPanelVisibleCount = 0;
5252
int flowLayoutPanelRatesIndex = 0;
5353

54-
const string _betaAlphaPostfixString = "-Pre-Release_01";
54+
const string _betaAlphaPostfixString = "-Pre-Release_03";
5555

5656
private bool _isDeviceDetectionInitialized = false;
5757

NiceHashMiner/Miners/XmrStackCPUMiner.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@ private string GetConfigFileName() {
202202
private void prepareConfigFile(string pool, string wallet) {
203203
if (this.MiningSetup.MiningPairs.Count > 0) {
204204
try {
205+
bool IsHyperThreadingEnabled = this.MiningSetup.MiningPairs[0].CurrentExtraLaunchParameters.Contains("enable_ht=true");
205206
int numTr = ExtraLaunchParametersParser.GetThreadsNumber(this.MiningSetup.MiningPairs[0]);
206-
//if (ComputeDeviceManager.Avaliable.IsHyperThreadingEnabled) {
207-
// numTr /= 2;
208-
//}
207+
if (IsHyperThreadingEnabled) {
208+
numTr /= 2;
209+
}
209210
var config = new XmrStackCPUMinerConfig(numTr, pool, wallet, this.APIPort);
211+
210212
//config.Inti_cpu_threads_conf(false, false, true, ComputeDeviceManager.Avaliable.IsHyperThreadingEnabled);
211-
config.Inti_cpu_threads_conf(false, false, false, false);
213+
config.Inti_cpu_threads_conf(false, false, false, IsHyperThreadingEnabled);
212214
var confJson = JObject.FromObject(config);
213215
string writeStr = confJson.ToString();
214216
int start = writeStr.IndexOf("{");

0 commit comments

Comments
 (0)