dispenso 1.4.1
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 181 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.
Examples
for_each_example.cpp.

Definition at line 165 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 147 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.
Examples
for_each_example.cpp.

Definition at line 58 of file for_each.h.