20 #ifndef GALOIS_LOOPS_H
21 #define GALOIS_LOOPS_H
23 #include "galois/config.h"
51 template <
typename RangeFunc,
typename FunctionTy,
typename... Args>
52 void for_each(
const RangeFunc& rangeMaker, FunctionTy&& fn,
53 const Args&... args) {
54 auto tpl = std::make_tuple(args...);
70 template <
typename RangeFunc,
typename FunctionTy,
typename... Args>
71 void do_all(
const RangeFunc& rangeMaker, FunctionTy&& fn,
const Args&... args) {
72 auto tpl = std::make_tuple(args...);
85 template <
typename FunctionTy,
typename... Args>
86 void on_each(FunctionTy&& fn,
const Args&... args) {
96 static inline void preAlloc(
int num) {
97 static const bool DISABLE_PREALLOC =
false;
98 if (DISABLE_PREALLOC) {
112 static inline void reportPageAlloc(
const char* label) {
133 template <
typename Iter,
typename Cmp,
typename NhFunc,
typename OpFunc>
135 const OpFunc& fn,
const char*
loopname = 0) {
159 template <
typename Iter,
typename Cmp,
typename NhFunc,
typename OpFunc,
162 const OpFunc& fn,
const StableTest& stabilityTest,
174 template <
typename RangeFunc,
typename F,
typename... Args>
176 Args&&... args)
const {
187 template <
typename RangeFunc,
typename F,
typename... Args>
189 Args&&... args)
const {
190 auto range = rangeMaker(std::make_tuple(args...));
196 template <
typename RangeFunc,
typename F,
typename... Args>
198 Args&&... args)
const {
203 template <
typename Q>
209 template <
typename RangeFunc,
typename F,
typename... Args>
210 void operator()(
const RangeFunc& rangeMaker,
const F& f, Args&&... args) {
212 auto range = rangeMaker(std::make_tuple(args...));
214 m_q.push(range.begin(), range.end());
216 while (!
m_q.empty()) {
217 auto val =
m_q.pop();
226 #endif // GALOIS_LOOPS_H
void for_each_gen(const RangeTy &r, FunctionTy &&fn, const TupleTy &tpl)
Normalize arguments to for_each.
Definition: Executor_ForEach.h:466
Helper functor class to invoke galois::do_all on provided args Can be used to choose between galois::...
Definition: Loops.h:173
void on_each_gen(FunctionTy &&fn, const TupleTy &tpl)
Definition: Executor_OnEach.h:74
WhileQ(Q &&q=Q())
Definition: Loops.h:207
void operator()(const RangeFunc &rangeMaker, const F &f, Args &&...args)
Definition: Loops.h:210
void reportPageAlloc(const char *category)
Reports Galois system memory stats for all threads.
Definition: Statistics.cpp:128
void for_each_ordered(Iter b, Iter e, const Cmp &cmp, const NhFunc &nhFunc, const OpFunc &fn, const char *loopname=0)
Galois ordered set iterator for stable source algorithms.
Definition: Loops.h:134
void for_each_ordered_impl(Iter GALOIS_UNUSED(beg), Iter GALOIS_UNUSED(end), const Cmp &GALOIS_UNUSED(cmp), const NhFunc &GALOIS_UNUSED(nhFunc), const OpFunc &GALOIS_UNUSED(opFunc), const char *GALOIS_UNUSED(loopname))
Definition: Executor_Ordered.h:31
void do_all_gen(const R &range, F &&func, const ArgsTuple &argsTuple)
Definition: Executor_DoAll.h:530
void preAlloc_impl(unsigned num)
Memory management functionality.
Definition: PreAlloc.cpp:24
Helper functor to invoke std::for_each with the same interface as galois::do_all. ...
Definition: Loops.h:186
void do_all(const RangeFunc &rangeMaker, FunctionTy &&fn, const Args &...args)
Standard do-all loop.
Definition: Loops.h:71
Q m_q
Definition: Loops.h:205
void on_each(FunctionTy &&fn, const Args &...args)
Low-level parallel loop.
Definition: Loops.h:86
void operator()(const RangeFunc &rangeMaker, const F &f, Args &&...args) const
Definition: Loops.h:175
void for_each(const RangeFunc &rangeMaker, FunctionTy &&fn, const Args &...args)
Galois unordered set iterator.
Definition: Loops.h:52
void operator()(const RangeFunc &rangeMaker, const F &f, Args &&...args) const
Definition: Loops.h:188
void gWarn(Args &&...args)
Prints a warning string from a sequence of things.
Definition: gIO.h:63
void operator()(const RangeFunc &rangeMaker, const F &f, Args &&...args) const
Definition: Loops.h:197