From c0344d5e07a19dcce207ddf29be2a06898c99598 Mon Sep 17 00:00:00 2001 From: Ben Wibking Date: Thu, 1 Feb 2024 03:53:08 -0500 Subject: [PATCH] add HWASAN CI run (#510) ### Description This adds a CI run on Oracle Cloud Infrastructure (with Ampere aarch64 processors) with HWASAN enabled. Processor info: ``` Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM Model name: Neoverse-N1 Model: 1 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Stepping: r3p1 BogoMIPS: 50.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs ``` ### Related issues Closes https://github.com/quokka-astro/quokka/issues/509. ### Checklist _Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an `x` inside the square brackets `[ ]` in the Markdown source below:_ - [x] I have added a description (see above). - [x] I have added a link to any related issues see (see above). - [x] I have read the [Contributing Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md). - [x] I have added tests for any new physics that this PR adds to the code. - [x] I have tested this PR on my local computer and all tests pass. - [x] I have manually triggered the GPU tests with the magic comment `/azp run`. - [ ] I have requested a reviewer for this PR. --------- Co-authored-by: Piyush Sharda <34922596+psharda@users.noreply.github.com> --- .ci/azure-pipelines-aarch64-hwasan.yml | 41 ++++++++++++++++++++++++++ .ci/azure-pipelines-asan.yml | 40 ------------------------- .ci/azure-pipelines-build-llvm.yml | 35 ---------------------- .ci/azure-pipelines-debug.yml | 40 ------------------------- CMakeLists.txt | 1 + src/CMakeLists.txt | 7 +++++ 6 files changed, 49 insertions(+), 115 deletions(-) create mode 100644 .ci/azure-pipelines-aarch64-hwasan.yml delete mode 100644 .ci/azure-pipelines-asan.yml delete mode 100644 .ci/azure-pipelines-build-llvm.yml delete mode 100644 .ci/azure-pipelines-debug.yml diff --git a/.ci/azure-pipelines-aarch64-hwasan.yml b/.ci/azure-pipelines-aarch64-hwasan.yml new file mode 100644 index 000000000..9dfbe7186 --- /dev/null +++ b/.ci/azure-pipelines-aarch64-hwasan.yml @@ -0,0 +1,41 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- development + +pr: + autoCancel: true + branches: + include: + - development + +jobs: +- job: BuildAndTest + timeoutInMinutes: 180 # how long to run the job before automatically cancelling + pool: oracle-cloud + steps: + - task: CMake@1 + displayName: 'Configure CMake' + inputs: + cmakeArgs: '.. -DCMAKE_BUILD_TYPE=Release -DENABLE_HWASAN=ON -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DAMReX_SPACEDIM=1' + + - task: CMake@1 + displayName: 'Build Quokka' + inputs: + cmakeArgs: '--build .' + + - task: CMake@1 + displayName: 'Run CTest' + inputs: + cmakeArgs: '-E chdir . ctest -j 2 -T Test --output-on-failure' + + - task: PublishTestResults@2 + inputs: + testResultsFormat: cTest + testResultsFiles: build/Testing/*/Test.xml + testRunTitle: $(Agent.JobName) + condition: succeededOrFailed() + displayName: Publish test results diff --git a/.ci/azure-pipelines-asan.yml b/.ci/azure-pipelines-asan.yml deleted file mode 100644 index e5b97c68c..000000000 --- a/.ci/azure-pipelines-asan.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: -- development - -pr: - autoCancel: true - branches: - include: - - development - -pool: avatar - -steps: - -- task: CMake@1 - displayName: 'Configure CMake' - inputs: - cmakeArgs: '.. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DAMReX_SPACEDIM=1 -DAMReX_GPU_BACKEND=CUDA -DQUOKKA_PYTHON=OFF -DENABLE_ASAN=ON -G Ninja' - -- task: CMake@1 - displayName: 'Build Quokka' - inputs: - cmakeArgs: '--build .' - -- task: CMake@1 - displayName: 'Run CTest' - inputs: - cmakeArgs: '-E chdir . ctest -E "MatterEnergyExchange*" -T Test --output-on-failure' - -- task: PublishTestResults@2 - inputs: - testResultsFormat: cTest - testResultsFiles: build/Testing/*/Test.xml - testRunTitle: $(Agent.JobName) - condition: succeededOrFailed() - displayName: Publish test results diff --git a/.ci/azure-pipelines-build-llvm.yml b/.ci/azure-pipelines-build-llvm.yml deleted file mode 100644 index bf45ccf99..000000000 --- a/.ci/azure-pipelines-build-llvm.yml +++ /dev/null @@ -1,35 +0,0 @@ -trigger: -- development - -pr: - autoCancel: true - branches: - include: - - development - -pool: avatar - -steps: - -- task: CMake@1 - displayName: 'Configure CMake' - inputs: - cmakeArgs: '.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CUDA_COMPILER=clang -DAMReX_SPACEDIM=3 -DAMReX_GPU_BACKEND=CUDA -DCMAKE_CUDA_ARCHITECTURES=70 -DQUOKKA_PYTHON=OFF -G Ninja' - -- task: CMake@1 - displayName: 'Build Quokka' - inputs: - cmakeArgs: '--build .' - -- task: CMake@1 - displayName: 'Run CTest' - inputs: - cmakeArgs: '-E chdir . ctest -E "MatterEnergyExchange*" -T Test --output-on-failure' - -- task: PublishTestResults@2 - inputs: - testResultsFormat: cTest - testResultsFiles: build/Testing/*/Test.xml - testRunTitle: $(Agent.JobName) - condition: succeededOrFailed() - displayName: Publish test results \ No newline at end of file diff --git a/.ci/azure-pipelines-debug.yml b/.ci/azure-pipelines-debug.yml deleted file mode 100644 index 1ef6b68b6..000000000 --- a/.ci/azure-pipelines-debug.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: -- development - -pr: - autoCancel: true - branches: - include: - - development - -pool: avatar - -steps: - -- task: CMake@1 - displayName: 'Configure CMake' - inputs: - cmakeArgs: '.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DAMReX_SPACEDIM=1 -DAMReX_GPU_BACKEND=CUDA -DQUOKKA_PYTHON=OFF -G Ninja' - -- task: CMake@1 - displayName: 'Build Quokka' - inputs: - cmakeArgs: '--build .' - -- task: CMake@1 - displayName: 'Run CTest' - inputs: - cmakeArgs: '-E chdir . ctest -E "MatterEnergyExchange*" -T Test --output-on-failure' - -- task: PublishTestResults@2 - inputs: - testResultsFormat: cTest - testResultsFiles: build/Testing/*/Test.xml - testRunTitle: $(Agent.JobName) - condition: succeededOrFailed() - displayName: Publish test results \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bbb5cebc..d0b58a3cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ set(AMReX_TINY_PROFILE ON CACHE BOOL "" FORCE) option(QUOKKA_PYTHON "Compile with Python support (on/off)" ON) option(DISABLE_FMAD "Disable fused multiply-add instructions on GPU (on/off)" ON) option(ENABLE_ASAN "Enable AddressSanitizer and UndefinedBehaviorSanitizer" OFF) +option(ENABLE_HWASAN "Enable HWAddressSanitizer" OFF) option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF) option(QUOKKA_OPENPMD "Enable OpenPMD output (on/off)" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d007bdd8..e38854230 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,6 +60,13 @@ if(ENABLE_ASAN) add_link_options(-fsanitize=address -fsanitize=undefined) endif(ENABLE_ASAN) +if(ENABLE_HWASAN) + # enable HWAddressSanitizer for debugging + message(STATUS "Compiling with HWAddressSanitizer *enabled*") + add_compile_options(-fsanitize=hwaddress) + add_link_options(-fsanitize=hwaddress) +endif(ENABLE_HWASAN) + if(DISABLE_FMAD) message(STATUS "Fused multiply-add (FMAD) is disabled for device code.") add_compile_options($<$:-ffp-contract=off>)