Browse Source

configureGPU() should respect given platformID

Related to #2314
cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
81ca67dd4c
  1. 3
      libethash-cl/ethash_cl_miner.cpp
  2. 1
      libethash-cl/ethash_cl_miner.h
  3. 2
      libethcore/Ethash.cpp

3
libethash-cl/ethash_cl_miner.cpp

@ -139,6 +139,7 @@ unsigned ethash_cl_miner::getNumDevices(unsigned _platformId)
} }
bool ethash_cl_miner::configureGPU( bool ethash_cl_miner::configureGPU(
unsigned _platformId,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock boost::optional<uint64_t> _currentBlock
@ -149,7 +150,7 @@ bool ethash_cl_miner::configureGPU(
// 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 = _currentBlock ? ethash_get_datasize(*_currentBlock) : 1073739904U;
uint64_t requiredSize = dagSize + _extraGPUMemory; uint64_t requiredSize = dagSize + _extraGPUMemory;
return searchForAllDevices([&requiredSize](cl::Device const _device) -> bool return searchForAllDevices(_platformId, [&requiredSize](cl::Device const _device) -> bool
{ {
cl_ulong result; cl_ulong result;
_device.getInfo(CL_DEVICE_GLOBAL_MEM_SIZE, &result); _device.getInfo(CL_DEVICE_GLOBAL_MEM_SIZE, &result);

1
libethash-cl/ethash_cl_miner.h

@ -44,6 +44,7 @@ public:
static std::string platform_info(unsigned _platformId = 0, unsigned _deviceId = 0); static std::string platform_info(unsigned _platformId = 0, unsigned _deviceId = 0);
static void listDevices(); static void listDevices();
static bool configureGPU( static bool configureGPU(
unsigned _platformId,
bool _allowCPU, bool _allowCPU,
unsigned _extraGPUMemory, unsigned _extraGPUMemory,
boost::optional<uint64_t> _currentBlock boost::optional<uint64_t> _currentBlock

2
libethcore/Ethash.cpp

@ -418,7 +418,7 @@ bool Ethash::GPUMiner::configureGPU(
{ {
s_platformId = _platformId; s_platformId = _platformId;
s_deviceId = _deviceId; s_deviceId = _deviceId;
return ethash_cl_miner::configureGPU(_allowCPU, _extraGPUMemory, _currentBlock); return ethash_cl_miner::configureGPU(_platformId, _allowCPU, _extraGPUMemory, _currentBlock);
} }
#endif #endif

Loading…
Cancel
Save