File tree Expand file tree Collapse file tree
include/opdi/backend/macro Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,16 +36,16 @@ std::stack<bool> opdi::ImplicitBarrierTools::implicitBarrierStack;
3636
3737omp_lock_t opdi::ReductionTools::globalReducerLock;
3838std::list<omp_nest_lock_t *> opdi::ReductionTools::individualReducerLocks;
39- std::stack<bool > opdi::ReductionTools::reductionBarrierStack;
39+ std::stack<bool > opdi::ReductionTools::hasReductions;
40+ std::stack<bool > opdi::ReductionTools::needsBarrierBeforeReductions;
41+ std::stack<bool > opdi::ReductionTools::needsBarrierAfterReductions;
4042
4143template <typename Type, int identifier>
4244omp_nest_lock_t opdi::Reducer<Type, identifier>::reduceLock;
4345
4446template <typename Type, int identifier>
4547bool opdi::Reducer<Type, identifier>::isInitialized = false ;
4648
47- std::stack<opdi::ProbeScopeStatus::Status> opdi::ProbeScopeStatus::statusStack;
48-
4949// global macro backend variables
5050
5151opdi::LoopProbe opdi::internalLoopProbe (0 );
Original file line number Diff line number Diff line change 4545#include " macros.hpp"
4646#include " mutexIdentifiers.hpp"
4747#include " probes.hpp"
48- #include " probeTools.hpp"
4948#include " reductionTools.hpp"
5049
5150namespace opdi {
Original file line number Diff line number Diff line change 4949
5050#define OPDI_FOR (...) \
5151 opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier (); \
52+ opdi::ReductionTools::beginRegionThatSupportsReductions (true ); \
5253 OPDI_PRAGMA (omp for __VA_ARGS__ private (opdi::internalLoopProbe))
5354
5455#define OPDI_END_FOR \
56+ opdi::ReductionTools::endRegionThatSupportsReductions (); \
5557 opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier ();
5658
5759#define OPDI_SECTIONS (...) \
5860 opdi::ImplicitBarrierTools::beginRegionWithImplicitBarrier (); \
61+ opdi::ReductionTools::beginRegionThatSupportsReductions (true ); \
5962 OPDI_PRAGMA (omp sections private (opdi::internalSectionsProbe) __VA_ARGS__)
6063
6164#define OPDI_END_SECTIONS \
65+ opdi::ReductionTools::endRegionThatSupportsReductions (); \
6266 opdi::ImplicitBarrierTools::endRegionWithImplicitBarrier ();
6367
6468#define OPDI_SINGLE (...) \
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3131
3232#include " dataTools.hpp"
3333#include " implicitBarrierTools.hpp"
34- #include " probeTools.hpp"
3534#include " reductionTools.hpp"
3635
3736namespace opdi {
@@ -54,12 +53,13 @@ namespace opdi {
5453 this ->parallelData );
5554 DataTools::pushTaskData (this ->taskData );
5655
57- ProbeScopeStatus::beginImplicitTaskProbeScope ( );
56+ ReductionTools::beginRegionThatSupportsReductions ( false );
5857 }
5958
6059 ~TaskProbe () {
6160 if (needsAction) {
62- ProbeScopeStatus::endImplicitTaskProbeScope ();
61+ /* order of TaskProbe and ReductionProbe destructors not relevant */
62+ ReductionTools::endRegionThatSupportsReductions ();
6363 logic->onImplicitTaskEnd (this ->taskData );
6464 DataTools::popTaskData ();
6565 DataTools::popParallelData ();
@@ -103,22 +103,13 @@ namespace opdi {
103103 struct ReductionProbe {
104104 public:
105105
106- bool needsAction;
107-
108- ReductionProbe (int ) : needsAction(false ) {}
106+ ReductionProbe (int ) {}
109107
110- ReductionProbe () : needsAction(true ) {
111- ProbeScopeStatus::beginReductionProbeScope ();
112- ReductionTools::beginRegionWithReduction ();
108+ ReductionProbe () {
109+ ReductionTools::regionHasReductions ();
113110 }
114111
115- ~ReductionProbe () {
116- if (needsAction) {
117- ReductionTools::addBarrierIfNeeded ();
118- ReductionTools::endRegionWithReduction ();
119- ProbeScopeStatus::endReductionProbeScope ();
120- }
121- }
112+ ~ReductionProbe () {}
122113 };
123114
124115 extern ReductionProbe internalReductionProbe;
You can’t perform that action at this time.
0 commit comments