Commit def1d303 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

rearranging to fit the original function order; convenience version of execParallel()

parent ae170dd0
Pipeline #81801 passed with stages
in 12 minutes and 44 seconds
This diff is collapsed.
......@@ -56,13 +56,13 @@ def explicit_gridder(uvw, freq, ms, wgt, nxdirty, nydirty, xpixsize, ypixsize,
@pmp('nxdirty', [16, 64])
@pmp('nydirty', [64])
@pmp("nrow", (1, 100, 10000))
@pmp("nchan", (1,))
@pmp("nrow", (1, 100))
@pmp("nchan", (1, 7))
@pmp("epsilon", list(10.**np.linspace(-2.,-12.,100)))
@pmp("singleprec", (False,))
@pmp("wstacking", (True,))
@pmp("use_wgt", (True,))
@pmp("nthreads", (1,))
@pmp("nthreads", (1, 10))
@pmp("fov", (10.,))
def test_ms2dirty_against_wdft2(nxdirty, nydirty, nrow, nchan, epsilon, singleprec, wstacking, use_wgt, fov, nthreads):
if singleprec and epsilon < 5e-5:
......
......@@ -23,6 +23,7 @@
#define DUCC0_THREADING_H
#include <functional>
#include "ducc0/infra/misc_utils.h"
namespace ducc0 {
......@@ -61,6 +62,28 @@ void execGuided(size_t nwork, size_t nthreads, size_t chunksize_min,
double fact_max, std::function<void(Scheduler &)> func);
void execParallel(size_t nthreads, std::function<void(Scheduler &)> func);
inline void execParallel(size_t nwork, size_t nthreads,
std::function<void(size_t, size_t)> func)
{
execParallel(nthreads, [&](Scheduler &sched)
{
auto tid = sched.thread_num();
auto [lo, hi] = calcShare(nthreads, tid, nwork);
func(lo, hi);
});
}
inline void execParallel(size_t nwork, size_t nthreads,
std::function<void(size_t, size_t, size_t)> func)
{
execParallel(nthreads, [&](Scheduler &sched)
{
auto tid = sched.thread_num();
auto [lo, hi] = calcShare(nthreads, tid, nwork);
func(tid, lo, hi);
});
}
} // end of namespace detail_threading
using detail_threading::max_threads;
......
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