Skip to content

Commit 8f5d770

Browse files
authored
Merge pull request #2068 from su2code/feature_tsan_ci
Thread sanitizer tests in the CI pipeline
2 parents a7df296 + b9a7777 commit 8f5d770

7 files changed

Lines changed: 339 additions & 186 deletions

File tree

.github/workflows/regression.yml

Lines changed: 98 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ jobs:
5252
key: ${{ matrix.config_set }}-${{ github.sha }}
5353
restore-keys: ${{ matrix.config_set }}
5454
- name: Pre Cleanup
55-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
55+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
5656
with:
5757
entrypoint: /bin/rm
5858
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
5959
- name: Build
60-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
60+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
6161
with:
6262
args: -b ${{github.ref}} -f "${{matrix.flags}}"
6363
- name: Compress binaries
@@ -68,7 +68,50 @@ jobs:
6868
name: ${{ matrix.config_set }}
6969
path: install_bin.tgz
7070
- name: Post Cleanup
71-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
71+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
72+
with:
73+
entrypoint: /bin/rm
74+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
75+
build_tsan:
76+
name: Build SU2 (tsan)
77+
if: inputs.runner != 'ARM64'
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
config_set: [BaseOMP-tsan, ReverseOMP-tsan] #ForwardOMP-tsan
82+
include:
83+
- config_set: BaseOMP-tsan
84+
flags: '--buildtype=debugoptimized -Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --warnlevel=3'
85+
- config_set: ReverseOMP-tsan
86+
flags: '--buildtype=debugoptimized -Denable-autodiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --warnlevel=3'
87+
#- config_set: ForwardOMP-tsan
88+
# flags: '--buildtype=debug -Denable-directdiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-pywrapper=true -Denable-tecio=false --warnlevel=3 --werror'
89+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
90+
steps:
91+
- name: Cache Object Files
92+
uses: actions/cache@v3
93+
with:
94+
path: ccache
95+
key: ${{ matrix.config_set }}-${{ github.sha }}
96+
restore-keys: ${{ matrix.config_set }}
97+
- name: Pre Cleanup
98+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
99+
with:
100+
entrypoint: /bin/rm
101+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
102+
- name: Build
103+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
104+
with:
105+
args: -b ${{github.ref}} -f "${{matrix.flags}}"
106+
- name: Compress binaries
107+
run: tar -zcvf install_bin.tgz install/bin
108+
- name: Upload Binaries
109+
uses: actions/upload-artifact@v3
110+
with:
111+
name: ${{ matrix.config_set }}
112+
path: install_bin.tgz
113+
- name: Post Cleanup
114+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
72115
with:
73116
entrypoint: /bin/rm
74117
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -99,7 +142,7 @@ jobs:
99142
tag: OMP
100143
steps:
101144
- name: Pre Cleanup
102-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
145+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
103146
with:
104147
entrypoint: /bin/rm
105148
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -125,12 +168,58 @@ jobs:
125168
chmod a+x $BIN_FOLDER/*
126169
ls -lahR $BIN_FOLDER
127170
- name: Run Tests in Container
128-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
171+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
129172
with:
130173
# -t <Tutorials-branch> -c <Testcases-branch>
131174
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
132175
- name: Cleanup
133-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
176+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
177+
with:
178+
entrypoint: /bin/rm
179+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
180+
thread_sanitizer_tests:
181+
if: inputs.runner != 'ARM64'
182+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
183+
name: Thread Sanitizer Tests
184+
needs: build_tsan
185+
strategy:
186+
fail-fast: false
187+
matrix:
188+
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
189+
steps:
190+
- name: Pre Cleanup
191+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
192+
with:
193+
entrypoint: /bin/rm
194+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
195+
- name: Download All artifacts
196+
uses: actions/download-artifact@v3
197+
- name: Uncompress and Move Binaries
198+
run: |
199+
BIN_FOLDER="$PWD/install/bin"
200+
mkdir -p $BIN_FOLDER
201+
ls -lah $BIN_FOLDER
202+
for type in Base Reverse Forward; do
203+
TYPE_FOLDER="${type}OMP-tsan"
204+
echo "Processing '$TYPE_FOLDER' ..."
205+
if [ -d $TYPE_FOLDER ]; then
206+
pushd $TYPE_FOLDER
207+
ls -lah
208+
tar -zxvf install_bin.tgz
209+
ls -lah install/bin/
210+
cp -r install/bin/* $BIN_FOLDER;
211+
popd;
212+
fi
213+
done
214+
chmod a+x $BIN_FOLDER/*
215+
ls -lahR $BIN_FOLDER
216+
- name: Run Tests in Container
217+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
218+
with:
219+
# -t <Tutorials-branch> -c <Testcases-branch>
220+
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tsan"
221+
- name: Cleanup
222+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
134223
with:
135224
entrypoint: /bin/rm
136225
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -151,7 +240,7 @@ jobs:
151240
tag: MPI
152241
steps:
153242
- name: Pre Cleanup
154-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
243+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
155244
with:
156245
entrypoint: /bin/rm
157246
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -212,11 +301,11 @@ jobs:
212301
echo $PWD
213302
ls -lahR
214303
- name: Run Unit Tests
215-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
304+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
216305
with:
217306
entrypoint: install/bin/${{matrix.testdriver}}
218307
- name: Post Cleanup
219-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
308+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
220309
with:
221310
entrypoint: /bin/rm
222311
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}

.github/workflows/release-management.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
key: ${{ matrix.os_bin }}-${{ github.sha }}
3636
restore-keys: ${{ matrix.os_bin }}
3737
- name: Build
38-
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230225-2136
38+
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230704-1323
3939
with:
4040
args: -b ${{ github.sha }} -f "${{matrix.flags}}"
4141
- name: Create Archive

Common/src/geometry/CPhysicalGeometry.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10565,31 +10565,44 @@ 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 ---*/
1057110580
/*--- distance to a solid wall element ---*/
1057210581
/*--------------------------------------------------------------------------*/
1057310582

10574-
SU2_OMP_PARALLEL
1057510583
if (!WallADT->IsEmpty()) {
1057610584
/*--- Solid wall boundary nodes are present. Compute the wall
1057710585
distance for all nodes. ---*/
1057810586

10579-
SU2_OMP_FOR_DYN(roundUpDiv(nPoint, 2 * omp_get_max_threads()))
10580-
for (unsigned long iPoint = 0; iPoint < GetnPoint(); ++iPoint) {
10581-
unsigned short markerID;
10582-
unsigned long elemID;
10583-
int rankID;
10584-
su2double dist;
10587+
SU2_OMP_PARALLEL {
10588+
CPHYSGEO_PARFOR
10589+
for (unsigned long iPoint = 0; iPoint < GetnPoint(); ++iPoint) {
10590+
unsigned short markerID;
10591+
unsigned long elemID;
10592+
int rankID;
10593+
su2double dist;
1058510594

10586-
WallADT->DetermineNearestElement(nodes->GetCoord(iPoint), dist, markerID, elemID, rankID);
10595+
WallADT->DetermineNearestElement(nodes->GetCoord(iPoint), dist, markerID, elemID, rankID);
1058710596

10588-
if (dist < nodes->GetWall_Distance(iPoint)) {
10589-
nodes->SetWall_Distance(iPoint, dist, rankID, iZone, markerID, elemID);
10597+
if (dist < nodes->GetWall_Distance(iPoint)) {
10598+
nodes->SetWall_Distance(iPoint, dist, rankID, iZone, markerID, elemID);
10599+
}
1059010600
}
10601+
END_CPHYSGEO_PARFOR
1059110602
}
10592-
END_SU2_OMP_FOR
10603+
END_SU2_OMP_PARALLEL
1059310604
}
10594-
END_SU2_OMP_PARALLEL
1059510605
}
10606+
10607+
#undef CPHYSGEO_PARFOR
10608+
#undef END_CPHYSGEO_PARFOR

0 commit comments

Comments
 (0)