dispenso
A library for task parallelism
 
Loading...
Searching...
No Matches
for_each.h File Reference
#include <algorithm>
#include <dispenso/detail/per_thread_info.h>
#include <dispenso/task_set.h>

Go to the source code of this file.

Classes

struct  dispenso::ForEachOptions
 

Functions

template<typename TaskSetT , typename Iter , typename F >
void dispenso::for_each_n (TaskSetT &tasks, Iter start, size_t n, F &&f, ForEachOptions options={})
 
template<typename Iter , typename F >
void dispenso::for_each_n (Iter start, size_t n, F &&f, ForEachOptions options={})
 
template<typename TaskSetT , typename Iter , typename F >
void dispenso::for_each (TaskSetT &tasks, Iter start, Iter end, F &&f, ForEachOptions options={})
 
template<typename Iter , typename F >
void dispenso::for_each (Iter start, Iter end, F &&f, ForEachOptions options={})
 

Detailed Description

Functions for performing parallel for_each over iterables. This intends to more-or-less mimic std::for_each, with a possible (Concurrent)TaskSet passed in for external wait capability, and ForEachOptions for controlling the wait behavior and limiting of parallelism.

Definition in file for_each.h.

Function Documentation

◆ for_each() [1/2]

template<typename Iter , typename F >
void dispenso::for_each ( Iter  start,
Iter  end,
F &&  f,
ForEachOptions  options = {} 
)

A function like std::for_each, but where the function is invoked in parallel across the passed range.

Parameters
startThe iterator for the start of the range.
endThe iterator for the end of the range.
fThe function to execute in parallel. This is a unary function that must be capable of taking dereference of Iter.
optionsSee ForEachOptions for details; however it should be noted that this function must always wait, and therefore options.wait is ignored.

Definition at line 180 of file for_each.h.

◆ for_each() [2/2]

template<typename TaskSetT , typename Iter , typename F >
void dispenso::for_each ( TaskSetT tasks,
Iter  start,
Iter  end,
F &&  f,
ForEachOptions  options = {} 
)

A function like std::for_each, but where the function is invoked in parallel across the passed range.

Parameters
tasksThe task set to schedule the for_each on.
startThe iterator for the start of the range.
endThe iterator for the end of the range.
fThe function to execute in parallel. This is a unary function that must be capable of taking dereference of Iter.
optionsSee ForEachOptions for details.

Definition at line 164 of file for_each.h.

◆ for_each_n() [1/2]

template<typename Iter , typename F >
void dispenso::for_each_n ( Iter  start,
size_t  n,
F &&  f,
ForEachOptions  options = {} 
)

A function like std::for_each_n, but where the function is invoked in parallel across the passed range.

Parameters
startThe iterator for the start of the range.
nThe length of the range.
fThe function to execute in parallel. This is a unary function that must be capable of taking dereference of Iter.
optionsSee ForEachOptions for details; however it should be noted that this function must always wait, and therefore options.wait is ignored.

Definition at line 146 of file for_each.h.

◆ for_each_n() [2/2]

template<typename TaskSetT , typename Iter , typename F >
void dispenso::for_each_n ( TaskSetT tasks,
Iter  start,
size_t  n,
F &&  f,
ForEachOptions  options = {} 
)

A function like std::for_each_n, but where the function is invoked in parallel across the passed range.

Parameters
tasksThe task set to schedule the for_each on.
startThe iterator for the start of the range.
nThe length of the range.
fThe function to execute in parallel. This is a unary function that must be capable of taking dereference of Iter.
optionsSee ForEachOptions for details.

Definition at line 57 of file for_each.h.