diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2018-01-27 11:50:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 11:50:54 +0000 |
commit | f737d24897960321bffd65f125304a75e801584e (patch) | |
tree | bff3f4602861c7d0f3df3d8241a86a3100c616f7 /xmrstak/backend/amd/autoAdjust.hpp | |
parent | dded06a3ddd89ebeb2da42a62eb99c60eadee9cb (diff) | |
parent | 14f60635915f545fce2f61117ccf87143c7629cc (diff) | |
download | xmr-stak-f737d24897960321bffd65f125304a75e801584e.zip xmr-stak-f737d24897960321bffd65f125304a75e801584e.tar.gz |
Merge pull request #758 from dougvj/fix_zero_intensity
Add warning and fallback when auto intensity is 0
Diffstat (limited to 'xmrstak/backend/amd/autoAdjust.hpp')
-rw-r--r-- | xmrstak/backend/amd/autoAdjust.hpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp index 511a712..93b71ba 100644 --- a/xmrstak/backend/amd/autoAdjust.hpp +++ b/xmrstak/backend/amd/autoAdjust.hpp @@ -94,7 +94,6 @@ private: } std::string conf; - int i = 0; for(auto& ctx : devVec) { /* 1000 is a magic selected limit, the reason is that more than 2GiB memory @@ -127,14 +126,27 @@ private: size_t possibleIntensity = std::min( maxThreads , maxIntensity ); // map intensity to a multiple of the compute unit count, 8 is the number of threads per work group size_t intensity = (possibleIntensity / (8 * ctx.computeUnits)) * ctx.computeUnits * 8; - conf += std::string(" // gpu: ") + ctx.name + " memory:" + std::to_string(availableMem / byteToMiB) + "\n"; - conf += std::string(" // compute units: ") + std::to_string(ctx.computeUnits) + "\n"; - // set 8 threads per block (this is a good value for the most gpus) - conf += std::string(" { \"index\" : ") + std::to_string(ctx.deviceIdx) + ",\n" + - " \"intensity\" : " + std::to_string(intensity) + ", \"worksize\" : " + std::to_string(8) + ",\n" + - " \"affine_to_cpu\" : false, \"strided_index\" : true\n" - " },\n"; - ++i; + //If the intensity is 0, then it's because the multiple of the unit count is greater than intensity + if (intensity == 0) + { + printer::inst()->print_msg(L0, "WARNING: Auto detected intensity unexpectedly low. Try to set the environment variable GPU_SINGLE_ALLOC_PERCENT."); + intensity = possibleIntensity; + + } + if (intensity != 0) + { + conf += std::string(" // gpu: ") + ctx.name + " memory:" + std::to_string(availableMem / byteToMiB) + "\n"; + conf += std::string(" // compute units: ") + std::to_string(ctx.computeUnits) + "\n"; + // set 8 threads per block (this is a good value for the most gpus) + conf += std::string(" { \"index\" : ") + std::to_string(ctx.deviceIdx) + ",\n" + + " \"intensity\" : " + std::to_string(intensity) + ", \"worksize\" : " + std::to_string(8) + ",\n" + + " \"affine_to_cpu\" : false, \"strided_index\" : true\n" + " },\n"; + } + else + { + printer::inst()->print_msg(L0, "WARNING: Ignore gpu %s, %s MiB free memory is not enough to suggest settings.", ctx.name.c_str(), std::to_string(availableMem / byteToMiB).c_str()); + } } configTpl.replace("PLATFORMINDEX",std::to_string(platformIndex)); |