Skip to content

Commit b80e55e

Browse files
committed
Wait identifier for ordered construct (macro backend).
Address of parallel data object serves as wait identifier. Add getOrderedIdentifier to backend layer. Further tests for the ordered construct. Merge branch 'revisit/orderedMacroBackend' into develop
2 parents 5f3014f + c29f263 commit b80e55e

29 files changed

Lines changed: 779 additions & 10 deletions

include/opdi/backend/backendInterface.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace opdi {
4242
virtual std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) = 0;
4343
virtual std::size_t getCriticalIdentifier(std::string const& name) = 0;
4444
virtual std::size_t getReductionIdentifier() = 0;
45+
virtual std::size_t getOrderedIdentifier() = 0;
4546

4647
virtual void* getParallelData() = 0;
4748
virtual void* getTaskData() = 0;

include/opdi/backend/macro/macros.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@
181181
#define OPDI_ORDERED(...) \
182182
OPDI_PRAGMA(omp ordered __VA_ARGS__) \
183183
{ \
184-
opdi::logic->onMutexAcquired(opdi::LogicInterface::MutexKind::Ordered, 0);
184+
opdi::logic->onMutexAcquired(opdi::LogicInterface::MutexKind::Ordered, opdi::backend->getOrderedIdentifier());
185185

186186
#define OPDI_END_ORDERED \
187-
opdi::logic->onMutexReleased(opdi::LogicInterface::MutexKind::Ordered, 0); \
187+
opdi::logic->onMutexReleased(opdi::LogicInterface::MutexKind::Ordered, opdi::backend->getOrderedIdentifier()); \
188188
}
189189

190190
#define OPDI_SECTION(...) \

include/opdi/backend/macro/mutexIdentifiers.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ namespace opdi {
4949
omp_destroy_lock(&this->criticalLock);
5050
}
5151

52+
std::size_t getLockIdentifier(omp_lock_t* lock) {
53+
return reinterpret_cast<std::size_t>(lock);
54+
}
55+
56+
std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) {
57+
return reinterpret_cast<std::size_t>(lock);
58+
}
59+
5260
std::size_t getCriticalIdentifier(std::string const& name) {
5361
// unnamed critical region has index 0
5462
if (name.empty()) {
@@ -69,12 +77,8 @@ namespace opdi {
6977
return reinterpret_cast<std::size_t>(opdi::backend->getParallelData());
7078
}
7179

72-
std::size_t getLockIdentifier(omp_lock_t* lock) {
73-
return reinterpret_cast<std::size_t>(lock);
74-
}
75-
76-
std::size_t getNestLockIdentifier(omp_nest_lock_t* lock) {
77-
return reinterpret_cast<std::size_t>(lock);
80+
std::size_t getOrderedIdentifier() {
81+
return reinterpret_cast<std::size_t>(opdi::backend->getParallelData());
7882
}
7983
};
8084

include/opdi/backend/ompt/omptBackend.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,19 @@ namespace opdi {
164164

165165
std::size_t getCriticalIdentifier(std::string const& name) {
166166
OPDI_UNUSED(name);
167-
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of critical regions.");
167+
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of critical constructs.");
168168
return 0;
169169
}
170170

171171
std::size_t getReductionIdentifier() {
172172
return reinterpret_cast<std::size_t>(getParallelData());
173173
}
174174

175+
std::size_t getOrderedIdentifier() {
176+
OPDI_ERROR("OMPT backend does not support explicit queries of mutex identifiers of ordered constructs.");
177+
return 0;
178+
}
179+
175180
void* getParallelData() {
176181
ompt_data_t* parallelData;
177182
int teamSize;

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ DRIVER_FILES = $(wildcard $(DRIVER_DIR)/Driver**.hpp)
7979
DRIVERS ?= $(patsubst $(DRIVER_DIR)/Driver%.hpp,%,$(DRIVER_FILES))
8080

8181
# without surrounding parallel directives, privatized variables are not recognized as shared and sections are considered orphaned; hence, they need to be filtered out
82-
getDriverTests = $(if $(filter FirstOrderReverseNoParallel, $1), $(filter-out ParallelSections ForReduction ForReductionNowait ForReductionMultiple ForFirstprivate ForLastprivate SectionsReduction SectionsReductionMultiple SectionsFirstprivate SectionsLastprivate ReductionNested SingleFirstprivate, $(TESTS)), $(TESTS))
82+
getDriverTests = $(if $(filter FirstOrderReverseNoParallel, $1), $(filter-out ParallelSections ForReduction ForReductionNowait ForReductionMultiple ForFirstprivate ForLastprivate OrderedReduction SectionsReduction SectionsReductionMultiple SectionsFirstprivate SectionsLastprivate ReductionNested SingleFirstprivate, $(TESTS)), $(TESTS))
8383

8484
DRIVER_TESTS =
8585

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Point 0 :
2+
1122.95
3+
1131.29
4+
921.237
5+
27082.9
6+
7009.4
7+
Point 1 :
8+
1092.78
9+
25136.7
10+
11568.7
11+
-5241.95
12+
4100.76
13+
Point 2 :
14+
584.44
15+
9331.68
16+
25714.4
17+
22086.6
18+
259415
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Point 0 :
2+
595.487
3+
177.011
4+
392.217
5+
13697.3
6+
3466.68
7+
Point 1 :
8+
579.603
9+
12167.2
10+
5538.64
11+
-2783.46
12+
1269.94
13+
Point 2 :
14+
309.709
15+
4216.91
16+
13059.9
17+
11645.2
18+
135468
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Point 0 :
2+
284.648
3+
67.4236
4+
2287.84
5+
1024.19
6+
1103.57
7+
Point 1 :
8+
281.379
9+
10683.2
10+
8105.08
11+
1775.5
12+
2889.52
13+
Point 2 :
14+
271.24
15+
3300.12
16+
7635.88
17+
7563.86
18+
111812
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Point 0 :
2+
1122.95
3+
1131.29
4+
921.237
5+
27082.9
6+
7009.4
7+
Point 1 :
8+
1092.78
9+
25136.7
10+
11568.7
11+
-5241.95
12+
4100.76
13+
Point 2 :
14+
584.44
15+
9331.68
16+
25714.4
17+
22086.6
18+
259415
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Point 0 :
2+
595.487
3+
177.011
4+
392.217
5+
13697.3
6+
3466.68
7+
Point 1 :
8+
579.603
9+
12167.2
10+
5538.64
11+
-2783.46
12+
1269.94
13+
Point 2 :
14+
309.709
15+
4216.91
16+
13059.9
17+
11645.2
18+
135468

0 commit comments

Comments
 (0)