diff --git a/CMakeLists.txt b/CMakeLists.txt index 7344490ec..e87d6ac18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12) set(PROJECT_VERSION "0.9.41") -set(GENOIL_VERSION "1.0.5") +set(GENOIL_VERSION "1.0.6") if (${CMAKE_VERSION} VERSION_GREATER 3.0) cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project() diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 152f219bb..672b5fd67 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -186,6 +186,19 @@ public: cerr << "Bad " << arg << " option: " << argv[i] << endl; BOOST_THROW_EXCEPTION(BadArgument()); } + else if (arg == "--opencl-devices") + while (m_openclDeviceCount < 16 && i + 1 < argc) + { + try + { + m_openclDevices[m_openclDeviceCount++] = stol(argv[++i]); + } + catch (...) + { + i--; + break; + } + } #if ETH_ETHASHCL || ETH_ETHASHCUDA || !ETH_TRUE else if ((arg == "--cl-global-work" || arg == "--cuda-grid-size") && i + 1 < argc) try { @@ -434,6 +447,12 @@ public: else if (m_minerType == MinerType::CL) { #if ETH_ETHASHCL || !ETH_TRUE + if (m_openclDeviceCount > 0) + { + EthashGPUMiner::setDevices(m_openclDevices, m_openclDeviceCount); + m_miningThreads = m_openclDeviceCount; + } + if (!EthashGPUMiner::configureGPU( m_localWorkSize, m_globalWorkSizeMultiplier, @@ -453,14 +472,12 @@ public: else if (m_minerType == MinerType::CUDA) { #if ETH_ETHASHCUDA || !ETH_TRUE - if (m_cudaDeviceCount == 0) + if (m_cudaDeviceCount > 0) { - m_cudaDevices[0] = 0; - m_cudaDeviceCount = 1; + EthashCUDAMiner::setDevices(m_cudaDevices, m_cudaDeviceCount); + m_miningThreads = m_cudaDeviceCount; } - EthashCUDAMiner::setDevices(m_cudaDevices, m_cudaDeviceCount); - m_miningThreads = m_cudaDeviceCount; - + EthashCUDAMiner::setNumInstances(m_miningThreads); if (!EthashCUDAMiner::configureGPU( m_localWorkSize, @@ -510,7 +527,7 @@ public: << "Simulation mode:" << endl << " -S [],--simulation [] Mining test mode. Used to validate kernel optimizations. Optionally specify block number." << endl #if ETH_JSONRPC || !ETH_TRUE - << " --phone-home When benchmarking, publish results (default: on)" << endl + << " --phone-home When benchmarking, publish results (default: off)" << endl #endif << "DAG creation mode:" << endl << " -D,--create-dag Create the DAG in preparation for mining on given block and exit." << endl @@ -520,6 +537,7 @@ public: << " -U,--cuda When mining use the GPU via CUDA." << endl << " --opencl-platform When mining using -G/--opencl use OpenCL platform n (default: 0)." << endl << " --opencl-device When mining using -G/--opencl use OpenCL device n (default: 0)." << endl + << " --opencl-devices <0 1 ..n> Select which OpenCL devices to mine on. Default is to use all" << endl << " -t, --mining-threads Limit number of CPU/GPU miners to n (default: use everything available on selected platform)" << endl << " --allow-opencl-cpu Allows CPU to be considered as an OpenCL device if the OpenCL platform supports it." << endl << " --list-devices List the detected OpenCL/CUDA devices and exit." << endl @@ -540,7 +558,7 @@ public: << " spin - Instruct CUDA to actively spin when waiting for results from the device." << endl << " yield - Instruct CUDA to yield its thread when waiting for results from the device." << endl << " sync - Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the results from the device." << endl - << " --cuda-devices <0 1 ..n> Select which GPUs to mine on. Default is to use all" << endl + << " --cuda-devices <0 1 ..n> Select which CUDA GPUs to mine on. Default is to use all" << endl #endif ; } @@ -898,6 +916,8 @@ private: bool m_shouldListDevices = false; bool m_clAllowCPU = false; #if ETH_ETHASHCL || !ETH_TRUE + unsigned m_openclDeviceCount = 0; + unsigned m_openclDevices[16]; #if !ETH_ETHASHCUDA || !ETH_TRUE unsigned m_globalWorkSizeMultiplier = ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier; unsigned m_localWorkSize = ethash_cl_miner::c_defaultLocalWorkSize; diff --git a/libethash-cuda/ethash_cuda_miner.cpp b/libethash-cuda/ethash_cuda_miner.cpp index 8ca0ff931..d5a1cca8a 100644 --- a/libethash-cuda/ethash_cuda_miner.cpp +++ b/libethash-cuda/ethash_cuda_miner.cpp @@ -141,10 +141,12 @@ bool ethash_cuda_miner::configureGPU( unsigned devicesCount = getNumDevices(); for (unsigned int i = 0; i < devicesCount; i++) { + if (_devices[i] != -1) { + int deviceId = min((int)devicesCount - 1, _devices[i]); cudaDeviceProp props; - CUDA_SAFE_CALL(cudaGetDeviceProperties(&props, _devices[i])); + CUDA_SAFE_CALL(cudaGetDeviceProperties(&props, deviceId)); if (props.totalGlobalMem >= requiredSize) { ETHCUDA_LOG( diff --git a/libethcore/EthashGPUMiner.cpp b/libethcore/EthashGPUMiner.cpp index 0df871d58..bad845cbc 100644 --- a/libethcore/EthashGPUMiner.cpp +++ b/libethcore/EthashGPUMiner.cpp @@ -103,6 +103,7 @@ private: unsigned EthashGPUMiner::s_platformId = 0; unsigned EthashGPUMiner::s_deviceId = 0; unsigned EthashGPUMiner::s_numInstances = 0; +int EthashGPUMiner::s_devices[16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; EthashGPUMiner::EthashGPUMiner(ConstructionInfo const& _ci): GenericMiner(_ci), @@ -147,7 +148,7 @@ void EthashGPUMiner::workLoop() delete m_miner; m_miner = new ethash_cl_miner; - unsigned device = instances() > 1 ? index() : s_deviceId; + unsigned device = s_devices[index()] > -1 ? s_devices[index()] : index(); EthashAux::FullType dag; while (true) diff --git a/libethcore/EthashGPUMiner.h b/libethcore/EthashGPUMiner.h index 13d758d24..1db025b18 100644 --- a/libethcore/EthashGPUMiner.h +++ b/libethcore/EthashGPUMiner.h @@ -55,6 +55,13 @@ public: uint64_t _currentBlock ); static void setNumInstances(unsigned _instances) { s_numInstances = std::min(_instances, getNumDevices()); } + static void setDevices(unsigned * _devices, unsigned _selectedDeviceCount) + { + for (unsigned i = 0; i < _selectedDeviceCount; i++) + { + s_devices[i] = _devices[i]; + } + } protected: void kickOff() override; @@ -73,6 +80,7 @@ private: static unsigned s_platformId; static unsigned s_deviceId; static unsigned s_numInstances; + static int s_devices[16]; }; } diff --git a/releases/ethminer-0.9.41-genoil-1.0.6a.zip b/releases/ethminer-0.9.41-genoil-1.0.6a.zip new file mode 100644 index 000000000..3cb6579f1 Binary files /dev/null and b/releases/ethminer-0.9.41-genoil-1.0.6a.zip differ