Commit c2b45dd7 authored by Martin Reinecke's avatar Martin Reinecke

cosmetics

parent f978182b
......@@ -1570,6 +1570,15 @@ size_t getIdxSize(const Baselines &baselines,
return res;
}
void calc_share(size_t nshares, size_t myshare, size_t nwork, size_t &lo,
size_t &hi)
{
size_t nbase = nwork/nshares;
size_t additional = nwork%nshares;
lo = myshare*nbase + ((myshare<additional) ? myshare : additional);
hi = lo+nbase+(myshare<additional);
}
void fillIdx(const Baselines &baselines,
const GridderConfig &gconf, const const_mav<bool,2> &flags, int chbegin,
int chend, double wmin, double wmax, mav<idx_t,1> &res)
......@@ -1589,14 +1598,12 @@ void fillIdx(const Baselines &baselines,
vector<idx_t> acc(nbu*nbv+1, 0);
vector<idx_t> tmp(nrow*(chend-chbegin),~idx_t(0));
#pragma omp parallel
#pragma omp parallel num_threads(gconf.Nthreads())
{
idx_t nthr = my_num_threads();
idx_t id = my_thread_num();
idx_t nbase = nrow/nthr;
idx_t additional = nrow%nthr;
idx_t lo = id*nbase + ((id<additional) ? id : additional);
idx_t hi = lo+nbase+(id<additional);
size_t lo, hi;
calc_share(nthr, id, nrow, lo, hi);
vector<idx_t> lacc(nbu*nbv+1, 0);
for (idx_t irow=lo, idx=lo*(chend-chbegin); irow<hi; ++irow)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment