From 4e09f3b64a8ed9b5fa3d0a2bab10baad332620db Mon Sep 17 00:00:00 2001 From: TJU_Lu Date: Sat, 21 Jun 2025 14:52:53 +0800 Subject: [PATCH] Add abort when CUDA Arch auto-detection failed --- Simulator/src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Simulator/src/CMakeLists.txt b/Simulator/src/CMakeLists.txt index 83ed847..64fd324 100644 --- a/Simulator/src/CMakeLists.txt +++ b/Simulator/src/CMakeLists.txt @@ -23,6 +23,13 @@ message(WARNING "OpenCV_VERSION: ${OpenCV_VERSION}") find_package(CUDA REQUIRED) # Query the GPU architecture cuda_select_nvcc_arch_flags(ARCH_FLAGS) +if("${ARCH_FLAGS}" STREQUAL "") + message(FATAL_ERROR + "Failed to automatically detect CUDA architecture. " + "Please manually set ARCH_FLAGS in CMakeList.txt (line 25) based on your device, for example:\n" + " set(ARCH_FLAGS \"-gencode arch=compute_86,code=sm_86\")" + ) +endif() message(WARNING "CUDA Architecture: ${ARCH_FLAGS}") set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${ARCH_FLAGS}")