Browse Source

Fix GPU mining in ethminer.

cl-refactor
Gav Wood 10 years ago
parent
commit
83650be213
  1. 8
      libethcore/Ethash.cpp
  2. 4
      libethcore/EthashAux.cpp

8
libethcore/Ethash.cpp

@ -300,6 +300,7 @@ void Ethash::GPUMiner::workLoop()
// take local copy of work since it may end up being overwritten by kickOff/pause.
try {
WorkPackage w = work();
cnote << "workLoop" << !!m_miner << m_minerSeed << w.seedHash;
if (!m_miner || m_minerSeed != w.seedHash)
{
m_minerSeed = w.seedHash;
@ -309,7 +310,12 @@ void Ethash::GPUMiner::workLoop()
unsigned device = instances() > 1 ? index() : s_deviceId;
if (!EthashAux::computeFull(EthashAux::number(w.seedHash)))
while (EthashAux::computeFull(EthashAux::number(w.seedHash)) != 100 && !shouldStop())
{
cnote << "Awaiting DAG" << EthashAux::computeFull(EthashAux::number(w.seedHash));
this_thread::sleep_for(chrono::milliseconds(500));
}
if (shouldStop())
return;
EthashAux::FullType dag = EthashAux::full(EthashAux::number(w.seedHash));
bytesConstRef dagData = dag->data();

4
libethcore/EthashAux.cpp

@ -170,7 +170,9 @@ EthashAux::FullType EthashAux::full(uint64_t _blockNumber, function<int(unsigned
}
s_dagCallback = _f;
cnote << "Loading from libethash...";
ret = make_shared<FullAllocation>(l->light, dagCallbackShim);
cnote << "Done loading.";
DEV_GUARDED(get()->x_fulls)
get()->m_fulls[seedHash] = get()->m_lastUsedFull = ret;
@ -192,7 +194,9 @@ unsigned EthashAux::computeFull(uint64_t _blockNumber)
get()->m_fullProgress = 0;
get()->m_generatingFullNumber = _blockNumber / ETHASH_EPOCH_LENGTH * ETHASH_EPOCH_LENGTH;
get()->m_fullGenerator = unique_ptr<thread>(new thread([=](){
cnote << "Loading full DAG of" << _blockNumber;
get()->full(_blockNumber, [](unsigned p){ get()->m_fullProgress = p; return 0; });
cnote << "Full DAG loaded";
get()->m_fullProgress = 0;
get()->m_generatingFullNumber = NotGenerating;
}));

Loading…
Cancel
Save