Skip to content

Commit 46986a0

Browse files
committed
sanitizer issues now to resolve compiler compatablity for
1 parent 0f588ff commit 46986a0

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
-DCMAKE_BUILD_TYPE=Release \
8787
-DBUILD_TESTING=ON \
8888
-DBUILD_EXAMPLES=ON \
89-
-DCMAKE_CUDA_ARCHITECTURES=80 \
89+
-DCMAKE_CUDA_ARCHITECTURES=native \
9090
-DCMAKE_INSTALL_PREFIX=./build/ci/install
9191
9292
- name: Build
@@ -99,11 +99,6 @@ jobs:
9999
fi
100100
cmake --build build/ci --parallel
101101
102-
- name: Show linked CUDA runtime
103-
shell: bash
104-
run: |
105-
ldd build/ci/tests/test_cli | grep -E 'cudart|cuda' || true
106-
107102
- name: Run tests
108103
shell: bash
109104
working-directory: build/ci
@@ -144,7 +139,9 @@ jobs:
144139
module purge
145140
module load nvhpc/23.11/nvhpc-hpcx-cuda12
146141
fi
147-
cmake --preset asan
142+
# nvc++ does not support -fsanitize; use GCC for the sanitizer build.
143+
# nvcc (from the nvhpc module above) is still used for CUDA sources.
144+
CC=gcc CXX=g++ cmake --preset asan
148145
149146
- name: Build
150147
run: cmake --build --preset asan --parallel

‎CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,23 @@ set_property(CACHE USE_SANITIZER PROPERTY STRINGS "" "ASanUbsan" "TSan" "Compute
126126
option(COMPUTE_SANITIZER_DEVICE_DEBUG "Build CUDA with -G for Compute Sanitizer (slower, deeper debug)" OFF)
127127

128128
if (USE_SANITIZER STREQUAL "ASanUbsan")
129+
if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
130+
message(FATAL_ERROR
131+
"ASan/UBSan is not supported by nvc++ (NVHPC). "
132+
"Configure with CC=gcc CXX=g++ to use a GCC-based sanitizer build: "
133+
" CC=gcc CXX=g++ cmake --preset asan")
134+
endif()
129135
message(STATUS "Compiling with Address+Undefined Sanitizers")
130136
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
131137
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
132138
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
133139
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address,undefined")
134140
elseif (USE_SANITIZER STREQUAL "TSan")
141+
if(CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
142+
message(FATAL_ERROR
143+
"TSan is not supported by nvc++ (NVHPC). "
144+
"Configure with CC=gcc CXX=g++ to use a GCC-based sanitizer build.")
145+
endif()
135146
message(STATUS "Compiling with Thread Sanitizer")
136147
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer")
137148
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer")

0 commit comments

Comments
 (0)