Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algo balancing #152

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4ed5358
Added new --calibrate-algo and --save-config command line options
MoneroOcean Jul 28, 2018
27c508b
Report all possible algorithms to the pool
MoneroOcean Jul 28, 2018
456cbbf
Added perf algo (PerfAlgo) basic support
MoneroOcean Jul 28, 2018
96eacfb
Added support for extended threads and algo-perf config parameters
MoneroOcean Jul 28, 2018
c17bfd3
Added xmrig::Algorithm parameter to autoConf function
MoneroOcean Jul 28, 2018
692088c
Support for OpenCL object release
MoneroOcean Jul 28, 2018
5e7c5b5
Semantic bug fix for cryptonight-heavy/0 OpenCL code
MoneroOcean Jul 28, 2018
0abc185
Added algo performance calibration (benchmarking) functionality
MoneroOcean Jul 28, 2018
976973b
Added pool job algo switch functionality
MoneroOcean Jul 28, 2018
968a8f7
Set m_calibrateAlgo to false by default
MoneroOcean Aug 1, 2018
3a3c628
Set m_saveConfig to false by default
MoneroOcean Aug 1, 2018
93f34fc
Calibrate and save algo-perf automatically
MoneroOcean Aug 1, 2018
84b0240
Added --calibrate-algo-time command line switch support
MoneroOcean Aug 4, 2018
922fb98
Fixed warning about signed/unsigned comparision
MoneroOcean Aug 4, 2018
36b3494
Added user info about current benchmark round length
MoneroOcean Aug 4, 2018
979102a
Added calibrate-algo and calibrate-algo-time save in config file and …
MoneroOcean Aug 4, 2018
3a47cf5
Script for Windows build
MoneroOcean Aug 5, 2018
982eedb
Moved from PerfAlgo to Algo in threads to removed not really used cn-…
MoneroOcean Aug 6, 2018
c8c3628
ALGO_INVALID -> INVALID_ALGO
MoneroOcean Aug 6, 2018
249723f
Restore original algorithm after benchmark
MoneroOcean Aug 6, 2018
20a5398
Removed wrong const word
MoneroOcean Aug 6, 2018
cd13031
Added Algorithm.h
MoneroOcean Aug 6, 2018
a7b7902
Fixed GPU context handling bugs
MoneroOcean Aug 8, 2018
66a50b4
Allow integer algo-perf values
MoneroOcean Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added perf algo (PerfAlgo) basic support
  • Loading branch information
MoneroOcean committed Jul 28, 2018
commit 456cbbf71862cb0cf5813f52fd69bb0c5f154b3a
49 changes: 49 additions & 0 deletions src/common/crypto/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -223,3 +224,51 @@ const char *xmrig::Algorithm::name(bool shortName) const

return "invalid";
}


// returns string name of the PerfAlgo
const char *xmrig::Algorithm::perfAlgoName(const xmrig::PerfAlgo pa) {
static const char* perf_algo_names[xmrig::PerfAlgo::PA_MAX] = {
"cn",
"cn-fast",
"cn-lite",
"cn-heavy",
};
return perf_algo_names[pa];
}

// constructs Algorithm from PerfAlgo
xmrig::Algorithm::Algorithm(const xmrig::PerfAlgo pa) {
switch (pa) {
case PA_CN:
m_algo = xmrig::CRYPTONIGHT;
m_variant = xmrig::VARIANT_1;
break;
case PA_CN_FAST:
m_algo = xmrig::CRYPTONIGHT;
m_variant = xmrig::VARIANT_MSR;
break;
case PA_CN_LITE:
m_algo = xmrig::CRYPTONIGHT_LITE;
m_variant = xmrig::VARIANT_1;
break;
case PA_CN_HEAVY:
m_algo = xmrig::CRYPTONIGHT_HEAVY;
m_variant = xmrig::VARIANT_0;
break;
default:
m_algo = xmrig::INVALID_ALGO;
m_variant = xmrig::VARIANT_AUTO;
}
}

// returns PerfAlgo that corresponds to current Algorithm
xmrig::PerfAlgo xmrig::Algorithm::perf_algo() const {
if (m_variant == VARIANT_MSR) return PA_CN_FAST;
switch (m_algo) {
case CRYPTONIGHT: return PA_CN;
case CRYPTONIGHT_LITE: return PA_CN_LITE;
case CRYPTONIGHT_HEAVY: return PA_CN_HEAVY;
default: return PA_INVALID;
}
}
6 changes: 6 additions & 0 deletions src/common/crypto/Algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -49,15 +50,20 @@ class Algorithm
setAlgo(algo);
}

// constructs Algorithm from PerfAlgo
Algorithm(const xmrig::PerfAlgo);

inline Algorithm(const char *algo)
{
parseAlgorithm(algo);
}

bool isEqual(const Algorithm &other) const { return m_algo == other.m_algo && m_variant == other.m_variant; }
inline Algo algo() const { return m_algo; }
xmrig::PerfAlgo perf_algo() const; // returns PerfAlgo that corresponds to current Algorithm
inline const char *name() const { return name(false); }
inline const char *shortName() const { return name(true); }
static const char *perfAlgoName(xmrig::PerfAlgo); // returns string name of the PerfAlgo
inline Variant variant() const { return m_variant; }
inline void setVariant(Variant variant) { m_variant = variant; }

Expand Down
10 changes: 10 additions & 0 deletions src/common/xmrig.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,6 +37,15 @@ enum Algo {
CRYPTONIGHT_HEAVY /* CryptoNight-Heavy (RYO) */
};

// algorithms that can has different performance
enum PerfAlgo {
PA_INVALID = -1,
PA_CN, /* CryptoNight (Monero) */
PA_CN_FAST, /* CryptoNight-Fast (Masari) */
PA_CN_LITE, /* CryptoNight-Lite (AEON) */
PA_CN_HEAVY, /* CryptoNight-Heavy (RYO) */
PA_MAX
};

//--av=1 For CPUs with hardware AES.
//--av=2 Lower power mode (double hash) of 1.
Expand Down