Commit c2b45dd7 authored by Martin Reinecke's avatar Martin Reinecke

cosmetics

parent f978182b
...@@ -1570,6 +1570,15 @@ size_t getIdxSize(const Baselines &baselines, ...@@ -1570,6 +1570,15 @@ size_t getIdxSize(const Baselines &baselines,
return res; 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, void fillIdx(const Baselines &baselines,
const GridderConfig &gconf, const const_mav<bool,2> &flags, int chbegin, const GridderConfig &gconf, const const_mav<bool,2> &flags, int chbegin,
int chend, double wmin, double wmax, mav<idx_t,1> &res) int chend, double wmin, double wmax, mav<idx_t,1> &res)
...@@ -1589,14 +1598,12 @@ void fillIdx(const Baselines &baselines, ...@@ -1589,14 +1598,12 @@ void fillIdx(const Baselines &baselines,
vector<idx_t> acc(nbu*nbv+1, 0); vector<idx_t> acc(nbu*nbv+1, 0);
vector<idx_t> tmp(nrow*(chend-chbegin),~idx_t(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 nthr = my_num_threads();
idx_t id = my_thread_num(); idx_t id = my_thread_num();
idx_t nbase = nrow/nthr; size_t lo, hi;
idx_t additional = nrow%nthr; calc_share(nthr, id, nrow, lo, hi);
idx_t lo = id*nbase + ((id<additional) ? id : additional);
idx_t hi = lo+nbase+(id<additional);
vector<idx_t> lacc(nbu*nbv+1, 0); vector<idx_t> lacc(nbu*nbv+1, 0);
for (idx_t irow=lo, idx=lo*(chend-chbegin); irow<hi; ++irow) 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