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

Remove "none" option in ENABLE_SANITIZER #5266

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CMake/DetermineDeviceArchitectures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ set(QMC_GPU_ARCHS
${QMC_GPU_ARCHS}
CACHE STRING "Accelerator device architectures" FORCE)

if(QMC_GPU_ARCHS)
message(STATUS "GPU device architectures: ${QMC_GPU_ARCHS}")
endif()

# QMC_GPU_ARCHS is the single source of truth and thus overwrite CMAKE_CUDA/HIP_ARCHITECTURES
if(ENABLE_CUDA)
if(QMC_CUDA2HIP)
Expand Down
21 changes: 10 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ if(ENABLE_CUDA AND NOT QMC_CUDA2HIP)
endif()

include(DetermineDeviceArchitectures)
message(STATUS "GPU device architectures: ${QMC_GPU_ARCHS}")

#--------------------------------------------------------------------
# Set compiler-time parameters
Expand Down Expand Up @@ -195,17 +194,17 @@ mark_as_advanced(QMC_EXP_THREADING)
#--------------------------------------------------------------------

# Add optional sanitizers ASAN, UBSAN, MSAN
set(VALID_SANITIZERS "none" "asan" "ubsan" "tsan" "msan")
set(ENABLE_SANITIZER
"none"
CACHE STRING "none,asan,ubsan,tsan,msan")
set(VALID_SANITIZERS "asan" "ubsan" "tsan" "msan")
set(ENABLE_SANITIZER "" CACHE STRING "asan,ubsan,tsan,msan")
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${VALID_SANITIZERS})

# Perform sanitizer option check, only works in debug mode
if(NOT ENABLE_SANITIZER IN_LIST VALID_SANITIZERS)
message(FATAL_ERROR "Invalid -DENABLE_SANITIZER=${ENABLE_SANITIZER}, value must be one of ${VALID_SANITIZERS}")
else()
message(STATUS "Enable sanitizer ENABLE_SANITIZER=${ENABLE_SANITIZER}")
if(ENABLE_SANITIZER)
# Perform sanitizer option check, only works in debug mode
if(NOT ENABLE_SANITIZER IN_LIST VALID_SANITIZERS)
message(FATAL_ERROR "Invalid -DENABLE_SANITIZER=${ENABLE_SANITIZER}, value must be one of ${VALID_SANITIZERS}")
else()
message(STATUS "Enable sanitizer ENABLE_SANITIZER=${ENABLE_SANITIZER}")
endif()
endif()

#--------------------------------------------------------------------
Expand Down Expand Up @@ -318,7 +317,7 @@ include(TestCxx17Library)
#-----------------------------------------------------------------------
# SETUP SANITIZERS FLAGS
#-----------------------------------------------------------------------
if(NOT "${ENABLE_SANITIZER}" STREQUAL "none")
if(ENABLE_SANITIZER)
if(NOT ${COMPILER} MATCHES "GNU" AND NOT ${COMPILER} MATCHES "Clang")
message(FATAL_ERROR "-DENABLE_SANITIZER=${ENABLE_SANITIZER} only works with GNU or Clang compilers")
endif()
Expand Down
Loading