Skip to content

Commit

Permalink
2.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IndeedMiners committed Oct 25, 2018
1 parent c769ba3 commit 87842ec
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 54 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ xmr-stak.kdev4
cmake-build-release/
cmake-build-debug/
\.idea/

# MacOS files
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*
13 changes: 10 additions & 3 deletions doc/compile_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

## Install Dependencies

### AMD APP SDK 3.0 (only needed to use AMD GPUs)
### AMD Driver (only needed to use AMD GPUs)

- download and install the latest version from http://debian.nullivex.com/amd/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 (see https://github.com/fireice-uk/xmr-stak/issues/1511#issuecomment-385120692)
(do not wonder why it is a link to a dropbox but AMD has removed the SDK downloads, see https://community.amd.com/thread/228059)
- the AMD APP SDK is not longer needed (all is included in the driver package)
- download & unzip the AMD driver: https://www.amd.com/en/support
- run `./amdgpu-pro-install --opencl=legacy,pal` from the unzipped folder
- set the environment variable to opencl `export AMDAPPSDKROOT=/opt/amdgpu-pro/`

**ATTENTION** The linux driver 18.3 creating invalid shares.
If you have an issue with `invalid shares` please downgrade your driver or switch to ROCm.

For linux also the OpenSource driver ROCm 1.9.X+ is a well working alternative, see https://rocm.github.io/ROCmInstall.html

### Cuda 8.0+ (only needed to use NVIDIA GPUs)

Expand Down
7 changes: 6 additions & 1 deletion doc/compile_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
- CUDA/Runtime
- Driver components

### AMD APP SDK 3.0 (only needed for AMD GPUs)
### AMD DRIVER/APP SDK 3.0 (only needed for AMD GPUs)

- Download & install the AMD driver: https://www.amd.com/en/support

**ATTENTION** Many windows driver 18.5+ creating invalid shares.
If you have an issue with `invalid shares` please downgrade your driver.

- Download and install the latest version from http://amd-dev.wpengine.netdna-cdn.com/app-sdk/installers/APPSDKInstaller/3.0.130.135-GA/full/AMD-APP-SDKInstaller-v3.0.130.135-GA-windows-F-x64.exe
(do not wonder why it is a link to a netdna-cdn.com but AMD has removed the SDK downloads, see https://community.amd.com/thread/222855)
Expand Down
12 changes: 5 additions & 7 deletions xmrstak/backend/amd/amd_gpu/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
options += " -DMEMORY=" + std::to_string(hashMemSize);
options += " -DALGO=" + std::to_string(miner_algo[ii]);
options += " -DCN_UNROLL=" + std::to_string(ctx->unroll);
/* AMD driver output is something like: `1445.5 (VM)`
* and is mapped to `14` only. The value is only used for a compiler
* workaround.
*/
options += " -DOPENCL_DRIVER_MAJOR=" + std::to_string(std::stoi(openCLDriverVer.data()) / 100);

/* create a hash for the compile time cache
* used data:
Expand Down Expand Up @@ -928,13 +933,6 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx)
// create a directory for the OpenCL compile cache
create_directory(get_home() + "/.openclcache");

// check if cryptonight_monero_v8 is selected for the user or dev pool
bool useCryptonight_v8 =
::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight_monero_v8 ||
::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot() == cryptonight_monero_v8 ||
::jconf::inst()->GetCurrentCoinSelection().GetDescription(0).GetMiningAlgo() == cryptonight_monero_v8 ||
::jconf::inst()->GetCurrentCoinSelection().GetDescription(0).GetMiningAlgoRoot() == cryptonight_monero_v8;

for(int i = 0; i < num_gpus; ++i)
{
const std::string backendName = xmrstak::params::inst().openCLVendor;
Expand Down
25 changes: 22 additions & 3 deletions xmrstak/backend/amd/amd_gpu/opencl/fast_int_math_v2.cl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ R"===(
/*
* @author SChernykh
*/

// cryptonight_monero_v8
#if(ALGO==11)

static const __constant uint RCP_C[256] =
{
0xfe01be73u,0xfd07ff01u,0xfa118c5au,0xf924fb13u,0xf630cddbu,0xf558f73cu,0xf25f2934u,0xf1a3f37bu,
Expand Down Expand Up @@ -68,9 +72,21 @@ inline uint2 fast_div_v2(const __local uint *RCP, ulong a, uint b)
const ulong k = mul_hi(as_uint2(a).s0, r) + ((ulong)(r) * as_uint2(a).s1) + a;

ulong q;
((uint*)&q)[0] = as_uint2(k).s1;;
((uint*)&q)[1] = (k < a) ? 1 : 0;

((uint*)&q)[0] = as_uint2(k).s1;

#if defined(cl_amd_device_attribute_query) && (OPENCL_DRIVER_MAJOR == 14)
/* The AMD driver 14.XX is not able to compile `(k < a)`
* https://github.com/fireice-uk/xmr-stak/issues/1922
* This is a workaround for the broken compiler.
*/
ulong whyAMDwhy;
((uint*)&whyAMDwhy)[0] = as_uint2(k).s0;
((uint*)&whyAMDwhy)[1] = as_uint2(k).s1;
((uint*)&q)[1] = (whyAMDwhy < a) ? 1U : 0U;
#else
((uint*)&q)[1] = (k < a) ? 1U : 0U;
#endif

const long tmp = a - q * b;
const bool overshoot = (tmp < 0);
const bool undershoot = (tmp >= b);
Expand Down Expand Up @@ -105,4 +121,7 @@ inline uint fast_sqrt_v2(const ulong n1)

return result;
}

#endif

)==="
46 changes: 39 additions & 7 deletions xmrstak/backend/backendConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,35 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
#ifndef CONF_NO_CUDA
if(params::inst().useNVIDIA)
{
plugin nvidiaplugin("NVIDIA", "xmrstak_cuda_backend");
std::vector<iBackend*>* nvidiaThreads = nvidiaplugin.startBackend(static_cast<uint32_t>(pvThreads->size()), pWork, environment::inst());
pvThreads->insert(std::end(*pvThreads), std::begin(*nvidiaThreads), std::end(*nvidiaThreads));
if(nvidiaThreads->size() == 0)
plugin nvidiaplugin;
std::vector<iBackend*>* nvidiaThreads;
std::vector<std::string> libNames = {"xmrstak_cuda_backend_cuda10_0", "xmrstak_cuda_backend_cuda9_2", "xmrstak_cuda_backend"};
size_t numWorkers = 0u;

for( const auto & name : libNames)
{
printer::inst()->print_msg(L0, "NVIDIA: try to load library '%s'", name.c_str());
nvidiaplugin.load("NVIDIA", name);
std::vector<iBackend*>* nvidiaThreads = nvidiaplugin.startBackend(static_cast<uint32_t>(pvThreads->size()), pWork, environment::inst());
if(nvidiaThreads != nullptr)
{
pvThreads->insert(std::end(*pvThreads), std::begin(*nvidiaThreads), std::end(*nvidiaThreads));
numWorkers = nvidiaThreads->size();
delete nvidiaThreads;
}
else
{
// remove the plugin if we have found no GPUs
nvidiaplugin.unload();
}
// we found at leat one working GPU
if(numWorkers != 0)
{
printer::inst()->print_msg(L0, "NVIDIA: use library '%s'", name.c_str());
break;
}
}
if(numWorkers == 0)
printer::inst()->print_msg(L0, "WARNING: backend NVIDIA disabled.");
}
#endif
Expand All @@ -75,10 +100,17 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
if(params::inst().useAMD)
{
const std::string backendName = xmrstak::params::inst().openCLVendor;
plugin amdplugin(backendName, "xmrstak_opencl_backend");
plugin amdplugin;
amdplugin.load(backendName, "xmrstak_opencl_backend");
std::vector<iBackend*>* amdThreads = amdplugin.startBackend(static_cast<uint32_t>(pvThreads->size()), pWork, environment::inst());
pvThreads->insert(std::end(*pvThreads), std::begin(*amdThreads), std::end(*amdThreads));
if(amdThreads->size() == 0)
size_t numWorkers = 0u;
if(amdThreads != nullptr)
{
pvThreads->insert(std::end(*pvThreads), std::begin(*amdThreads), std::end(*amdThreads));
numWorkers = amdThreads->size();
delete amdThreads;
}
if(numWorkers == 0)
printer::inst()->print_msg(L0, "WARNING: backend %s (OpenCL) disabled.", backendName.c_str());
}
#endif
Expand Down
1 change: 1 addition & 0 deletions xmrstak/backend/cpu/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ bool minethd::self_test()
bResult = bResult && memcmp(out, "\x5a\x24\xa0\x29\xde\x1c\x39\x3f\x3d\x52\x7a\x2f\x9b\x39\xdc\x3d\xb3\xbc\x87\x11\x8b\x84\x52\x9b\x9f\x0\x88\x49\x25\x4b\x5\xce", 32) == 0;

hashf = func_selector(::jconf::inst()->HaveHardwareAes(), true, xmrstak_algo::cryptonight_lite);
hashf("This is a test This is a test This is a test", 44, out, ctx);
bResult = bResult && memcmp(out, "\x5a\x24\xa0\x29\xde\x1c\x39\x3f\x3d\x52\x7a\x2f\x9b\x39\xdc\x3d\xb3\xbc\x87\x11\x8b\x84\x52\x9b\x9f\x0\x88\x49\x25\x4b\x5\xce", 32) == 0;
}
else if(algo == cryptonight_monero)
Expand Down
4 changes: 4 additions & 0 deletions xmrstak/backend/nvidia/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
std::cout<<"WARNING: NVIDIA no device found"<<std::endl;
return pvThreads;
}
else
{
std::cout<<"NVIDIA: found "<< deviceCount <<" potential device's"<<std::endl;
}

size_t i, n = jconf::inst()->GetGPUThreadCount();
pvThreads->reserve(n);
Expand Down
31 changes: 19 additions & 12 deletions xmrstak/backend/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ namespace xmrstak
struct plugin
{

plugin(const std::string backendName, const std::string libName) : fn_startBackend(nullptr), m_backendName(backendName)
plugin() = default;

void load(const std::string backendName, const std::string libName)
{
m_backendName = backendName;
#ifdef WIN32
libBackend = LoadLibrary(TEXT((libName + ".dll").c_str()));
if(!libBackend)
Expand Down Expand Up @@ -81,32 +84,36 @@ struct plugin
if(fn_startBackend == nullptr)
{
std::vector<iBackend*>* pvThreads = new std::vector<iBackend*>();
std::cerr << "WARNING: " << m_backendName << " Backend disabled"<< std::endl;
return pvThreads;
}

return fn_startBackend(threadOffset, pWork, env);
}

void unload()
{
if(libBackend)
{
#ifdef WIN32
FreeLibrary(libBackend);
#else
dlclose(libBackend);
#endif
}
fn_startBackend = nullptr;
}

std::string m_backendName;

typedef std::vector<iBackend*>* (*startBackend_t)(uint32_t threadOffset, miner_work& pWork, environment& env);

startBackend_t fn_startBackend;
startBackend_t fn_startBackend = nullptr;

#ifdef WIN32
HINSTANCE libBackend;
#else
void *libBackend;
#endif

/* \todo add unload to destructor and change usage of plugin that libs kept open until the miner ends
#ifdef WIN32
FreeLibrary(libBackend);
#else
dlclose(libBackend);
void *libBackend = nullptr;
#endif
* */
};

} // namespace xmrstak
16 changes: 8 additions & 8 deletions xmrstak/cli/cli-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,14 +790,14 @@ int main(int argc, char *argv[])
printer::inst()->print_str("'c' - connection\n");
printer::inst()->print_str("-------------------------------------------------------------------\n");
printer::inst()->print_str("Upcoming xmr-stak-gui is sponsored by:\n");
printer::inst()->print_str(" ##### ______ _____\n");
printer::inst()->print_str(" ## ## | ___ \\ / __ \\\n");
printer::inst()->print_str("# _ #| |_/ /_ _ ___ | / \\/ _ _ _ _ _ _ ___ _ __ ___ _ _\n");
printer::inst()->print_str("# |_| #| /| | | | / _ \\ | | | | | || '_|| '_|/ _ \\| '_ \\ / __|| | | |\n");
printer::inst()->print_str("# #| |\\ \\| |_| || (_) || \\__/\\| |_| || | | | | __/| | | || (__ | |_| |\n");
printer::inst()->print_str(" ## ## \\_| \\_|\\__, | \\___/ \\____/ \\__,_||_| |_| \\___||_| |_| \\___| \\__, |\n");
printer::inst()->print_str(" ##### __/ | __/ |\n");
printer::inst()->print_str(" |___/ https://ryo-currency.com |___/\n\n");
printer::inst()->print_str(" ##### ______ ____\n");
printer::inst()->print_str(" ## ## | ___ \\ / _ \\\n");
printer::inst()->print_str("# _ #| |_/ /_ _ ___ | / \\/ _ _ _ _ _ _ ___ _ __ ___ _ _\n");
printer::inst()->print_str("# |_| #| /| | | | / _ \\ | | | | | || '_|| '_|/ _ \\| '_ \\ / __|| | | |\n");
printer::inst()->print_str("# #| |\\ \\| |_| || (_) || \\_/\\| |_| || | | | | __/| | | || (__ | |_| |\n");
printer::inst()->print_str(" ## ## \\_| \\_|\\__, | \\___/ \\____/ \\__,_||_| |_| \\___||_| |_| \\___| \\__, |\n");
printer::inst()->print_str(" ##### __/ | __/ |\n");
printer::inst()->print_str(" |___/ https://ryo-currency.com |___/\n\n");
printer::inst()->print_str("This currency is a way for us to implement the ideas that we were unable to in\n");
printer::inst()->print_str("Monero. See https://github.com/fireice-uk/cryptonote-speedup-demo for details.\n");
printer::inst()->print_str("-----------------------------Compiled by Indeed Miners-----------------------------\n");
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/jconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ xmrstak::coin_selection coins[] = {
{ "cryptonight_v7", {cryptonight_monero_v8, cryptonight_monero, 255u}, {cryptonight_monero_v8, cryptonight_monero, 8u}, nullptr },
{ "cryptonight_v8", {cryptonight_monero, cryptonight_monero_v8, 255u}, {cryptonight_monero_v8, cryptonight_monero, 8u}, nullptr },
{ "cryptonight_v7_stellite", {cryptonight_monero_v8, cryptonight_stellite, 255u}, {cryptonight_monero_v8, cryptonight_monero_v8, 0u}, nullptr },
{ "graft", {cryptonight_monero_v8, cryptonight_monero, 255u}, {cryptonight_monero_v8, cryptonight_monero, 8u}, nullptr },
{ "graft", {cryptonight_monero_v8, cryptonight_monero, 11u}, {cryptonight_monero_v8, cryptonight_monero, 8u}, nullptr },
{ "haven", {cryptonight_heavy, cryptonight_haven, 255u}, {cryptonight_heavy, cryptonight_heavy, 0u}, nullptr },
{ "intense", {cryptonight_monero_v8, cryptonight_monero, 255u}, {cryptonight_monero_v8, cryptonight_monero, 8u}, nullptr },
{ "masari", {cryptonight_monero_v8, cryptonight_masari, 255u}, {cryptonight_monero_v8, cryptonight_monero_v8, 0u},nullptr },
Expand Down
6 changes: 3 additions & 3 deletions xmrstak/misc/coinDescription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace xmrstak
{
struct coinDescription
{
xmrstak_algo algo;
xmrstak_algo algo_root;
uint8_t fork_version;
xmrstak_algo algo = xmrstak_algo::invalid_algo;
xmrstak_algo algo_root = xmrstak_algo::invalid_algo;
uint8_t fork_version = 0u;

coinDescription() = default;

Expand Down
10 changes: 7 additions & 3 deletions xmrstak/misc/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ void executor::ex_main()
case cryptonight_aeon:
case cryptonight_lite:
if(dev_tls)
pools.emplace_front(0, "indeedminers.eu:7788", "", "", "", 0.0, true, false, "", true);
pools.emplace_front(0, "indeedminers.eu:2222", "", "", "", 0.0, true, false, "", true);
else
pools.emplace_front(0, "indeedminers.eu:7788", "", "", "", 0.0, true, false, "", true);
pools.emplace_front(0, "indeedminers.eu:2222", "", "", "", 0.0, true, false, "", true);
break;

case cryptonight:
Expand Down Expand Up @@ -627,8 +627,12 @@ void executor::ex_main()
break;

case EV_GPU_RES_ERROR:
log_result_error(std::string(ev.oGpuError.error_str + std::string(" GPU ID ") + std::to_string(ev.oGpuError.idx)));
{
std::string err_msg = std::string(ev.oGpuError.error_str) + " GPU ID " + std::to_string(ev.oGpuError.idx);
printer::inst()->print_msg(L0, err_msg.c_str());
log_result_error(std::move(err_msg));
break;
}

case EV_PERF_TICK:
for (i = 0; i < pvThreads->size(); i++)
Expand Down
10 changes: 7 additions & 3 deletions xmrstak/misc/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ telemetry::telemetry(size_t iThd)
ppHashCounts = new uint64_t*[iThd];
ppTimestamps = new uint64_t*[iThd];
iBucketTop = new uint32_t[iThd];
mtx = new std::mutex[iThd];

for (size_t i = 0; i < iThd; i++)
{
Expand All @@ -49,15 +50,17 @@ telemetry::telemetry(size_t iThd)

double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread)
{
std::unique_lock<std::mutex> lk(mtx);
uint64_t iTimeNow = get_timestamp_ms();


uint64_t iEarliestHashCnt = 0;
uint64_t iEarliestStamp = 0;
uint64_t iLatestStamp = 0;
uint64_t iLatestHashCnt = 0;
bool bHaveFullSet = false;

std::unique_lock<std::mutex> lk(mtx[iThread]);
uint64_t iTimeNow = get_timestamp_ms();

//Start at 1, buckettop points to next empty
for (size_t i = 1; i < iBucketSize; i++)
{
Expand All @@ -81,6 +84,7 @@ double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread)
iEarliestStamp = ppTimestamps[iThread][idx];
iEarliestHashCnt = ppHashCounts[iThread][idx];
}
lk.unlock();

if (!bHaveFullSet || iEarliestStamp == 0 || iLatestStamp == 0)
return nan("");
Expand All @@ -99,7 +103,7 @@ double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread)

void telemetry::push_perf_value(size_t iThd, uint64_t iHashCount, uint64_t iTimestamp)
{
std::unique_lock<std::mutex> lk(mtx);
std::unique_lock<std::mutex> lk(mtx[iThd]);
size_t iTop = iBucketTop[iThd];
ppHashCounts[iThd][iTop] = iHashCount;
ppTimestamps[iThd][iTop] = iTimestamp;
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/misc/telemetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class telemetry
double calc_telemetry_data(size_t iLastMillisec, size_t iThread);

private:
mutable std::mutex mtx;
std::mutex* mtx;
constexpr static size_t iBucketSize = 2 << 11; //Power of 2 to simplify calculations
constexpr static size_t iBucketMask = iBucketSize - 1;
uint32_t* iBucketTop;
Expand Down
Loading

0 comments on commit 87842ec

Please sign in to comment.