From e76d3b81e28f51fc2eb50feba6882d263a9d8288 Mon Sep 17 00:00:00 2001 From: Tuan Nghia Nguyen Date: Sun, 13 Sep 2026 07:58:49 +1000 Subject: [PATCH] fix(cuda): spell the fast-math flag the way nvcc spells it Every .cu file failed on CUDA 13 with "nvcc fatal: Unknown option '--use-fast-math'". The flag is --use_fast_math, with underscores; older toolkits accepted the hyphenated form as well and this one does not, so the engine layer could not compile a single kernel on a current CUDA. Found on the Windows machine with CUDA 13.0, where it stopped the build at the first two kernels. Co-Authored-By: Claude Opus 5 --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e1092..58ea49a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,14 @@ if(CMAKE_CUDA_COMPILER) set(CMAKE_CUDA_ARCHITECTURES 75-real 80-real 86-real 87-real 88-real 89-real 90-real 100-real 120-real 75-virtual) + # --use_fast_math, with underscores: that is nvcc's own spelling. Older + # toolkits also accepted the hyphenated form; CUDA 13 does not, and every + # .cu file fails with "Unknown option '--use-fast-math'" before it compiles + # a line. if(MSVC) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use-fast-math -Xcompiler=/utf-8") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use_fast_math -Xcompiler=/utf-8") else() - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use-fast-math") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use_fast_math") endif() else() project(ANSCORE LANGUAGES C CXX)