Skip to content

Commit

Permalink
Merge pull request #2246 from su2code/feature_asan
Browse files Browse the repository at this point in the history
Address sanitizer tests in the CI pipeline
  • Loading branch information
jblueh authored May 8, 2024
2 parents 06649f7 + 0f3fc3e commit a1ff242
Show file tree
Hide file tree
Showing 9 changed files with 341 additions and 176 deletions.
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
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

0 comments on commit a1ff242

Please sign in to comment.