Skip to content

Default to static linking of libcudart#1627

Open
bdice wants to merge 24 commits intorapidsai:mainfrom
bdice:static-cudart-default
Open

Default to static linking of libcudart#1627
bdice wants to merge 24 commits intorapidsai:mainfrom
bdice:static-cudart-default

Conversation

@bdice
Copy link
Contributor

@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
  • conda/recipes/cuvs/recipe.yaml: Remove cuda-cudart from run deps
  • conda/recipes/libcuvs/recipe.yaml: Remove cuda-cudart from run deps (4 outputs)

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

- Remove CUDA_STATIC_RUNTIME option from cpp/CMakeLists.txt
- Always use static CUDA runtime in rapids_cuda_init_runtime
- Update get_cutlass.cmake and get_faiss.cmake to always use static
- Remove CUDA_STATIC_RUNTIME from python/libcuvs/CMakeLists.txt
- Remove CUDA_STATIC_RUNTIME from docs
- Remove cuda-cudart from run requirements in conda recipes
@bdice bdice force-pushed the static-cudart-default branch from 93486fc to c94e7e6 Compare December 9, 2025 18:39
@bdice bdice requested a review from a team as a code owner December 9, 2025 18:39
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.

  • Missing changes to ci/build_go.sh and docs/source/build.rst to remove -lcudart
  • Missing changes to rust/cuvs-sys/build.rs to drop cargo:rustc-link-lib=dylib=cudart
  • examples/go/README.md Needs updating

@bdice bdice added breaking Introduces a breaking change improvement Improves an existing functionality labels Dec 10, 2025
@KyleFromNVIDIA KyleFromNVIDIA requested review from a team as code owners March 11, 2026 18:30
This reverts commit ed1c778.
@KyleFromNVIDIA
Copy link
Member

libcuvs.so is still getting CUDA::cudart rather than CUDA::cudart_static due to a leak from rmm::rmm. Relevant excerpt from lib/cmake/rmm/rmm-targets.cmake:

# Create imported target rmm::rmm
add_library(rmm::rmm SHARED IMPORTED)

set_target_properties(rmm::rmm PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "CUDA::cudart;CCCL::CCCL;dl;nvtx3::nvtx3-cpp;rapids_logger::rapids_logger"
  INTERFACE_POSITION_INDEPENDENT_CODE "ON"
)

GTest::gtest_main
$<IF:$<BOOL:${CUVSC_STATIC_CUVS_LIBRARY}>,$<COMPILE_ONLY:cuvs::cuvs_static>,cuvs::cuvs>
$<TARGET_NAME_IF_EXISTS:conda_env>
rmm::rmm
Copy link
Member

@KyleFromNVIDIA KyleFromNVIDIA Mar 13, 2026

Choose a reason for hiding this comment

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

It's not entirely clear to me why this is needed now. AFAICT, we've always been building with CUVSC_STATIC_CUVS_LIBRARY=ON, so the link error should have been triggered before this PR.

Copy link
Member

Choose a reason for hiding this comment

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

And now we're getting runtime link errors due to missing librmm.so: https://github.com/rapidsai/cuvs/actions/runs/23055523149/job/66970964103?pr=1627

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

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

Development

Successfully merging this pull request may close these issues.

4 participants