-
Notifications
You must be signed in to change notification settings - Fork 421
Update CMake to support newer GPU architectures #4572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Thank you for this! Yes #3948 is over-due and it looks like we also have some breakage with the latest CUDA 12.9 and CMake now with the old logic. I am OoO for the rest of the week, but we should try to get this in for the next release of AMReX and I will try to help next week. Bumping CMake to 3.24+ globally is fine now, please go ahead. Please check that we can use the build mode of building for the local "native" GPU when one is discovered, to simplify development. Otherwise, let us keep the AMREX_ARCH env hint (if set) that we use so far to set a default for CMAKE_CUDA_ARCHITECTURES. |
set(AMReX_CUDA_ARCH_DEFAULT "${CMAKE_CUDA_ARCHITECTURES}") | ||
endif () | ||
if(DEFINED ENV{AMREX_CUDA_ARCH}) | ||
set(AMReX_CUDA_ARCH_DEFAULT "$ENV{AMREX_CUDA_ARCH}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us keep that $ENV{AMREX_CUDA_ARCH}
hint to avoid breakage for users.
If found, we simply set the default for CMAKE_CUDA_ARCHITECTURES
to it.
# Take care of cuda archs | ||
set_cuda_architectures(AMReX_CUDA_ARCH) | ||
# default to building for the architecture of the available GPU | ||
set(AMREX_CUDA_ARCHS native) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
@samuelpmish There is a lot of legacy logic in Can you remove/clean those out if you have a chance? I can help next week, too. |
@cyrush can you potentially update the Catalyst image we use in AMReX/WarpX to include CMake 3.24 or newer? 🙏 |
@c-wetterer-nelson can you potentially update the SENSEI image we use in AMReX/WarpX to include CMake 3.24 or newer? 🙏 |
Hey Axel, are there still SENSEI users across AMReX/WarpX? |
@ax3l our current ascent containers (0.9.4) are using CMake 3.28. The internal layout changed a bit, but I can address that. Ascent 0.9.3 (also available) is using CMake 3.26.3. So a quick update to ascent 0.9.3 will get you beyond CMake 3.24, down the road I can help get 0.9.4 working your CI. |
That is a good question, I think in WarpX not anymore. @WeiqunZhang should we drop SENSEI throughout AMReX & BLAST codes? |
Update Ascent to the latest patch release of the 0.9.X line, primarily for a newer CMake in the image. X-ref: AMReX-Codes/amrex#4572 (comment)
I have to move this PR and testing it downstream into the 25.09 release cycle, due to other deadlines. There is a hotfix for CUDA 12.9 for now in #4589 |
I added a task list to the PR description on things we will need to carefully check with downstream codes to avoid breakage. |
## Summary The legacy CMake logic we have fails the moment that CUDA Toolkit advertises SMs >= 10.0. While we work on a modernization #4572, the current `development` breaks **all CUDA builds** in CUDA 12.9, even for older SMs. Exclude newer SMs for now from our build logic. ## Additional background Seen with ``` $ cmake --version cmake version 3.30.4 CMake suite maintained and supported by Kitware (kitware.com/cmake). $ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Tue_May_27_02:21:03_PDT_2025 Cuda compilation tools, release 12.9, V12.9.86 Build cuda_12.9.r12.9/compiler.36037853_0 ``` ## Checklist The proposed changes: - [x] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
## Summary Update Ascent to the latest patch release of the 0.9.X line, primarily for a newer CMake in the image. ## Additional background See #4572 (comment) Thanks @cyrush !!
Hey, sorry to disappear for a bit after posting this PR. I'm not sure I understand AMReX's build system enough to address some of the tasks on my own. Can someone help clarify the requirements for the listed tasks:
It seems like some of them are already satisfied (e.g. native compilation picking the local GPU). I believe the Other ones like the warning about sm_75 can be suppressed with a flag, but I'm not sure that's always a good thing (as it hides important info from users with those cards). |
Summary
I was trying out amr-wind earlier and found its CMake build was unable to configure for Blackwell architecture GPUs:
It seems that the underlying cause was not in amr-wind itself, but in AMReX's use of some deprecated CMake CUDA features.
This PR makes a small change to the CMake build system to avoid those deprecated features, so that AMReX can compile with Hopper and Blackwell architecture GPUs. The configuration behavior is as follows:
cmake . -DAMReX_GPU_BACKEND=CUDA
will default to the "native" option (which selects architecture based on the hardware present in the machine)
cmake . -DAMReX_GPU_BACKEND=CUDA -DCMAKE_CUDA_ARCHITECTURES=100
builds for the explicitly-specified architecture(s)
Tasks
AMREX_CUDA_ARCH
env hint still works and has the same precendenceCMAKE_CUDA_ARCHITECTURES
is selected to a narrow set) down to SASS code, otherwise we will in an MPI context compile every process on startup from PTX to SASS, potentially 10's of thousands of times.Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release
Checklist
The proposed changes: