Skip to content

Default to static linking of libcudart#2178

Merged
rapids-bot[bot] merged 5 commits intorapidsai:mainfrom
bdice:static-cudart-default
Dec 11, 2025
Merged

Default to static linking of libcudart#2178
rapids-bot[bot] merged 5 commits intorapidsai:mainfrom
bdice:static-cudart-default

Conversation

@bdice
Copy link
Collaborator

@bdice bdice commented Dec 9, 2025

Summary

  • Enable static linking of libcudart by default (CUDA_STATIC_RUNTIME=ON)
  • Remove cuda-cudart from conda recipe run requirements (no longer needed when statically linked)

This is part of a RAPIDS-wide effort to switch to static CUDA runtime linking. See rapidsai/build-planning#235 for tracking.

Changes

  • cpp/CMakeLists.txt: Change CUDA_STATIC_RUNTIME default from OFF to ON
  • build.sh: Change CUDA_STATIC_RUNTIME default from OFF to ON
  • conda/recipes/librmm/recipe.yaml: Remove cuda-cudart from run deps (3 outputs)
  • conda/recipes/rmm/recipe.yaml: Remove cuda-cudart from run deps

Note: Python builds already use CUDA_STATIC_RUNTIME=ON (set in python/librmm/CMakeLists.txt).

@bdice bdice requested review from a team as code owners December 9, 2025 16:32
@bdice bdice requested a review from gforsyth December 9, 2025 16:32
@bdice bdice requested a review from ttnghia December 9, 2025 16:32
@bdice bdice added breaking Breaking change improvement Improvement / enhancement to an existing function labels Dec 9, 2025
- Remove CUDA_STATIC_RUNTIME option from cpp/CMakeLists.txt
- Always link against CUDA::cudart_static
- Remove -s flag from build.sh
- Remove CUDA_STATIC_RUNTIME from python/librmm/CMakeLists.txt
- Remove cuda-cudart from run requirements in conda recipes
@bdice bdice force-pushed the static-cudart-default branch from 751ab73 to 69ae971 Compare December 9, 2025 18:25
@bdice bdice requested a review from robertmaynard December 9, 2025 18:44
Copy link
Contributor

@robertmaynard robertmaynard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cpp/tests/CMakeLists.txt need updating:

  if(_RMM_TEST_CUDART STREQUAL SHARED)
    set(cudart_link_libs $<COMPILE_ONLY:rmm> CUDA::cudart)
  elseif(_RMM_TEST_CUDART STREQUAL STATIC)
    set(cudart_link_libs $<COMPILE_ONLY:rmm> CUDA::cudart_static)
  else()

@bdice bdice requested a review from robertmaynard December 9, 2025 23:39
@bdice
Copy link
Collaborator Author

bdice commented Dec 10, 2025

Going to hold off on merging this until we have more clarity on rapidsai/cudf#20814 (comment).

@bdice bdice added the DO NOT MERGE Hold off on merging; see PR for details label Dec 11, 2025
@bdice
Copy link
Collaborator Author

bdice commented Dec 11, 2025

We must wait to merge this until cuDF stream testing has some path forward. Otherwise we would lose validation that any allocation calls happening in RMM are properly being handed streams from cuDF.

@bdice bdice removed the DO NOT MERGE Hold off on merging; see PR for details label Dec 11, 2025
@bdice
Copy link
Collaborator Author

bdice commented Dec 11, 2025

We think maybe the cudf stream testing can proceed with this, so I'll merge it.

@bdice
Copy link
Collaborator Author

bdice commented Dec 11, 2025

/merge

@rapids-bot rapids-bot bot merged commit b6c8f22 into rapidsai:main Dec 11, 2025
80 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in RMM Project Board Dec 11, 2025
vyasr added a commit that referenced this pull request Dec 12, 2025
rapids-bot bot pushed a commit that referenced this pull request Dec 12, 2025
Reverts #2178

These changes are currently breaking stream testing in cudf, see https://github.com/rapidsai/cudf/actions/runs/20147392038/job/57905334054?pr=20824#step:11:1782 for example. My guess is that while the changes in #2178 are fine for C++ consumers of rmm to continue hijacking CUDA symbols (like the libcudf tests do), there is a problem when rmm Python is also in the mix since now rmm Python will instantiate the rmm C++ templates and therefore embed cudart symbols due to the newly enforced static linkage. I'll reopen this PR once I can get #20814 resolved.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)

URL: #2182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change improvement Improvement / enhancement to an existing function

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants