Skip to content

Conversation

@romerojosh
Copy link
Collaborator

@romerojosh romerojosh commented Nov 3, 2025

A user reported compilation issues for cuDecomp using the most recent NVHPC release (25.9) against CUDA 13.0. The root cause of their issue was a combination of an older GCC (earlier than GCC-10) and older CMake version (earlier than 3.18).

#72 bumped the required C++ standard to 17 to address deprecation warnings from libcu++ about C++14, which became a true compilation error in the libcu++ version packaged with CUDA 13. It turns out that CMake versions older than 3.18 do not propagate the C++17 flags (via CMAKE_CXX_STANDARD=17) to .cu file compilation, likely because CMAKE_CUDA_STANDARD does not support C++17 until CMake 3.18 (ref). This doesn't matter if the GCC compiler is 10 or newer, as C++17 is the default standard applied and works in lieu of CMake providing the C++17 flags to nvcc, but breaks when the GCC is older and the default standard is pre-C++17.

To address this, I am manually adding -std=c++17 to CMAKE_CUDA_FLAGS for CMake versions prior to 3.18. While I could make the CMake minimum version 3.18, this would break builds on Ubuntu 20.04 which defaults to CMake 3.16.

@romerojosh romerojosh force-pushed the update_cmake_minimum branch from a2473cc to d140fb3 Compare November 3, 2025 22:56
@romerojosh
Copy link
Collaborator Author

/build

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

🚀 Build workflow triggered! View run

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

❌ Build workflow failed! View run

@romerojosh romerojosh force-pushed the update_cmake_minimum branch from d140fb3 to 6949cab Compare November 4, 2025 04:47
… source compilation.

Signed-off-by: Josh Romero <joshr@nvidia.com>
…logic to handle C++ std for .cu files.

Signed-off-by: Josh Romero <joshr@nvidia.com>
@romerojosh romerojosh force-pushed the update_cmake_minimum branch from 6949cab to 5e2cf7a Compare November 4, 2025 04:49
@romerojosh
Copy link
Collaborator Author

/build

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🚀 Build workflow triggered! View run

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

✅ Build workflow passed! View run

@romerojosh romerojosh changed the title Bump CMake miniumum version to 3.18 to enforce C++17 standard on CUDA source compilation. Correctly propagate C++17 standard flags to NVCC compilation with older CMake versions. Nov 4, 2025
@romerojosh romerojosh merged commit 907b18e into main Nov 4, 2025
4 checks passed
@romerojosh romerojosh deleted the update_cmake_minimum branch December 2, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants