|
|
@ -81,7 +81,6 @@ public: |
|
|
|
enum class OperationMode |
|
|
|
{ |
|
|
|
None, |
|
|
|
DAGInit, |
|
|
|
Benchmark, |
|
|
|
Simulation, |
|
|
|
Farm, |
|
|
@ -380,8 +379,6 @@ public: |
|
|
|
cerr << "Bad " << arg << " option: " << argv[i] << endl; |
|
|
|
BOOST_THROW_EXCEPTION(BadArgument()); |
|
|
|
} |
|
|
|
else if (arg == "-C" || arg == "--cpu") |
|
|
|
m_minerType = MinerType::CPU; |
|
|
|
else if (arg == "-G" || arg == "--opencl") |
|
|
|
m_minerType = MinerType::CL; |
|
|
|
else if (arg == "-U" || arg == "--cuda") |
|
|
@ -435,18 +432,6 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((arg == "-t" || arg == "--mining-threads") && i + 1 < argc) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
m_miningThreads = stol(argv[++i]); |
|
|
|
} |
|
|
|
catch (...) |
|
|
|
{ |
|
|
|
cerr << "Bad " << arg << " option: " << argv[i] << endl; |
|
|
|
BOOST_THROW_EXCEPTION(BadArgument()); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
return false; |
|
|
|
return true; |
|
|
@ -464,37 +449,26 @@ public: |
|
|
|
if (m_minerType == MinerType::CUDA || m_minerType == MinerType::Mixed) |
|
|
|
EthashCUDAMiner::listDevices(); |
|
|
|
#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); |
|
|
|
} |
|
|
|
|
|
|
|
if (m_minerType == MinerType::CPU) |
|
|
|
{ |
|
|
|
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 (m_minerType == MinerType::CL || m_minerType == MinerType::Mixed) |
|
|
|
{ |
|
|
|
#if ETH_ETHASHCL |
|
|
|
if (m_openclDeviceCount > 0) |
|
|
|
{ |
|
|
|
EthashGPUMiner::setDevices(m_openclDevices, m_openclDeviceCount); |
|
|
|
m_miningThreads = m_openclDeviceCount; |
|
|
|
} |
|
|
|
|
|
|
|
if (!EthashGPUMiner::configureGPU( |
|
|
|
m_localWorkSize, |
|
|
|
m_globalWorkSizeMultiplier, |
|
|
|
m_openclPlatform, |
|
|
|
m_openclDevice, |
|
|
|
m_extraGPUMemory, |
|
|
|
0, |
|
|
|
m_dagLoadMode, |
|
|
|
m_dagCreateDevice |
|
|
|
)) |
|
|
|
exit(1); |
|
|
|
EthashGPUMiner::setNumInstances(m_miningThreads); |
|
|
|
EthashGPUMiner::setNumInstances(m_openclDeviceCount); |
|
|
|
#else |
|
|
|
cerr << "Selected GPU mining without having compiled with -DETHASHCL=1" << endl; |
|
|
|
exit(1); |
|
|
@ -504,12 +478,9 @@ public: |
|
|
|
{ |
|
|
|
#if ETH_ETHASHCUDA |
|
|
|
if (m_cudaDeviceCount > 0) |
|
|
|
{ |
|
|
|
EthashCUDAMiner::setDevices(m_cudaDevices, m_cudaDeviceCount); |
|
|
|
m_miningThreads = m_cudaDeviceCount; |
|
|
|
} |
|
|
|
|
|
|
|
EthashCUDAMiner::setNumInstances(m_miningThreads); |
|
|
|
EthashCUDAMiner::setNumInstances(m_cudaDeviceCount); |
|
|
|
if (!EthashCUDAMiner::configureGPU( |
|
|
|
m_localWorkSize, |
|
|
|
m_globalWorkSizeMultiplier, |
|
|
@ -622,12 +593,12 @@ private: |
|
|
|
sealers["opencl"] = Farm::SealerDescriptor{&EthashGPUMiner::instances, [](Miner::ConstructionInfo ci){ return new EthashGPUMiner(ci); }}; |
|
|
|
#endif |
|
|
|
#if ETH_ETHASHCUDA |
|
|
|
sealers["cuda"] = Farm::SealerDescriptor{ &EthashCUDAMiner::instances, [](Miner::ConstructionInfo ci){ return new EthashCUDAMiner(ci); } }; |
|
|
|
sealers["cuda"] = Farm::SealerDescriptor{&EthashCUDAMiner::instances, [](Miner::ConstructionInfo ci){ return new EthashCUDAMiner(ci); }}; |
|
|
|
#endif |
|
|
|
f.setSealers(sealers); |
|
|
|
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 << "Preparing DAG for block #" << m_benchmarkBlock << endl; |
|
|
@ -635,9 +606,7 @@ private: |
|
|
|
|
|
|
|
genesis.setDifficulty(u256(1) << 63); |
|
|
|
f.setWork(genesis); |
|
|
|
if (_m == MinerType::CPU) |
|
|
|
f.start("cpu", false); |
|
|
|
else if (_m == MinerType::CL) |
|
|
|
if (_m == MinerType::CL) |
|
|
|
f.start("opencl", false); |
|
|
|
else if (_m == MinerType::CUDA) |
|
|
|
f.start("cuda", false); |
|
|
@ -692,7 +661,7 @@ private: |
|
|
|
#endif |
|
|
|
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 << "Preparing DAG for block #" << m_benchmarkBlock << endl; |
|
|
@ -701,9 +670,7 @@ private: |
|
|
|
genesis.setDifficulty(u256(1) << difficulty); |
|
|
|
f.setWork(genesis); |
|
|
|
|
|
|
|
if (_m == MinerType::CPU) |
|
|
|
f.start("cpu", false); |
|
|
|
else if (_m == MinerType::CL) |
|
|
|
if (_m == MinerType::CL) |
|
|
|
f.start("opencl", false); |
|
|
|
else if (_m == MinerType::CUDA) |
|
|
|
f.start("cuda", false); |
|
|
@ -782,9 +749,7 @@ private: |
|
|
|
h256 id = h256::random(); |
|
|
|
Farm f; |
|
|
|
f.setSealers(sealers); |
|
|
|
if (_m == MinerType::CPU) |
|
|
|
f.start("cpu", false); |
|
|
|
else if (_m == MinerType::CL) |
|
|
|
if (_m == MinerType::CL) |
|
|
|
f.start("opencl", false); |
|
|
|
else if (_m == MinerType::CUDA) |
|
|
|
f.start("cuda", false); |
|
|
@ -1019,10 +984,8 @@ private: |
|
|
|
|
|
|
|
/// Mining options
|
|
|
|
bool m_running = true; |
|
|
|
MinerType m_minerType = MinerType::CPU; |
|
|
|
MinerType m_minerType = MinerType::Mixed; |
|
|
|
unsigned m_openclPlatform = 0; |
|
|
|
unsigned m_openclDevice = 0; |
|
|
|
unsigned m_miningThreads = UINT_MAX; |
|
|
|
bool m_shouldListDevices = false; |
|
|
|
#if ETH_ETHASHCL |
|
|
|
unsigned m_openclDeviceCount = 0; |
|
|
|