Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cmake : fix CMake requirement for CUDA #7821

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Conversation

cebtenzzre
Copy link
Collaborator

CMAKE_CUDA_ARCHITECTURES wasn't added until CMake 3.18.

Setting the minimum version of CMake to 3.18 also sets CMP0104 to NEW, which causes CMAKE_CUDA_ARCHITECTURES to be automatically set by CMakeDetermineCUDACompiler. So for the NOT DEFINED check to work, we must set the default before enable_language(CUDA).

@cebtenzzre cebtenzzre requested a review from slaren June 7, 2024 19:31
@github-actions github-actions bot added the build Compilation issues label Jun 7, 2024
@slaren
Copy link
Collaborator

slaren commented Jun 7, 2024

I tried bumping the cmake_minimum_required to 3.18 (without other changes) and the value of CMAKE_CUDA_ARCHITECTURES is still respected.

@cebtenzzre
Copy link
Collaborator Author

the value of CMAKE_CUDA_ARCHITECTURES is still respected.

The default is not. If you change cmake_minimum_required(VERSION 3.17) in the CUDA branch to VERSION 3.18 (this line takes priority), grep -m1 nvcc build/compile_commands.json shows only compute_52,sm_52 on my system instead of compute_52,sm_52, compute_61,sm_61, and compute_70,sm_70 which is what should be there.

@cebtenzzre cebtenzzre merged commit 864a99e into master Jun 10, 2024
55 of 68 checks passed
@cebtenzzre cebtenzzre deleted the fix-min-cmake-cuda branch June 10, 2024 22:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
build Compilation issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants