Skip to content

Commit

Permalink
Merge pull request #1106 from parthenon-hpc-lab/BenWibking/add-asan-o…
Browse files Browse the repository at this point in the history
…ptions

Add CMake options for turning on ASAN and HWASAN
  • Loading branch information
BenWibking authored Jun 13, 2024
2 parents ff02625 + 862a0ac commit 6268f2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Current develop

### Added (new features/APIs/variables/...)
- [[PR 1106]](https://github.com/parthenon-hpc-lab/parthenon/pull/1106) Add CMake options for turning on ASAN and HWASAN
- [[PR 1100]](https://github.com/parthenon-hpc-lab/parthenon/pull/1100) Custom refinement ops propagated to fluxes
- [[PR 1090]](https://github.com/parthenon-hpc-lab/parthenon/pull/1090) SMR with swarms
- [[PR 1079]](https://github.com/parthenon-hpc-lab/parthenon/pull/1079) Address XDMF/Visit Issues
Expand Down
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ option(CHECK_REGISTRY_PRESSURE "Check the registry pressure for Kokkos CUDA kern
option(TEST_INTEL_OPTIMIZATION "Test intel optimization and vectorization" OFF)
option(TEST_ERROR_CHECKING "Enables the error checking unit test. This test will FAIL" OFF)
option(CODE_COVERAGE "Enable code coverage reporting" OFF)
option(ENABLE_ASAN "Turn on ASAN" OFF)
option(ENABLE_HWASAN "Turn on HWASAN (currently ARM-only)" OFF)

include(cmake/Format.cmake)
include(cmake/Lint.cmake)
Expand Down Expand Up @@ -290,7 +292,19 @@ if (Kokkos_ENABLE_CUDA AND "${PARTHENON_ENABLE_GPU_MPI_CHECKS}" )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake @ONLY)
endif()


# option to turn on AddressSanitizer for debugging
if(ENABLE_ASAN)
message(STATUS "Compiling with AddressSanitizer and UndefinedBehaviorSanitizer *enabled*")
add_compile_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment)
add_link_options(-fsanitize=address -fsanitize=undefined)
endif(ENABLE_ASAN)

# option to turn on HWAddressSanitizer for debugging
if(ENABLE_HWASAN)
message(STATUS "Compiling with HWAddressSanitizer *enabled*")
add_compile_options(-fsanitize=hwaddress)
add_link_options(-fsanitize=hwaddress)
endif(ENABLE_HWASAN)


# Build Tests and download Catch2
Expand Down

0 comments on commit 6268f2c

Please sign in to comment.