From 81ca67dd4c9536d7bf527e601c2855ed58905bfa Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 29 Jun 2015 16:55:57 +0200 Subject: [PATCH] configureGPU() should respect given platformID Related to #2314 --- libethash-cl/ethash_cl_miner.cpp | 3 ++- libethash-cl/ethash_cl_miner.h | 1 + libethcore/Ethash.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index b12e4d9f8..3a72810fa 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -139,6 +139,7 @@ unsigned ethash_cl_miner::getNumDevices(unsigned _platformId) } bool ethash_cl_miner::configureGPU( + unsigned _platformId, bool _allowCPU, unsigned _extraGPUMemory, boost::optional _currentBlock @@ -149,7 +150,7 @@ bool ethash_cl_miner::configureGPU( // by default let's only consider the DAG of the first epoch uint64_t dagSize = _currentBlock ? ethash_get_datasize(*_currentBlock) : 1073739904U; 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; _device.getInfo(CL_DEVICE_GLOBAL_MEM_SIZE, &result); diff --git a/libethash-cl/ethash_cl_miner.h b/libethash-cl/ethash_cl_miner.h index 996453c00..73bf7e94a 100644 --- a/libethash-cl/ethash_cl_miner.h +++ b/libethash-cl/ethash_cl_miner.h @@ -44,6 +44,7 @@ public: static std::string platform_info(unsigned _platformId = 0, unsigned _deviceId = 0); static void listDevices(); static bool configureGPU( + unsigned _platformId, bool _allowCPU, unsigned _extraGPUMemory, boost::optional _currentBlock diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index 70908ee44..46d19d164 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -418,7 +418,7 @@ bool Ethash::GPUMiner::configureGPU( { s_platformId = _platformId; s_deviceId = _deviceId; - return ethash_cl_miner::configureGPU(_allowCPU, _extraGPUMemory, _currentBlock); + return ethash_cl_miner::configureGPU(_platformId, _allowCPU, _extraGPUMemory, _currentBlock); } #endif