Browse Source

Merge pull request #111 from ethereum-mining/cpu

Remove CPU miner leftovers
master
Paweł Bylica 8 years ago
committed by GitHub
parent
commit
cf7e9c6bcd
  1. 32
      ethminer/MinerAux.h
  2. 5
      libethcore/Miner.h
  3. 4
      libstratum/EthStratumClient.cpp
  4. 4
      libstratum/EthStratumClientV2.cpp

32
ethminer/MinerAux.h

@ -81,7 +81,6 @@ public:
enum class OperationMode enum class OperationMode
{ {
None, None,
DAGInit,
Benchmark, Benchmark,
Simulation, Simulation,
Farm, Farm,
@ -380,8 +379,6 @@ public:
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
BOOST_THROW_EXCEPTION(BadArgument()); BOOST_THROW_EXCEPTION(BadArgument());
} }
else if (arg == "-C" || arg == "--cpu")
m_minerType = MinerType::CPU;
else if (arg == "-G" || arg == "--opencl") else if (arg == "-G" || arg == "--opencl")
m_minerType = MinerType::CL; m_minerType = MinerType::CL;
else if (arg == "-U" || arg == "--cuda") else if (arg == "-U" || arg == "--cuda")
@ -464,17 +461,10 @@ public:
if (m_minerType == MinerType::CUDA || m_minerType == MinerType::Mixed) if (m_minerType == MinerType::CUDA || m_minerType == MinerType::Mixed)
EthashCUDAMiner::listDevices(); EthashCUDAMiner::listDevices();
#endif #endif
if (m_minerType == MinerType::CPU)
cout << "--list-devices should be combined with GPU mining flag (-G for OpenCL or -U for CUDA)" << endl;
exit(0); exit(0);
} }
if (m_minerType == MinerType::CPU) if (m_minerType == MinerType::CL || m_minerType == MinerType::Mixed)
{
cout << "CPU mining is no longer supported in this miner. Use -G (opencl) or -U (cuda) flag to select GPU platform." << endl;
exit(0);
}
else if (m_minerType == MinerType::CL || m_minerType == MinerType::Mixed)
{ {
#if ETH_ETHASHCL #if ETH_ETHASHCL
if (m_openclDeviceCount > 0) if (m_openclDeviceCount > 0)
@ -605,8 +595,6 @@ public:
; ;
} }
MinerType minerType() const { return m_minerType; }
private: private:
void doBenchmark(MinerType _m, unsigned _warmupDuration = 15, unsigned _trialDuration = 3, unsigned _trials = 5) void doBenchmark(MinerType _m, unsigned _warmupDuration = 15, unsigned _trialDuration = 3, unsigned _trials = 5)
@ -627,7 +615,7 @@ private:
f.setSealers(sealers); f.setSealers(sealers);
f.onSolutionFound([&](Solution) { return false; }); f.onSolutionFound([&](Solution) { return false; });
string platformInfo = _m == MinerType::CPU ? "CPU" : (_m == MinerType::CL ? "CL" : "CUDA"); string platformInfo = _m == MinerType::CL ? "CL" : "CUDA";
cout << "Benchmarking on platform: " << platformInfo << endl; cout << "Benchmarking on platform: " << platformInfo << endl;
cout << "Preparing DAG for block #" << m_benchmarkBlock << endl; cout << "Preparing DAG for block #" << m_benchmarkBlock << endl;
@ -635,9 +623,7 @@ private:
genesis.setDifficulty(u256(1) << 63); genesis.setDifficulty(u256(1) << 63);
f.setWork(genesis); f.setWork(genesis);
if (_m == MinerType::CPU) if (_m == MinerType::CL)
f.start("cpu", false);
else if (_m == MinerType::CL)
f.start("opencl", false); f.start("opencl", false);
else if (_m == MinerType::CUDA) else if (_m == MinerType::CUDA)
f.start("cuda", false); f.start("cuda", false);
@ -692,7 +678,7 @@ private:
#endif #endif
f.setSealers(sealers); f.setSealers(sealers);
string platformInfo = _m == MinerType::CPU ? "CPU" : (_m == MinerType::CL ? "CL" : "CUDA"); string platformInfo = _m == MinerType::CL ? "CL" : "CUDA";
cout << "Running mining simulation on platform: " << platformInfo << endl; cout << "Running mining simulation on platform: " << platformInfo << endl;
cout << "Preparing DAG for block #" << m_benchmarkBlock << endl; cout << "Preparing DAG for block #" << m_benchmarkBlock << endl;
@ -701,9 +687,7 @@ private:
genesis.setDifficulty(u256(1) << difficulty); genesis.setDifficulty(u256(1) << difficulty);
f.setWork(genesis); f.setWork(genesis);
if (_m == MinerType::CPU) if (_m == MinerType::CL)
f.start("cpu", false);
else if (_m == MinerType::CL)
f.start("opencl", false); f.start("opencl", false);
else if (_m == MinerType::CUDA) else if (_m == MinerType::CUDA)
f.start("cuda", false); f.start("cuda", false);
@ -782,9 +766,7 @@ private:
h256 id = h256::random(); h256 id = h256::random();
Farm f; Farm f;
f.setSealers(sealers); f.setSealers(sealers);
if (_m == MinerType::CPU) if (_m == MinerType::CL)
f.start("cpu", false);
else if (_m == MinerType::CL)
f.start("opencl", false); f.start("opencl", false);
else if (_m == MinerType::CUDA) else if (_m == MinerType::CUDA)
f.start("cuda", false); f.start("cuda", false);
@ -1019,7 +1001,7 @@ private:
/// Mining options /// Mining options
bool m_running = true; bool m_running = true;
MinerType m_minerType = MinerType::CPU; MinerType m_minerType = MinerType::Mixed;
unsigned m_openclPlatform = 0; unsigned m_openclPlatform = 0;
unsigned m_openclDevice = 0; unsigned m_openclDevice = 0;
unsigned m_miningThreads = UINT_MAX; unsigned m_miningThreads = UINT_MAX;

5
libethcore/Miner.h

@ -61,10 +61,9 @@ namespace eth
enum class MinerType enum class MinerType
{ {
CPU, Mixed,
CL, CL,
CUDA, CUDA
Mixed
}; };
/// Describes the progress of a mining operation. /// Describes the progress of a mining operation.

4
libstratum/EthStratumClient.cpp

@ -176,9 +176,7 @@ void EthStratumClient::connect_handler(const boost::system::error_code& ec, tcp:
if (!p_farm->isMining()) if (!p_farm->isMining())
{ {
cnote << "Starting farm"; cnote << "Starting farm";
if (m_minerType == MinerType::CPU) if (m_minerType == MinerType::CL)
p_farm->start("cpu", false);
else if (m_minerType == MinerType::CL)
p_farm->start("opencl", false); p_farm->start("opencl", false);
else if (m_minerType == MinerType::CUDA) else if (m_minerType == MinerType::CUDA)
p_farm->start("cuda", false); p_farm->start("cuda", false);

4
libstratum/EthStratumClientV2.cpp

@ -141,9 +141,7 @@ void EthStratumClientV2::connect()
if (!p_farm->isMining()) if (!p_farm->isMining())
{ {
cnote << "Starting farm"; cnote << "Starting farm";
if (m_minerType == MinerType::CPU) if (m_minerType == MinerType::CL)
p_farm->start("cpu", false);
else if (m_minerType == MinerType::CL)
p_farm->start("opencl", false); p_farm->start("opencl", false);
else if (m_minerType == MinerType::CUDA) else if (m_minerType == MinerType::CUDA)
p_farm->start("cuda", false); p_farm->start("cuda", false);

Loading…
Cancel
Save