Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address sanitizer tests in the CI pipeline #2246

Merged
merged 27 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9c4e37a
Update container image tags.
jblueh Mar 21, 2024
c2a2c57
Add job for building SU2 with the address sanitizer.
jblueh Mar 21, 2024
5ff2348
Fix.
jblueh Mar 21, 2024
bc6362f
Remove slash.
jblueh Mar 21, 2024
3c32cd4
Address sanitizer builds without python wrapper and unit tests.
jblueh Mar 22, 2024
acd1a76
Add --asan flag, add with_asan parameter.
jblueh Mar 25, 2024
c16aab2
Add basic tsan/asan checks to further run_* routines.
jblueh Mar 25, 2024
c84780e
Enable address sanitizer execution of SU2_CFD serial regression tests.
jblueh Mar 25, 2024
8a79faa
Add job for address sanitizer tests.
jblueh Mar 25, 2024
3e42699
Avoid reallocation of surface_movement.
jblueh Mar 26, 2024
a65d31c
Enable address sanitizer execution of SU2_CFD_AD serial regression AD…
jblueh Mar 27, 2024
3477fba
Enable asan execution of SU2_GEO and SU2_DEF serial regression tests.
jblueh Mar 28, 2024
38b6658
Fixes in run_geo and run_def.
jblueh Apr 2, 2024
046de67
Merge branch 'develop' into feature_asan
jblueh Apr 2, 2024
4ce1448
Fix mismatched allocation/deallocation.
jblueh Apr 2, 2024
cf1fab8
Fix missing deallocation.
jblueh Apr 2, 2024
9651460
Fix memory leak of CFreeFormDefBox::BlendingFunction[2].
jblueh Apr 3, 2024
7ad81fb
Fix reallocation without freeing and memory leak at exit of CSurfaceM…
jblueh Apr 3, 2024
41256dc
Fix semicolon and variable hiding.
jblueh Apr 3, 2024
c97610b
Explore fix for heap buffer overflow in CInterface.
jblueh Apr 3, 2024
afad3ac
Fix comparison.
jblueh Apr 10, 2024
d9f5050
Merge branch 'develop' into feature_asan
jblueh Apr 15, 2024
b067ba1
Merge branch 'develop' into feature_asan
jblueh Apr 18, 2024
6e4fd20
Merge branch 'develop' into feature_asan
jblueh Apr 18, 2024
4127628
Merge branch 'develop' into feature_asan
jblueh May 6, 2024
aa2787b
Revert "Explore fix for heap buffer overflow in CInterface."
jblueh May 8, 2024
0f3fc3e
Disable address sanitizer runs of the Aachen turbine test.
jblueh May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 102 additions & 15 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
key: ${{ matrix.config_set }}-${{ github.sha }}
restore-keys: ${{ matrix.config_set }}
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Build
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
with:
args: -b ${{github.ref}} -f "${{matrix.flags}}"
- name: Compress binaries
Expand All @@ -68,7 +68,7 @@ jobs:
name: ${{ matrix.config_set }}
path: install_bin.tgz
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand Down Expand Up @@ -97,12 +97,12 @@ jobs:
key: ${{ matrix.config_set }}-${{ github.sha }}
restore-keys: ${{ matrix.config_set }}
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Build
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
with:
args: -b ${{github.ref}} -f "${{matrix.flags}}"
- name: Compress binaries
Expand All @@ -113,7 +113,47 @@ jobs:
name: ${{ matrix.config_set }}
path: install_bin.tgz
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
build_asan:
name: Build SU2 (asan)
strategy:
fail-fast: false
matrix:
config_set: [BaseNoMPI-asan, ReverseNoMPI-asan]
include:
- config_set: BaseNoMPI-asan
flags: '--buildtype=debugoptimized -Denable-openblas=true -Dwith-mpi=disabled -Denable-mlpcpp=true --warnlevel=3 --werror'
- config_set: ReverseNoMPI-asan
flags: '--buildtype=debugoptimized -Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled --warnlevel=3 --werror'
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Cache Object Files
uses: actions/cache@v4
with:
path: ccache
key: ${{ matrix.config_set }}-${{ github.sha }}
restore-keys: ${{ matrix.config_set }}
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-asan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Build
run: docker run --rm --cap-add SYS_PTRACE -v $(pwd):${{ github.workspace }} -w ${{ github.workspace }} ghcr.io/su2code/su2/build-su2-asan:240320-1536 -b ${{github.ref}} -f "${{matrix.flags}}"
- name: Compress binaries
run: tar -zcvf install_bin.tgz install/*
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config_set }}
path: install_bin.tgz
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-asan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand Down Expand Up @@ -144,7 +184,7 @@ jobs:
tag: OMP
steps:
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -170,12 +210,12 @@ jobs:
chmod a+x $BIN_FOLDER/*
ls -lahR $BIN_FOLDER
- name: Run Tests in Container
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -192,7 +232,7 @@ jobs:
- name: Reduce ASLR entropy for tsan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -218,12 +258,59 @@ jobs:
chmod a+x $BIN_FOLDER/*
ls -lahR $BIN_FOLDER
- name: Run Tests in Container
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tsan"
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
address_sanitizer_tests:
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
name: Address Sanitizer Tests
needs: build_asan
strategy:
fail-fast: false
matrix:
testscript: ['serial_regression.py', 'serial_regression_AD.py']
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Download All artifacts
uses: actions/download-artifact@v4
- name: Uncompress and Move Binaries
run: |
BIN_FOLDER="$PWD/install/bin"
mkdir -p $BIN_FOLDER
ls -lah $BIN_FOLDER
for type in Base Reverse Forward; do
TYPE_FOLDER="${type}NoMPI-asan"
echo "Processing '$TYPE_FOLDER' ..."
if [ -d $TYPE_FOLDER ]; then
pushd $TYPE_FOLDER
ls -lah
tar -zxvf install_bin.tgz
ls -lah install/bin/
cp -r install/* $BIN_FOLDER/../
popd;
fi
done
chmod a+x $BIN_FOLDER/*
ls -lahR $BIN_FOLDER
- name: Run Tests in Container
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--asan"
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -244,7 +331,7 @@ jobs:
tag: MPI
steps:
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand Down Expand Up @@ -305,11 +392,11 @@ jobs:
echo $PWD
ls -lahR
- name: Run Unit Tests
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
entrypoint: install/bin/${{matrix.testdriver}}
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
3 changes: 2 additions & 1 deletion Common/src/grid_movement/CFreeFormDefBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ CFreeFormDefBox::~CFreeFormDefBox() {
for (iCornerPoints = 0; iCornerPoints < nCornerPoints; iCornerPoints++) delete[] Coord_Corner_Points[iCornerPoints];
delete[] Coord_Corner_Points;

for (iDim = 0; iDim < nDim; iDim++) {
/*--- nDim is 3 at allocation but might change later, so we used fixed 3 as upper bound for deallocation ---*/
for (iDim = 0; iDim < 3; iDim++) {
delete BlendingFunction[iDim];
}
delete[] BlendingFunction;
Expand Down
33 changes: 30 additions & 3 deletions Common/src/grid_movement/CSurfaceMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ CSurfaceMovement::CSurfaceMovement() : CGridMovement() {
size = SU2_MPI::GetSize();
rank = SU2_MPI::GetRank();

FFDBox = nullptr;
nFFDBox = 0;
nLevel = 0;
FFDBoxDefinition = false;
}

CSurfaceMovement::~CSurfaceMovement() = default;
CSurfaceMovement::~CSurfaceMovement() {
if (FFDBox != nullptr) {
for (unsigned int iFFDBox = 0; iFFDBox < MAX_NUMBER_FFD; ++iFFDBox) {
if (FFDBox[iFFDBox] != nullptr) delete FFDBox[iFFDBox];
}
delete[] FFDBox;
FFDBox = nullptr;
}
}

vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* geometry, CConfig* config) {
unsigned short iFFDBox, iDV, iLevel, iChild, iParent, jFFDBox, iMarker;
Expand All @@ -60,7 +69,16 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
if (config->GetDesign_Variable(0) == FFD_SETTING) {
/*--- Definition of the FFD deformation class ---*/

FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD];
/*--- As this method might be called multiple times, properly delete old objects before allocating new ones. ---*/
if (FFDBox != nullptr) {
for (iFFDBox = 0; iFFDBox < MAX_NUMBER_FFD; ++iFFDBox) {
if (FFDBox[iFFDBox] != nullptr) delete FFDBox[iFFDBox];
}
delete[] FFDBox;
FFDBox = nullptr;
}

FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD]();

/*--- Read the FFD information from the config file ---*/

Expand Down Expand Up @@ -167,7 +185,16 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
(config->GetDesign_Variable(0) == FFD_THICKNESS) || (config->GetDesign_Variable(0) == FFD_ANGLE_OF_ATTACK)) {
/*--- Definition of the FFD deformation class ---*/

FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD];
/*--- As this method might be called multiple times, properly delete old objects before allocating new ones. ---*/
if (FFDBox != nullptr) {
for (iFFDBox = 0; iFFDBox < MAX_NUMBER_FFD; ++iFFDBox) {
if (FFDBox[iFFDBox] != nullptr) delete FFDBox[iFFDBox];
}
delete[] FFDBox;
FFDBox = nullptr;
}

FFDBox = new CFreeFormDefBox*[MAX_NUMBER_FFD]();

/*--- Read the FFD information from the grid file ---*/

Expand Down
4 changes: 3 additions & 1 deletion SU2_CFD/src/drivers/CDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2389,7 +2389,9 @@ void CDriver::PreprocessDynamicMesh(CConfig *config, CGeometry **geometry, CSolv
cout << "Setting dynamic mesh structure for zone "<< iZone + 1<<"." << endl;
grid_movement = new CVolumetricMovement(geometry[MESH_0], config);

surface_movement = new CSurfaceMovement();
if (surface_movement == nullptr)
surface_movement = new CSurfaceMovement();

surface_movement->CopyBoundary(geometry[MESH_0], config);
if (config->GetTime_Marching() == TIME_MARCHING::HARMONIC_BALANCE){
if (rank == MASTER_NODE) cout << endl << "Instance "<< iInst + 1 <<":" << endl;
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/interfaces/CInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void CInterface::PreprocessAverage(CGeometry *donor_geometry, CGeometry *target_
for(iSpan = 1; iSpan <nSpanTarget-1; iSpan++){
dist = 10E+06;
dist2 = 10E+06;
for(jSpan = 0; jSpan < nSpanDonor;jSpan++){
for(jSpan = 1; jSpan < nSpanDonor - 1;jSpan++){
test = abs(SpanValuesTarget[iSpan] - SpanValuesDonor[jSpan]);
test2 = abs(SpanValuesTarget[iSpan] - SpanValuesDonor[jSpan]);
if(test < dist && SpanValuesTarget[iSpan] > SpanValuesDonor[jSpan]){
Expand Down
5 changes: 3 additions & 2 deletions SU2_GEO/src/SU2_GEO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,14 +1429,15 @@ int main(int argc, char* argv[]) {
delete[] Xcoord_Airfoil;
delete[] Ycoord_Airfoil;
delete[] Zcoord_Airfoil;
delete[] Variable_Airfoil;

delete[] ObjectiveFunc;
delete[] ObjectiveFunc_New;
delete[] Gradient;

for (iPlane = 0; iPlane < nPlane; iPlane++) {
delete Plane_P0[iPlane];
delete Plane_Normal[iPlane];
delete[] Plane_P0[iPlane];
delete[] Plane_Normal[iPlane];
}
delete[] Plane_P0;
delete[] Plane_Normal;
Expand Down
Loading