Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abe5ab5

Browse files
author
Jean Cyr
committedJan 12, 2018
Halve the nvidia farm switch time.
When it gets new work the farm calls setWork for each GPU’s miners. For an nvidia GPU miner, setWork: - Sets a flag for the miner to stop. The miner will not acknowledge this flag till it completes its current calculation pass, on average half of one hash calculation’s time. - Wait for the miner to stop (blocks). - Reset the miner with new work. This has performance and cost consequences. Since the farm calls setWork sequentially over all miners, a miner will not be stopped and informed of new work, till the previous has completed the reset. It also means that because of this, the laer a miner restarts the more likely to provide a stale share working on old work instead of getting started new work. To mittigate this we break up the setWork process in two parts: setWork and waitReady. setWork - Sets a flag for the miner to stop. waitReady - Wait for the miner to stop (blocks). - Reset the miner with new work. With this partitioning we can now restart the GPUs in parallel by first iterating over miners with setWork (which can’t block), then doing a second pass calling waitReady. Actual measuments - Ubuntu - 4X1060 - time from start of farm setWork to completion of last GPU reset): - Sequential GPU resets – avg. farm setWork time 180-200ms. (yes, it’s that slow!!!) - Parallel GPU resets – avg. farm setWork time 70-90ms. These are averages since, at least for nvidia, switch time is highly dependent on when new work arrives during a hash calculation, so it fluctuates a lot per job.
1 parent 5d8ae6d commit abe5ab5

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed
 

‎libethash-cl/CLMiner.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,9 @@ void CLMiner::workLoop()
403403
}
404404
}
405405

406-
void CLMiner::pause()
407-
{}
406+
void CLMiner::pause() {}
407+
408+
void CLMiner::waitPaused() {}
408409

409410
unsigned CLMiner::getNumDevices()
410411
{

‎libethash-cl/CLMiner.h

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class CLMiner: public Miner
8686
protected:
8787
void kickOff() override;
8888
void pause() override;
89+
void waitPaused() override;
8990

9091
private:
9192
void workLoop() override;

‎libethash-cuda/CUDAMiner.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ namespace eth
4141

4242
m_abort = true;
4343
}
44+
}
45+
46+
void wait()
47+
{
4448
// m_abort is true so now searched()/found() will return true to abort the search.
4549
// we hang around on this thread waiting for them to point out that they have aborted since
4650
// otherwise we may end up deleting this object prior to searched()/found() being called.
@@ -209,6 +213,11 @@ void CUDAMiner::pause()
209213
m_hook->abort();
210214
}
211215

216+
void CUDAMiner::waitPaused()
217+
{
218+
m_hook->wait();
219+
}
220+
212221
unsigned CUDAMiner::getNumDevices()
213222
{
214223
int deviceCount = -1;

‎libethash-cuda/CUDAMiner.h

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class EthashCUDAHook;
7272
protected:
7373
void kickOff() override;
7474
void pause() override;
75+
void waitPaused() override;
7576
private:
7677
void workLoop() override;
7778
void report(uint64_t _nonce);

‎libethcore/Farm.h

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class Farm: public FarmFace
7272
m_work = _wp;
7373
for (auto const& m: m_miners)
7474
m->setWork(m_work);
75+
for (auto const& m: m_miners)
76+
m->startWork();
7577
}
7678

7779
void setSealers(std::map<std::string, SealerDescriptor> const& _sealers) { m_sealers = _sealers; }

‎libethcore/Miner.h

+6
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ class Miner: public Worker
181181
workSwitchStart = std::chrono::high_resolution_clock::now();
182182
}
183183
pause();
184+
}
185+
186+
void startWork()
187+
{
188+
waitPaused();
184189
kickOff();
185190
m_hashCount = 0;
186191
}
@@ -203,6 +208,7 @@ class Miner: public Worker
203208
* @brief No work left to be done. Pause until told to kickOff().
204209
*/
205210
virtual void pause() = 0;
211+
virtual void waitPaused() = 0;
206212

207213
WorkPackage work() const { Guard l(x_work); return m_work; }
208214

1 commit comments

Comments
 (1)

DDDanny commented on Jan 21, 2018

@DDDanny

running rc6 since 2 hours using nanopool (frequent job updates) - average 5minute calculated hashrate [ethminer calc intervall 10s] has increased by approx 2 mh/s (148 -> 150) - (operating 4x gtx 1070 and 1x gtx 1060)

👍

This repository has been archived.