Skip to content
Snippets Groups Projects
Commit 0c332962 authored by fireice-uk's avatar fireice-uk Committed by GitHub
Browse files

Merge pull request #27 from psychocrypt/topic-improveAmdAutoAdjust

improve AMD auto suggestion
parents 984ddf9e e0b93c22
No related branches found
No related tags found
No related merge requests found
...@@ -79,6 +79,8 @@ private: ...@@ -79,6 +79,8 @@ private:
configEditor configTpl{}; configEditor configTpl{};
configTpl.set( std::string(tpl) ); configTpl.set( std::string(tpl) );
constexpr size_t byteToMiB = 1024u * 1024u;
std::string conf; std::string conf;
int i = 0; int i = 0;
for(auto& ctx : devVec) for(auto& ctx : devVec)
...@@ -89,8 +91,11 @@ private: ...@@ -89,8 +91,11 @@ private:
size_t perThread = (size_t(1u)<<21) + 224u; size_t perThread = (size_t(1u)<<21) + 224u;
size_t max_intensity = availableMem / perThread; size_t max_intensity = availableMem / perThread;
// 1000 is a magic selected limit \todo select max intensity depending of the gpu type // 1000 is a magic selected limit \todo select max intensity depending of the gpu type
size_t intensity = std::min( size_t(1000u) , max_intensity ); size_t possibleIntensity = std::min( size_t(1000u) , max_intensity );
conf += std::string(" // gpu: ") + ctx.name + "\n"; // 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) // set 8 threads per block (this is a good value for the most gpus)
conf += std::string(" { \"index\" : ") + std::to_string(ctx.deviceIdx) + ",\n" + conf += std::string(" { \"index\" : ") + std::to_string(ctx.deviceIdx) + ",\n" +
" \"intensity\" : " + std::to_string(intensity) + ", \"worksize\" : " + std::to_string(8) + ",\n" + " \"intensity\" : " + std::to_string(intensity) + ", \"worksize\" : " + std::to_string(8) + ",\n" +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment