Template Function sequant::for_each¶
Defined in File runtime.hpp
Function Documentation¶
-
template<typename SizedRange, typename UnaryOp>
void sequant::for_each(SizedRange &rng, const UnaryOp &op)¶ Parallel version of std::for_each , using either parallel C++ algorithms or manual threaded implementation with at most
nthreads
instances executing concurrently, wherenthreads
is the value returned by get_num_threads() .See also
get_num_threads()
Note
The load is balanced dynamically.
- Template Parameters:
SizedRange – a sied range
UnaryOp – a function type for which
Lambda(int)
is valid
- Parameters:
rng – the
SizedRange
objectop – the function object to execute, each will be invoked as
op
(std::advance(begin(rng) + task_id)) wheretask_id
is an integer in[0,size(rng)) .
op(t1)
will be commenced not afterop(t2)
ift1<t2
.