Skip to content

Commit 1f303da

Browse files
committed
Make AD events for master construct optional.
1 parent 0602053 commit 1f303da

4 files changed

Lines changed: 26 additions & 9 deletions

File tree

include/opdi/backend/macro/macros.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <omp.h>
2929

30+
#include "../../config.hpp"
3031
#include "../../helpers/macros.hpp"
3132

3233
#include "implicitBarrierTools.hpp"
@@ -144,14 +145,21 @@
144145

145146
#define OPDI_END_SECTION
146147

147-
#define OPDI_MASTER(...) \
148-
OPDI_PRAGMA(omp master __VA_ARGS__) \
149-
{ \
150-
opdi::logic->onMaster(opdi::LogicInterface::ScopeEndpoint::Begin);
148+
#if OPDI_BACKEND_GENERATE_MASTER_EVENTS
149+
#define OPDI_MASTER(...) \
150+
OPDI_PRAGMA(omp master __VA_ARGS__) \
151+
{ \
152+
opdi::logic->onMaster(opdi::LogicInterface::ScopeEndpoint::Begin);
151153

152-
#define OPDI_END_MASTER \
153-
opdi::logic->onMaster(opdi::LogicInterface::ScopeEndpoint::End); \
154-
}
154+
#define OPDI_END_MASTER \
155+
opdi::logic->onMaster(opdi::LogicInterface::ScopeEndpoint::End); \
156+
}
157+
#else
158+
#define OPDI_MASTER(...) \
159+
OPDI_PRAGMA(omp master __VA_ARGS__) \
160+
161+
#define OPDI_END_MASTER /* empty */
162+
#endif
155163

156164
// standalone macros
157165

include/opdi/backend/ompt/masterCallbacks.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#pragma once
2727

28+
#include "../../config.hpp"
2829
#include "../../helpers/exceptions.hpp"
2930
#include "../../helpers/macros.hpp"
3031
#include "../../logic/logicInterface.hpp"

include/opdi/backend/ompt/omptBackend.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ namespace opdi {
105105
SyncRegionCallbacks::init();
106106
MutexCallbacks::init();
107107
ReductionCallbacks::init();
108-
MasterCallbacks::init();
108+
#if OPDI_BACKEND_GENERATE_MASTER_EVENTS
109+
MasterCallbacks::init();
110+
#endif
109111

110112
return 1; // success
111113
}
@@ -115,7 +117,9 @@ namespace opdi {
115117
OPDI_UNUSED(toolData);
116118

117119
// finalize callback structures
118-
MasterCallbacks::finalize();
120+
#if OPDI_BACKEND_GENERATE_MASTER_EVENTS
121+
MasterCallbacks::finalize();
122+
#endif
119123
ReductionCallbacks::finalize();
120124
MutexCallbacks::finalize();
121125
SyncRegionCallbacks::finalize();

include/opdi/config.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646

4747
/* ----- backend configuration ----- */
4848

49+
#ifndef OPDI_BACKEND_GENERATE_MASTER_EVENTS
50+
#define OPDI_BACKEND_GENERATE_MASTER_EVENTS 0
51+
#endif
52+
4953
#ifndef OPDI_OMPT_BACKEND_IMPLICIT_TASK_END_SOURCE
5054
#define OPDI_OMPT_BACKEND_IMPLICIT_TASK_END_SOURCE OPDI_OMPT_IMPLICIT_TASK_END
5155
#endif

0 commit comments

Comments
 (0)