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

Commit

Permalink
xmr full range test, ht mode added
Browse files Browse the repository at this point in the history
  • Loading branch information
S74nk0 committed Apr 10, 2017
1 parent 725d29f commit f48d54b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 26 deletions.
4 changes: 2 additions & 2 deletions NiceHashMiner/Devices/GroupAlgorithms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ public static Dictionary<MinerBaseType, List<Algorithm>> 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, List<Algorithm>>() {
{ MinerBaseType.sgminer,
new List<Algorithm>() {
//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" },
Expand Down
65 changes: 46 additions & 19 deletions NiceHashMiner/Forms/Form_Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<benchmark> _benchmarks = new List<benchmark>();
public int LessTreads { get { return _cur_less_threads; } }
public int Time;
}
private CPUBenchmarkStatus __CPUBenchmarkStatus = null;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion NiceHashMiner/Forms/Form_Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 6 additions & 4 deletions NiceHashMiner/Miners/XmrStackCPUMiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("{");
Expand Down

0 comments on commit f48d54b

Please sign in to comment.