Skip to content

Commit d5bff47

Browse files
committed
Additional warnings and errors.
Errors - recordings during passive parallel regions - reverse parallel region does not use requested number of threads - actual number of threads exceeds maximum number of threads Warnings - parallel region for cleanup does not use requested number of threads Merge branch 'feature/errorHandling' into develop
2 parents 547265b + e65b2fc commit d5bff47

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

include/opdi/logic/omp/implicitTaskOmpLogic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ void* opdi::ImplicitTaskOmpLogic::onImplicitTaskBegin(bool initialImplicitTask,
6161
// adjoint access mode.
6262
if (!initialImplicitTask) {
6363
if (index == 0) {
64+
if (parallelData->maxThreads < actualParallelism) {
65+
OPDI_ERROR("Actual number of threads exceeds maximum number of threads.");
66+
}
6467
parallelData->actualThreads = actualParallelism;
6568
}
6669

@@ -127,8 +130,8 @@ void opdi::ImplicitTaskOmpLogic::onImplicitTaskEnd(void* dataPtr) {
127130

128131
if (!data->parallelData->activeParallelRegion) {
129132
if (tool->comparePosition(data->positions.front(), data->positions.back()) != 0) {
130-
OPDI_WARNING("Something became active during a passive parallel region. This is not supported and will not ",
131-
"be differentiated correctly.");
133+
OPDI_ERROR("Something became active during a passive parallel region. This is not supported and will not be",
134+
"differentiated correctly.");
132135
}
133136
}
134137
else {

include/opdi/logic/omp/parallelOmpLogic.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ void opdi::ParallelOmpLogic::reverseFunc(void* dataPtr) {
5151

5252
#pragma omp parallel num_threads(data->actualThreads)
5353
{
54+
if (data->actualThreads != omp_get_num_threads()) {
55+
OPDI_ERROR("Parallel region in the reverse pass does not use the required number of threads.");
56+
}
57+
5458
int threadNum = omp_get_thread_num();
5559

5660
ImplicitTaskOmpLogic::Data* taskData = reinterpret_cast<ImplicitTaskOmpLogic::Data*>(data->childTasks[threadNum]);
@@ -108,6 +112,10 @@ void opdi::ParallelOmpLogic::deleteFunc(void* dataPtr) {
108112
// this triggers possibly pending implicit task end events
109113
#pragma omp parallel num_threads(data->actualThreads)
110114
{
115+
if (data->actualThreads != omp_get_num_threads()) {
116+
OPDI_WARNING("Parallel region during cleanup does not use the required number of threads.");
117+
}
118+
111119
int threadNum = omp_get_thread_num();
112120

113121
ImplicitTaskOmpLogic::Data* taskData = reinterpret_cast<ImplicitTaskOmpLogic::Data*>(data->childTasks[threadNum]);

0 commit comments

Comments
 (0)