Skip to content

Commit

Permalink
Merge pull request #2392 from fireice-uk/dev
Browse files Browse the repository at this point in the history
release 2.10.4
  • Loading branch information
fireice-uk authored Apr 1, 2019
2 parents 2cd84c8 + c2618d7 commit a5b8fb7
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 47 deletions.
6 changes: 1 addition & 5 deletions xmrstak/backend/amd/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ void minethd::work_main()
lck.release();
std::this_thread::yield();

uint64_t iCount = 0;
cryptonight_ctx* cpu_ctx;
cpu_ctx = cpu::minethd::minethd_alloc_ctx();

Expand Down Expand Up @@ -288,10 +287,7 @@ void minethd::work_main()
executor::inst()->push_event(ex_event("AMD Invalid Result", pGpuCtx->deviceIdx, oWork.iPoolId));
}

iCount += pGpuCtx->rawIntensity;
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
updateStats(pGpuCtx->rawIntensity, oWork.iPoolId);

accRuntime += updateTimings(pGpuCtx, t0);

Expand Down
6 changes: 3 additions & 3 deletions xmrstak/backend/cpu/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ void minethd::multiway_work_main()

cryptonight_ctx* ctx[MAX_N];
uint64_t iCount = 0;
uint64_t iLastCount = 0;
uint64_t* piHashVal[MAX_N];
uint32_t* piNonce[MAX_N];
uint8_t bHashOut[MAX_N * 32];
Expand Down Expand Up @@ -915,9 +916,8 @@ void minethd::multiway_work_main()
{
if((iCount++ & 0x7) == 0) //Store stats every 8*N hashes
{
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount * N, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
updateStats((iCount - iLastCount) * N, oWork.iPoolId);
iLastCount = iCount;
}

nonce_ctr -= N;
Expand Down
24 changes: 24 additions & 0 deletions xmrstak/backend/iBackend.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "xmrstak/backend/globalStates.hpp"
#include "xmrstak/net/msgstruct.hpp"

#include <atomic>
#include <climits>
Expand Down Expand Up @@ -46,6 +47,29 @@ struct iBackend
std::atomic<uint64_t> iTimestamp;
uint32_t iThreadNo;
BackendType backendType = UNKNOWN;
uint64_t iLastStamp = get_timestamp_ms();
double avgHashPerMsec = 0.0;

void updateStats(uint64_t numNewHashes, size_t poolId)
{
uint64_t iStamp = get_timestamp_ms();
double timeDiff = static_cast<double>(iStamp - iLastStamp);
iLastStamp = iStamp;

if(poolId == 0)
{
// if dev pool is active interpolate the number of shares (avoid hash rate drops)
numNewHashes = static_cast<uint64_t>(avgHashPerMsec * timeDiff);
}
else
{
const double hashRatePerMs = static_cast<double>(numNewHashes) / timeDiff;
constexpr double averagingBias = 0.1;
avgHashPerMsec = avgHashPerMsec * (1.0 - averagingBias) + hashRatePerMs * averagingBias;
}
iHashCount.fetch_add(numNewHashes, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
}

iBackend() :
iHashCount(0),
Expand Down
8 changes: 1 addition & 7 deletions xmrstak/backend/nvidia/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ void minethd::work_main()
// wait until all NVIDIA devices are initialized
thread_work_guard.wait();

uint64_t iCount = 0;
cryptonight_ctx* cpu_ctx;
cpu_ctx = cpu::minethd::minethd_alloc_ctx();

Expand Down Expand Up @@ -297,13 +296,8 @@ void minethd::work_main()
executor::inst()->push_event(ex_event("NVIDIA Invalid Result", ctx.device_id, oWork.iPoolId));
}

iCount += h_per_round;
iNonce += h_per_round;

using namespace std::chrono;
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
updateStats(h_per_round, oWork.iPoolId);
std::this_thread::yield();
}

Expand Down
8 changes: 4 additions & 4 deletions xmrstak/backend/nvidia/nvcc_code/cuda_cryptonight_r.curt
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ __global__ void CryptonightR_phase2(
uint64_t bx0 = ((uint64_t*)(d_ctx_b + thread * 16))[sub];
uint64_t bx1 = ((uint64_t*)(d_ctx_b + thread * 16 + 4))[sub];

uint32_t r0 = d_ctx_b[thread * 16 + 4 * 2];
uint32_t r1 = d_ctx_b[thread * 16 + 4 * 2 + 1];
uint32_t r2 = d_ctx_b[thread * 16 + 4 * 2 + 2];
uint32_t r3 = d_ctx_b[thread * 16 + 4 * 2 + 3];
volatile uint32_t r0 = d_ctx_b[thread * 16 + 4 * 2];
volatile uint32_t r1 = d_ctx_b[thread * 16 + 4 * 2 + 1];
volatile uint32_t r2 = d_ctx_b[thread * 16 + 4 * 2 + 2];
volatile uint32_t r3 = d_ctx_b[thread * 16 + 4 * 2 + 3];

const int batchsize = (ITERATIONS * 2) >> ( 1 + bfactor );
const int start = partidx * batchsize;
Expand Down
64 changes: 37 additions & 27 deletions xmrstak/cli/cli-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ inline void prompt_once(bool& prompted)
}
}

void do_guided_pool_config(const bool use_simple_start)
inline bool use_simple_start()
{
// ask this question only once
static bool simple_start = read_yes_no("\nUse simple setup method? (Y/n)", "Y");
return simple_start;
}

void do_guided_pool_config()
{
using namespace xmrstak;

Expand Down Expand Up @@ -261,19 +268,22 @@ void do_guided_pool_config(const bool use_simple_start)
}

auto& rigid = params::inst().poolRigid;
if(!use_simple_start && rigid.empty() && !params::inst().userSetRigid)
if(rigid.empty() && !params::inst().userSetRigid)
{
prompt_once(prompted);

if(!stdin_flushed)
if(!use_simple_start())
{
// clear everything from stdin to allow an empty rigid
std::cin.clear();
std::cin.ignore(INT_MAX, '\n');
}
prompt_once(prompted);

std::cout << "- Rig identifier for pool-side statistics (needs pool support). Can be empty:" << std::endl;
getline(std::cin, rigid);
if(!stdin_flushed)
{
// clear everything from stdin to allow an empty rigid
std::cin.clear();
std::cin.ignore(INT_MAX, '\n');
}

std::cout << "- Rig identifier for pool-side statistics (needs pool support). Can be empty:" << std::endl;
getline(std::cin, rigid);
}
}

bool tls = params::inst().poolUseTls;
Expand All @@ -289,15 +299,19 @@ void do_guided_pool_config(const bool use_simple_start)
#endif

bool nicehash = params::inst().nicehashMode;
if(!use_simple_start && !userSetPool)
if(!userSetPool)
{
prompt_once(prompted);
nicehash = read_yes_no("- Do you want to use nicehash on this pool? (y/N)", "N");
if(!use_simple_start())
{
prompt_once(prompted);
nicehash = read_yes_no("- Do you want to use nicehash on this pool? (y/N)", "N");
}
}

bool multipool = false;
if(!use_simple_start && !userSetPool)
multipool = read_yes_no("- Do you want to use multiple pools? (y/N)", "N");
if(!userSetPool)
if(!use_simple_start())
multipool = read_yes_no("- Do you want to use multiple pools? (y/N)", "N");

int64_t pool_weight = 1;
if(multipool)
Expand Down Expand Up @@ -335,7 +349,7 @@ void do_guided_pool_config(const bool use_simple_start)
std::cout << "Pool configuration stored in file '" << params::inst().configFilePools << "'" << std::endl;
}

void do_guided_config(const bool use_simple_start)
void do_guided_config()
{
using namespace xmrstak;

Expand All @@ -353,7 +367,7 @@ void do_guided_config(const bool use_simple_start)
{
http_port = params::httpd_port_disabled;
#ifndef CONF_NO_HTTPD
if(!use_simple_start)
if(!use_simple_start())
{
prompt_once(prompted);

Expand Down Expand Up @@ -737,17 +751,13 @@ int main(int argc, char* argv[])
bool hasConfigFile = configEditor::file_exist(params::inst().configFile);
bool hasPoolConfig = configEditor::file_exist(params::inst().configFilePools);

if(!hasConfigFile || !hasPoolConfig)
{
bool use_simple_start = read_yes_no("\nUse simple setup method? (Y/n)", "Y");
// check if we need a guided start
if(!hasConfigFile)
do_guided_config();

// check if we need a guided start
if(!hasConfigFile)
do_guided_config(use_simple_start);
if(!hasPoolConfig)
do_guided_pool_config();

if(!hasPoolConfig)
do_guided_pool_config(use_simple_start);
}
if(!jconf::inst()->parse_config(params::inst().configFile.c_str(), params::inst().configFilePools.c_str()))
{
win_exit();
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#endif

#define XMR_STAK_NAME "xmr-stak"
#define XMR_STAK_VERSION "2.10.3"
#define XMR_STAK_VERSION "2.10.4"

#if defined(_WIN32)
#define OS_TYPE "win"
Expand Down

0 comments on commit a5b8fb7

Please sign in to comment.