Jet  v1.3.3
parallel.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_PARALLEL_H_
8 #define INCLUDE_JET_PARALLEL_H_
9 
10 namespace jet {
11 
14 
30 template <typename RandomIterator, typename T>
31 void parallelFill(const RandomIterator& begin, const RandomIterator& end,
32  const T& value,
34 
50 template <typename IndexType, typename Function>
51 void parallelFor(IndexType beginIndex, IndexType endIndex,
52  const Function& function,
54 
72 template <typename IndexType, typename Function>
73 void parallelRangeFor(IndexType beginIndex, IndexType endIndex,
74  const Function& function,
76 
95 template <typename IndexType, typename Function>
96 void parallelFor(IndexType beginIndexX, IndexType endIndexX,
97  IndexType beginIndexY, IndexType endIndexY,
98  const Function& function,
100 
120 template <typename IndexType, typename Function>
121 void parallelRangeFor(IndexType beginIndexX, IndexType endIndexX,
122  IndexType beginIndexY, IndexType endIndexY,
123  const Function& function,
125 
146 template <typename IndexType, typename Function>
147 void parallelFor(IndexType beginIndexX, IndexType endIndexX,
148  IndexType beginIndexY, IndexType endIndexY,
149  IndexType beginIndexZ, IndexType endIndexZ,
150  const Function& function,
152 
174 template <typename IndexType, typename Function>
175 void parallelRangeFor(IndexType beginIndexX, IndexType endIndexX,
176  IndexType beginIndexY, IndexType endIndexY,
177  IndexType beginIndexZ, IndexType endIndexZ,
178  const Function& function,
180 
198 template <typename IndexType, typename Value, typename Function,
199  typename Reduce>
200 Value parallelReduce(IndexType beginIndex, IndexType endIndex,
201  const Value& identity, const Function& func,
202  const Reduce& reduce,
204 
216 template <typename RandomIterator>
217 void parallelSort(RandomIterator begin, RandomIterator end,
219 
235 template <typename RandomIterator, typename CompareFunction>
236 void parallelSort(RandomIterator begin, RandomIterator end,
237  CompareFunction compare,
239 
241 void setMaxNumberOfThreads(unsigned int numThreads);
242 
244 unsigned int maxNumberOfThreads();
245 
246 } // namespace jet
247 
248 #include "detail/parallel-inl.h"
249 
250 #endif // INCLUDE_JET_PARALLEL_H_
jet::ExecutionPolicy
ExecutionPolicy
Execution policy tag.
Definition: parallel.h:13
jet::ExecutionPolicy::kSerial
@ kSerial
jet::maxNumberOfThreads
unsigned int maxNumberOfThreads()
Returns maximum number of threads to use.
jet
Definition: advection_solver2.h:18
jet::parallelSort
void parallelSort(RandomIterator begin, RandomIterator end, ExecutionPolicy policy=ExecutionPolicy::kParallel)
Sorts a container in parallel.
jet::setMaxNumberOfThreads
void setMaxNumberOfThreads(unsigned int numThreads)
Sets maximum number of threads to use.
jet::parallelReduce
Value parallelReduce(IndexType beginIndex, IndexType endIndex, const Value &identity, const Function &func, const Reduce &reduce, ExecutionPolicy policy=ExecutionPolicy::kParallel)
Performs reduce operation in parallel.
jet::parallelRangeFor
void parallelRangeFor(IndexType beginIndex, IndexType endIndex, const Function &function, ExecutionPolicy policy=ExecutionPolicy::kParallel)
Makes a range-loop from beginIndex to endIndex in parallel.
jet::ExecutionPolicy::kParallel
@ kParallel
jet::parallelFor
void parallelFor(IndexType beginIndex, IndexType endIndex, const Function &function, ExecutionPolicy policy=ExecutionPolicy::kParallel)
Makes a for-loop from beginIndex to endIndex in parallel.
jet::parallelFill
void parallelFill(const RandomIterator &begin, const RandomIterator &end, const T &value, ExecutionPolicy policy=ExecutionPolicy::kParallel)
Fills from begin to end with value in parallel.