alsk/plot/executor/firstlevelequi.cpp

24 lines
493 B
C++
Raw Permalink Normal View History

2021-05-10 16:14:13 +00:00
#include "firstlevelequi.h"
Split firstLevelEqui(std::size_t n, CoresList const& coresList) {
Split split;
auto firstLevelPar = n;
split.insert(0);
for(auto const& k: coresList) {
std::size_t start{};
std::size_t const step = firstLevelPar/k;
std::size_t remain = firstLevelPar - step*k;
for(unsigned int i = 0; i < k-1; ++i) {
std::size_t offset = !!remain;
remain -= offset;
start += step+offset;
split.insert(start * (n/firstLevelPar));
}
}
return split;
}