Skip to content

Commit bcd47d1

Browse files
committed
CMake 3.30: Ignore SM 10.0+
The legacy CMake logic we have fails the moment that CUDA Toolkit advertises SMs >= 10.0. While we work on a modernization, this breaks all CUDA builds, even for older SMs. Exclude newer SMs for now from our build logic.
1 parent 0cb157d commit bcd47d1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Tools/CMake/AMReXUtils.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,22 @@ endfunction ()
222222
function (convert_cuda_archs _cuda_archs)
223223

224224
foreach (_item IN LISTS ${_cuda_archs})
225+
# remove -real suffixes
226+
string(REGEX REPLACE "\\-real$" "" _item "${_item}")
227+
225228
string(REGEX MATCH "\\." _has_decimal "${_item}")
226229
string(REGEX MATCH "[0-9]+" _is_number "${_item}")
227230

228231
if (NOT _has_decimal AND _is_number)
229232
math(EXPR _int "${_item}/10" OUTPUT_FORMAT DECIMAL)
230233
math(EXPR _mod "${_item}%10" OUTPUT_FORMAT DECIMAL)
231-
list(APPEND _tmp "${_int}.${_mod}")
234+
if(_int LESS 10) # CMake 3.30 does not support SM 10.0+ in cuda_select_nvcc_arch_flags
235+
list(APPEND _tmp "${_int}.${_mod}")
236+
endif()
232237
else ()
233-
list(APPEND _tmp ${_item})
238+
if(_item LESS 10) # CMake 3.30 does not support SM 10.0+ in cuda_select_nvcc_arch_flags
239+
list(APPEND _tmp ${_item})
240+
endif()
234241
endif()
235242
endforeach ()
236243

0 commit comments

Comments
 (0)