Skip to content

Commit ab35848

Browse files
[REVIEW] Rewrite cuvs-sys build to discover pre-installed cuVS via cmake-package (#2022)
- Current build process works by manual CMake invocation, which is suboptimal. The cmake-package is an official Rust crate meant to be used in the build scripts for this purpose. The new scripts attempts the discovery in existing library path, via pip, or CMAKE_PREFIX_PATH - Added dlpack to rust conda environment for bindgen - Added pre-generated bindings (src/bindings.rs) plus an optional "generate-bindings" cargo feature for opt-in regeneration via bindgen. To support this build scenario, also added the generate-bindings.sh script for CI staleness verification. This would allow us to build cuvs on machines that have no CUDA or cmake, e.g. docs.rs - Moved cuvs-sys dependency to [workspace.dependencies] to deduplicate version - Updated Rust edition to 2024 - CI workflows no longer need `LIBCLANG_PATH` Authors: - Yan Zaretskiy (https://github.com/yan-zaretskiy) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Robert Maynard (https://github.com/robertmaynard) - Corey J. Nolet (https://github.com/cjnolet) URL: #2022
1 parent 93fb5dc commit ab35848

45 files changed

Lines changed: 3925 additions & 564 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-rust.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
cuda_version:
20-
- '12.9.1'
20+
- '13.1.1'
2121
container:
2222
image: "rapidsai/ci-conda:26.06-cuda${{ matrix.cuda_version }}-ubuntu24.04-py3.13"
2323
steps:
@@ -49,10 +49,6 @@ jobs:
4949
conda activate rust
5050
set -eu
5151
52-
LIBCLANG_PATH=$(dirname "$(find "$CONDA_PREFIX" -name libclang.so | head -n 1)")
53-
export LIBCLANG_PATH
54-
echo "LIBCLANG_PATH=$LIBCLANG_PATH"
55-
5652
# Publish sys crate first
5753
pushd ./rust/cuvs-sys
5854
cargo publish --token ${CARGO_REGISTRY_TOKEN}

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ repos:
113113
exclude: |
114114
(?x)
115115
^CHANGELOG[.]md$|
116-
^cpp/cmake/patches/cutlass/build-export[.]patch$
116+
^cpp/cmake/patches/cutlass/build-export[.]patch$|
117+
^rust/cuvs-sys/src/bindings[.]rs$
117118
- repo: https://github.com/rapidsai/pre-commit-hooks
118119
rev: v1.3.3
119120
hooks:
@@ -147,7 +148,8 @@ repos:
147148
cpp/src/distance/detail/fused_distance_nn/persistent_gemm[.]h$|
148149
cpp/src/distance/detail/fused_distance_nn/epilogue_elementwise[.]cuh$|
149150
cpp/src/distance/detail/fused_distance_nn/predicated_tile_iterator_reduced_vec[.]h$|
150-
cpp/src/distance/detail/fused_distance_nn/custom_epilogue_with_broadcast[.]h$
151+
cpp/src/distance/detail/fused_distance_nn/custom_epilogue_with_broadcast[.]h$|
152+
rust/cuvs-sys/src/bindings[.]rs$
151153
)
152154
- id: verify-copyright
153155
name: verify-copyright-scikit-learn

ci/build_rust.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -euo pipefail
@@ -38,16 +38,10 @@ export SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=true
3838

3939
rapids-print-env
4040

41-
rapids-logger "Begin rust build"
41+
rapids-logger "Begin Rust build"
4242

4343
sccache --stop-server 2>/dev/null || true
4444

45-
# we need to set up LIBCLANG_PATH to allow rust bindgen to work,
46-
# grab it from the conda env
47-
LIBCLANG_PATH=$(dirname "$(find "$CONDA_PREFIX" -name libclang.so | head -n 1)")
48-
export LIBCLANG_PATH
49-
echo "LIBCLANG_PATH=$LIBCLANG_PATH"
50-
5145
bash ./build.sh rust
5246

5347
sccache --show-adv-stats

ci/release/update-version.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
# SPDX-License-Identifier: Apache-2.0
44
########################
55
# CUVS Version Updater #
@@ -155,7 +155,6 @@ sed_runner "s|@v[0-9][0-9].[0-9][0-9].[0-9][0-9]|@v${NEXT_FULL_TAG}|g" examples/
155155
# rust can't handle leading 0's in the major/minor/patch version - remove
156156
NEXT_FULL_RUST_TAG=$(printf "%d.%d.%d" $((10#$NEXT_MAJOR)) $((10#$NEXT_MINOR)) $((10#$NEXT_PATCH)))
157157
sed_runner "s/version = \".*\"/version = \"${NEXT_FULL_RUST_TAG}\"/g" rust/Cargo.toml
158-
sed_runner "s/version = \".*\"/version = \"${NEXT_FULL_RUST_TAG}\"/g" rust/cuvs/Cargo.toml
159158

160159
# .devcontainer files
161160
find .devcontainer/ -type f -name devcontainer.json -print0 | while IFS= read -r -d '' filename; do

conda/environments/rust_cuda-129_arch-aarch64.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- c-compiler
9-
- clang-tools==20.1.8
10-
- clang==20.1.8
119
- cmake>=3.30.4
1210
- cuda-cudart-dev
1311
- cuda-nvcc
@@ -17,7 +15,6 @@ dependencies:
1715
- cuda-version=12.9
1816
- cxx-compiler
1917
- gcc_linux-aarch64=14.*
20-
- libclang==20.1.8
2118
- libcublas-dev
2219
- libcurand-dev
2320
- libcusolver-dev

conda/environments/rust_cuda-129_arch-x86_64.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- c-compiler
9-
- clang-tools==20.1.8
10-
- clang==20.1.8
119
- cmake>=3.30.4
1210
- cuda-cudart-dev
1311
- cuda-nvcc
@@ -17,7 +15,6 @@ dependencies:
1715
- cuda-version=12.9
1816
- cxx-compiler
1917
- gcc_linux-64=14.*
20-
- libclang==20.1.8
2118
- libcublas-dev
2219
- libcurand-dev
2320
- libcusolver-dev

conda/environments/rust_cuda-131_arch-aarch64.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- c-compiler
9-
- clang-tools==20.1.8
10-
- clang==20.1.8
119
- cmake>=3.30.4
1210
- cuda-cudart-dev
1311
- cuda-nvcc
@@ -17,7 +15,6 @@ dependencies:
1715
- cuda-version=13.1
1816
- cxx-compiler
1917
- gcc_linux-aarch64=14.*
20-
- libclang==20.1.8
2118
- libcublas-dev
2219
- libcurand-dev
2320
- libcusolver-dev

conda/environments/rust_cuda-131_arch-x86_64.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- c-compiler
9-
- clang-tools==20.1.8
10-
- clang==20.1.8
119
- cmake>=3.30.4
1210
- cuda-cudart-dev
1311
- cuda-nvcc
@@ -17,7 +15,6 @@ dependencies:
1715
- cuda-version=13.1
1816
- cxx-compiler
1917
- gcc_linux-64=14.*
20-
- libclang==20.1.8
2118
- libcublas-dev
2219
- libcurand-dev
2320
- libcusolver-dev

dependencies.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ files:
9090
cuda: ["12.9", "13.1"]
9191
arch: [x86_64, aarch64]
9292
includes:
93-
# clang/libclang only needed for bindgen support
94-
- clang
9593
- cuda
9694
- cuda_version
9795
- rapids_build

rust/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
2+
# SPDX-License-Identifier: Apache-2.0
3+
14
[workspace]
25
members = [
36
"cuvs",
@@ -7,9 +10,12 @@ resolver = "2"
710

811
[workspace.package]
912
version = "26.6.0"
10-
edition = "2021"
13+
edition = "2024"
1114
repository = "https://github.com/rapidsai/cuvs"
1215
homepage = "https://github.com/rapidsai/cuvs"
13-
description = "RAPIDS vector search library"
16+
description = "Vector Search and Clustering on the GPU"
1417
authors = ["NVIDIA Corporation"]
1518
license = "Apache-2.0"
19+
20+
[workspace.dependencies]
21+
cuvs-sys = { path = "cuvs-sys", version = "26.6.0" }

0 commit comments

Comments
 (0)