alsk/plot/executor/firstlevelequi.cpp
2021-05-10 18:14:13 +02:00

24 lines
493 B
C++

#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;
}