Skip to content
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
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ cmake_dependent_option(
DDalphaAMG_ENABLE_SCHWARZ_RES "Enable paramount output support" OFF
"TM_USE_DDalphaAMG" OFF)

cmake_dependent_option(DDalphaAMG_ENABLE_OMP "Enable OpenMP support" ${TM_USE_OMP}
"TM_USE_DDalphaAMG" OFF)
cmake_dependent_option(DDalphaAMG_ENABLE_OMP "Enable OpenMP support"
${TM_USE_OMP} "TM_USE_DDalphaAMG" OFF)

cmake_dependent_option(
DDalphaAMG_ENABLE_TESTVECTOR_ANALYSIS "Enable vector analysis support" OFF
Expand Down Expand Up @@ -244,7 +244,7 @@ if(TM_USE_LEMON)
FetchContent_Declare(
lemon
GIT_REPOSITORY https://github.com/etmc/lemon
GIT_TAG 42c2d99dae9c04ca1f09c532a8f9bcb1bb667528
GIT_TAG 1eba8143133ac4cbfb0738f6e4fc2d32bd9f008c
FIND_PACKAGE_ARGS NAMES lemon)
FetchContent_MakeAvailable(lemon)
endif()
Expand Down Expand Up @@ -348,6 +348,22 @@ if(TM_USE_HALFSPINOR AND NOT TM_USE_GAUGE_COPY)
"The TM_USE_GAUGE_COPY option should also be set to ON when TM_USE_HALFSPINOR is ON"
)
endif()

# Sanitized build

if(CMAKE_BUILD_TYPE STREQUAL "SANITIZE")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
message(STATUS "Building with AddressSanitizer")
# Apply AddressSanitizer flags for the SANITIZE build type

add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:-fsanitize=address
-fno-omit-frame-pointer -g>)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtaillefumier this does not seem to work correctly as it produces the following error:

cd /p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/tmLQCD/tmLQCD-master-current-quda-prefetch2-529a37-sanitize/src/lib && /p/software/default/stages/2026/software/GCCcore/14.3.0/bin/cc -DBUILD_QDP_INTERFACE -DHAVE_CONFIG_H -DMPI_COMMS -DMULTI_GPU -DQUDA_PRECISION=14 -DQUDA_RECONSTRUCT=7 -I/p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/tmLQCD/tmLQCD-master-current-quda-prefetch2-529a37-sanitize -I/p/home/jusers/kostrzewa2/juwels/code/tmLQCD/tmLQCD-master-current/src/lib/include -I/p/home/jusers/kostrzewa2/juwels/code/tmLQCD/tmLQCD-master-current/src/lib -I/p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/tmLQCD/tmLQCD-master-current-quda-prefetch2-529a37-sanitize/src/lib -I/p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/tmLQCD/tmLQCD-master-current-quda-prefetch2-529a37-sanitize/_deps/lemon-src/include -isystem /p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/quda-prefetch2-529a37/install_dir/include/targets/cuda -isystem /p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/quda-prefetch2-529a37/install_dir/include -isystem /p/software/default/stages/2026/software/CUDA/13/targets/x86_64-linux/include -isystem /p/software/default/stages/2026/software/CUDA/13/targets/x86_64-linux/include/cccl -isystem /p/software/fs/juwels_booster/stages/2026/software/OpenMPI/5.0.8-GCC-14.3.0/include -isystem /p/software/default/stages/2026/software/OpenMPI/5.0.8-GCC-14.3.0/include -isystem /p/home/jusers/kostrzewa2/juwels/build/juwelsbooster/stage_2026/gcc_14_3_openmpi_5_0_8_cuda_13/lime-924aa0/install_dir/include -std=gnu11 -fPIC -Wall "\$<1:-fsanitize=address" -fno-omit-frame-pointer "-g>" -fopenmp -MD -MT src/lib/CMakeFiles/tmlqcd.dir/measure_gauge_action.c.o -MF CMakeFiles/tmlqcd.dir/measure_gauge_action.c.o.d -o CMakeFiles/tmlqcd.dir/measure_gauge_action.c.o -c /p/home/jusers/kostrzewa2/juwels/code/tmLQCD/tmLQCD-master-current/src/lib/measure_gauge_action.c
cc: error: unrecognized debug output level ‘>’

it seems that "\$<1:-fsanitize=address" -fno-omit-frame-pointer "-g>" is passed as a flag to the C compiler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only workaround that I was able to find is to specify each option individually:

    add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:-fsanitize=address>)                                                          
    add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:-fno-omit-frame-pointer>)
    add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:-g>)

add_link_options(-fsanitize=address)
else()
message(WARNING "AddressSanitizer is not supported for this compiler")
endif()
endif()

# keep the autotool config.h header.
configure_file("${PROJECT_SOURCE_DIR}/cmake/tmlqcd_config_internal.h.in"
"${PROJECT_BINARY_DIR}/tmlqcd_config_internal.h" @ONLY)
Expand Down
5 changes: 2 additions & 3 deletions cmake/FindCLime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_library(
find_path(
TM_CLIME_INCLUDE_DIRS
NAMES lime.h
PATH_SUFFIXES "include" "include/${_pacakge_name}" "${_package_name}")
PATH_SUFFIXES "include" "include/${_package_name}" "${_package_name}")

find_package_handle_standard_args(CLime DEFAULT_MSG TM_CLIME_LIBRARIES
TM_CLIME_INCLUDE_DIRS)
Expand All @@ -22,5 +22,4 @@ if(NOT TARGET tmlqcd::clime)
endif()

set(TM_CLIME_FOUND ON)
mark_as_advanced(TM_CLIME_FOUND TM_CLIME_LIBRARIES
TM_CLIME_INCLUDE_DIRS)
mark_as_advanced(TM_CLIME_FOUND TM_CLIME_LIBRARIES TM_CLIME_INCLUDE_DIRS)
Loading