Skip to content

Commit 6d965b9

Browse files
committed
Introduce a thread-sanitizer dependent loop macro.
1 parent f52ba05 commit 6d965b9

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

Common/src/geometry/CPhysicalGeometry.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10565,6 +10565,15 @@ std::unique_ptr<CADTElemClass> CPhysicalGeometry::ComputeViscousWallADT(const CC
1056510565
return WallADT;
1056610566
}
1056710567

10568+
/*--- Use a thread-sanitizer dependent loop schedule to work around suspected false positives ---*/
10569+
#ifndef __SANITIZE_THREAD__
10570+
#define CPHYSGEO_PARFOR SU2_OMP_FOR_DYN(roundUpDiv(nPoint, 2 * omp_get_max_threads()))
10571+
#else
10572+
#define CPHYSGEO_PARFOR SU2_OMP_FOR_()
10573+
#endif
10574+
10575+
#define END_CPHYSGEO_PARFOR END_SU2_OMP_FOR
10576+
1056810577
void CPhysicalGeometry::SetWallDistance(CADTElemClass* WallADT, const CConfig* config, unsigned short iZone) {
1056910578
/*--------------------------------------------------------------------------*/
1057010579
/*--- Step 3: Loop over all interior mesh nodes and compute minimum ---*/
@@ -10576,11 +10585,7 @@ void CPhysicalGeometry::SetWallDistance(CADTElemClass* WallADT, const CConfig* c
1057610585
distance for all nodes. ---*/
1057710586

1057810587
SU2_OMP_PARALLEL {
10579-
#ifndef __SANITIZE_THREAD__
10580-
SU2_OMP_FOR_DYN(roundUpDiv(nPoint, 2 * omp_get_max_threads()))
10581-
#else
10582-
SU2_OMP_FOR_()
10583-
#endif
10588+
CPHYSGEO_PARFOR
1058410589
for (unsigned long iPoint = 0; iPoint < GetnPoint(); ++iPoint) {
1058510590
unsigned short markerID;
1058610591
unsigned long elemID;
@@ -10593,12 +10598,11 @@ void CPhysicalGeometry::SetWallDistance(CADTElemClass* WallADT, const CConfig* c
1059310598
nodes->SetWall_Distance(iPoint, dist, rankID, iZone, markerID, elemID);
1059410599
}
1059510600
}
10596-
#ifndef __SANITIZE_THREAD__
10597-
END_SU2_OMP_FOR
10598-
#else
10599-
END_SU2_OMP_FOR
10600-
#endif
10601+
END_CPHYSGEO_PARFOR
1060110602
}
1060210603
END_SU2_OMP_PARALLEL
1060310604
}
1060410605
}
10606+
10607+
#undef CPHYSGEO_PARFOR
10608+
#undef END_CPHYSGEO_PARFOR

su2omp.syntax.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"SU2_OMP_FOR_STAT": "END_SU2_OMP_FOR",
3939
"CSYSVEC_PARFOR": "END_CSYSVEC_PARFOR",
4040
"CNEWTON_PARFOR": "END_CNEWTON_PARFOR",
41-
"BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS": "END_SU2_OMP_SAFE_GLOBAL_ACCESS"
41+
"BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS": "END_SU2_OMP_SAFE_GLOBAL_ACCESS",
42+
"CPHYSGEO_PARFOR": "END_CPHYSGEO_PARFOR"
4243
}
4344
}

0 commit comments

Comments
 (0)