Skip to content

Commit 1da798f

Browse files
committed
Make AD treatment and instrumentation consistent w.r.t tape activity.
Merge branch 'revisit/tapeActivity' into develop
2 parents 418fcb2 + ca3c4c0 commit 1da798f

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

include/opdi/logic/omp/flushOmpLogic.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ namespace opdi {
5151
public:
5252

5353
virtual void addReverseFlush() {
54-
Handle* handle = new Handle;
55-
handle->reverseFunc = FlushOmpLogic::reverseFunc;
56-
tool->pushExternalFunction(tool->getThreadLocalTape(), handle);
54+
55+
if (tool != nullptr && tool->getThreadLocalTape() != nullptr && tool->isActive(tool->getThreadLocalTape())) {
56+
57+
Handle* handle = new Handle;
58+
handle->reverseFunc = FlushOmpLogic::reverseFunc;
59+
tool->pushExternalFunction(tool->getThreadLocalTape(), handle);
60+
}
5761
}
5862
};
5963
}

include/opdi/logic/omp/masterOmpLogic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ void opdi::MasterOmpLogic::deleteFunc(void* dataPtr) {
5454
void opdi::MasterOmpLogic::onMaster(ScopeEndpoint endpoint) {
5555

5656
#if OPDI_OMP_LOGIC_INSTRUMENT
57-
for (auto& instrument : ompLogicInstruments) {
58-
instrument->onMaster(endpoint);
59-
}
60-
6157
if (tool->getThreadLocalTape() != nullptr && tool->isActive(tool->getThreadLocalTape())) {
6258

59+
for (auto& instrument : ompLogicInstruments) {
60+
instrument->onMaster(endpoint);
61+
}
62+
6363
Data* data = new Data;
6464
data->endpoint = endpoint;
6565

include/opdi/logic/omp/syncRegionOmpLogic.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ bool opdi::SyncRegionOmpLogic::requiresReverseBarrier(SyncRegionKind kind, Scope
8282

8383
void opdi::SyncRegionOmpLogic::onSyncRegion(SyncRegionKind kind, ScopeEndpoint endpoint) {
8484

85-
#if OPDI_OMP_LOGIC_INSTRUMENT
86-
for (auto& instrument : ompLogicInstruments) {
87-
instrument->onSyncRegion(kind, endpoint);
88-
}
89-
#endif
90-
9185
if (tool->getThreadLocalTape() != nullptr && tool->isActive(tool->getThreadLocalTape())) {
86+
87+
#if OPDI_OMP_LOGIC_INSTRUMENT
88+
for (auto& instrument : ompLogicInstruments) {
89+
instrument->onSyncRegion(kind, endpoint);
90+
}
91+
#endif
92+
9293
if (requiresReverseBarrier(kind, endpoint)) {
9394
internalPushHandle(kind, endpoint);
9495
}

0 commit comments

Comments
 (0)