From 0c08092f6a040bfc194061510d58937c0384da8f Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 11 Jun 2015 09:48:04 +0200 Subject: [PATCH] Fix the chunks auto detecting code --- libethash-cl/ethash_cl_miner.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index 6907a7bd0..1a5eaddc3 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -267,9 +267,19 @@ bool ethash_cl_miner::init( ETHCL_LOG("Using device: " << device.getInfo().c_str() << "(" << device_version.c_str() << ")"); // configure chunk number depending on max allocateable memory - cl_ulong result; + cl_ulong result; device.getInfo(CL_DEVICE_MAX_MEM_ALLOC_SIZE, &result); - m_dagChunksNum = result >= ETHASH_CL_MINIMUM_MEMORY ? 4 : 1; + if (result >= ETHASH_CL_MINIMUM_MEMORY) + { + m_dagChunksNum = 1; + ETHCL_LOG("Using 1 big chunk. Max OpenCL allocateable memory is" << result); + } + else + { + m_dagChunksNum = 4; + ETHCL_LOG("Using 4 chunks. Max OpenCL allocateable memory is" << result); + } + if (strncmp("OpenCL 1.0", device_version.c_str(), 10) == 0) { ETHCL_LOG("OpenCL 1.0 is not supported.");