Browse Source

Merge pull request #2432 from LefterisJP/clminer_dont_depend_boost

ethminer no longer depends on boost
cl-refactor
Gav Wood 10 years ago
parent
commit
425b401f4a
  1. 2
      ethminer/MinerAux.h
  2. 4
      libethash-cl/ethash_cl_miner.cpp
  3. 5
      libethash-cl/ethash_cl_miner.h
  4. 2
      libethcore/Ethash.cpp
  5. 4
      libethcore/Ethash.h

2
ethminer/MinerAux.h

@ -553,7 +553,7 @@ private:
unsigned m_localWorkSize = ethash_cl_miner::c_defaultLocalWorkSize; unsigned m_localWorkSize = ethash_cl_miner::c_defaultLocalWorkSize;
unsigned m_msPerBatch = ethash_cl_miner::c_defaultMSPerBatch; unsigned m_msPerBatch = ethash_cl_miner::c_defaultMSPerBatch;
#endif #endif
boost::optional<uint64_t> m_currentBlock; uint64_t m_currentBlock = 0;
// default value is 350MB of GPU memory for other stuff (windows system rendering, e.t.c.) // default value is 350MB of GPU memory for other stuff (windows system rendering, e.t.c.)
unsigned m_extraGPUMemory = 350000000; unsigned m_extraGPUMemory = 350000000;

4
libethash-cl/ethash_cl_miner.cpp

@ -149,7 +149,7 @@ bool ethash_cl_miner::configureGPU(
unsigned _msPerBatch, unsigned _msPerBatch,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock uint64_t _currentBlock
) )
{ {
s_workgroupSize = _localWorkSize; s_workgroupSize = _localWorkSize;
@ -158,7 +158,7 @@ bool ethash_cl_miner::configureGPU(
s_allowCPU = _allowCPU; s_allowCPU = _allowCPU;
s_extraRequiredGPUMem = _extraGPUMemory; s_extraRequiredGPUMem = _extraGPUMemory;
// by default let's only consider the DAG of the first epoch // by default let's only consider the DAG of the first epoch
uint64_t dagSize = _currentBlock ? ethash_get_datasize(*_currentBlock) : 1073739904U; uint64_t dagSize = ethash_get_datasize(_currentBlock);
uint64_t requiredSize = dagSize + _extraGPUMemory; uint64_t requiredSize = dagSize + _extraGPUMemory;
return searchForAllDevices(_platformId, [&requiredSize](cl::Device const _device) -> bool return searchForAllDevices(_platformId, [&requiredSize](cl::Device const _device) -> bool
{ {

5
libethash-cl/ethash_cl_miner.h

@ -1,6 +1,6 @@
#pragma once #pragma once
#define __CL_ENABLE_EXCEPTIONS #define __CL_ENABLE_EXCEPTIONS
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
#if defined(__clang__) #if defined(__clang__)
@ -12,7 +12,6 @@
#include "cl.hpp" #include "cl.hpp"
#endif #endif
#include <boost/optional.hpp>
#include <time.h> #include <time.h>
#include <functional> #include <functional>
#include <libethash/ethash.h> #include <libethash/ethash.h>
@ -50,7 +49,7 @@ public:
unsigned _msPerBatch, unsigned _msPerBatch,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock uint64_t _currentBlock
); );
bool init( bool init(

2
libethcore/Ethash.cpp

@ -416,7 +416,7 @@ bool Ethash::GPUMiner::configureGPU(
unsigned _deviceId, unsigned _deviceId,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock uint64_t _currentBlock
) )
{ {
s_platformId = _platformId; s_platformId = _platformId;

4
libethcore/Ethash.h

@ -88,7 +88,7 @@ public:
static unsigned instances() { return s_numInstances > 0 ? s_numInstances : std::thread::hardware_concurrency(); } static unsigned instances() { return s_numInstances > 0 ? s_numInstances : std::thread::hardware_concurrency(); }
static std::string platformInfo(); static std::string platformInfo();
static void listDevices() {} static void listDevices() {}
static bool configureGPU(unsigned, unsigned, unsigned, unsigned, unsigned, bool, unsigned, boost::optional<uint64_t>) { return false; } static bool configureGPU(unsigned, unsigned, unsigned, unsigned, unsigned, bool, unsigned, uint64_t) { return false; }
static void setNumInstances(unsigned _instances) { s_numInstances = std::min<unsigned>(_instances, std::thread::hardware_concurrency()); } static void setNumInstances(unsigned _instances) { s_numInstances = std::min<unsigned>(_instances, std::thread::hardware_concurrency()); }
protected: protected:
void kickOff() override void kickOff() override
@ -125,7 +125,7 @@ public:
unsigned _deviceId, unsigned _deviceId,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock uint64_t _currentBlock
); );
static void setNumInstances(unsigned _instances) { s_numInstances = std::min<unsigned>(_instances, getNumDevices()); } static void setNumInstances(unsigned _instances) { s_numInstances = std::min<unsigned>(_instances, getNumDevices()); }

Loading…
Cancel
Save