Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/publish-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
cuda_version:
- '12.9.1'
- '13.1.1'
container:
image: "rapidsai/ci-conda:26.06-cuda${{ matrix.cuda_version }}-ubuntu24.04-py3.13"
steps:
Expand Down Expand Up @@ -44,10 +44,6 @@ jobs:
conda activate rust
set -eu

LIBCLANG_PATH=$(dirname "$(find "$CONDA_PREFIX" -name libclang.so | head -n 1)")
export LIBCLANG_PATH
echo "LIBCLANG_PATH=$LIBCLANG_PATH"

# Publish sys crate first
pushd ./rust/cuvs-sys
cargo publish --token ${CARGO_REGISTRY_TOKEN}
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ repos:
exclude: |
(?x)
^CHANGELOG[.]md$|
^cpp/cmake/patches/cutlass/build-export[.]patch$
^cpp/cmake/patches/cutlass/build-export[.]patch$|
^rust/cuvs-sys/src/bindings[.]rs$
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v1.3.3
hooks:
Expand Down Expand Up @@ -147,7 +148,8 @@ repos:
cpp/src/distance/detail/fused_distance_nn/persistent_gemm[.]h$|
cpp/src/distance/detail/fused_distance_nn/epilogue_elementwise[.]cuh$|
cpp/src/distance/detail/fused_distance_nn/predicated_tile_iterator_reduced_vec[.]h$|
cpp/src/distance/detail/fused_distance_nn/custom_epilogue_with_broadcast[.]h$
cpp/src/distance/detail/fused_distance_nn/custom_epilogue_with_broadcast[.]h$|
rust/cuvs-sys/src/bindings[.]rs$
)
- id: verify-copyright
name: verify-copyright-scikit-learn
Expand Down
10 changes: 2 additions & 8 deletions ci/build_rust.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail
Expand Down Expand Up @@ -38,16 +38,10 @@ export SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=true

rapids-print-env

rapids-logger "Begin rust build"
rapids-logger "Begin Rust build"

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

# we need to set up LIBCLANG_PATH to allow rust bindgen to work,
# grab it from the conda env
LIBCLANG_PATH=$(dirname "$(find "$CONDA_PREFIX" -name libclang.so | head -n 1)")
export LIBCLANG_PATH
echo "LIBCLANG_PATH=$LIBCLANG_PATH"

bash ./build.sh rust

sccache --show-adv-stats
Expand Down
3 changes: 1 addition & 2 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
########################
# CUVS Version Updater #
Expand Down Expand Up @@ -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/
# rust can't handle leading 0's in the major/minor/patch version - remove
NEXT_FULL_RUST_TAG=$(printf "%d.%d.%d" $((10#$NEXT_MAJOR)) $((10#$NEXT_MINOR)) $((10#$NEXT_PATCH)))
sed_runner "s/version = \".*\"/version = \"${NEXT_FULL_RUST_TAG}\"/g" rust/Cargo.toml
sed_runner "s/version = \".*\"/version = \"${NEXT_FULL_RUST_TAG}\"/g" rust/cuvs/Cargo.toml

# .devcontainer files
find .devcontainer/ -type f -name devcontainer.json -print0 | while IFS= read -r -d '' filename; do
Expand Down
58 changes: 58 additions & 0 deletions cmake/find_cuvs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# =============================================================================
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on
# =============================================================================

# This file is copied to a temporary CMakeLists.txt by build.rs. It intentionally performs only the
# versioned cuVS package discovery step; Rust uses the selected cuvs_DIR with cmake-package for
# target introspection.

cmake_minimum_required(VERSION 3.30.4 FATAL_ERROR)
project(cuvs_package_probe LANGUAGES C CXX)

if(NOT DEFINED OUTPUT_FILE)
message(FATAL_ERROR "OUTPUT_FILE is not set")
endif()

if(NOT DEFINED REQUIRED_VERSION)
message(FATAL_ERROR "REQUIRED_VERSION is not set")
endif()

if(NOT DEFINED CUVS_COMPONENT)
set(CUVS_COMPONENT c_api)
endif()

function(json_set_string json_var key value)
string(JSON _json SET "${${json_var}}" "${key}" "\"${value}\"")
set(${json_var}
"${_json}"
PARENT_SCOPE
)
endfunction()

set(_find_args cuvs ${REQUIRED_VERSION} CONFIG QUIET COMPONENTS ${CUVS_COMPONENT})
if(DEFINED CUVS_CMAKE_DIR)
list(APPEND _find_args PATHS "${CUVS_CMAKE_DIR}" NO_DEFAULT_PATH)
endif()
find_package(${_find_args})

set(_considered "[]")
set(_index 0)
foreach(_config _version IN ZIP_LISTS cuvs_CONSIDERED_CONFIGS cuvs_CONSIDERED_VERSIONS)
set(_candidate "{}")
json_set_string(_candidate "config" "${_config}")
json_set_string(_candidate "version" "${_version}")
string(JSON _considered SET "${_considered}" ${_index} "${_candidate}")
math(EXPR _index "${_index} + 1")
endforeach()

set(_json "{}")
string(JSON _json SET "${_json}" "considered" "${_considered}")

if(cuvs_FOUND)
json_set_string(_json "cmake_dir" "${cuvs_DIR}")
endif()

file(WRITE "${OUTPUT_FILE}" "${_json}\n")
3 changes: 0 additions & 3 deletions conda/environments/rust_cuda-129_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ channels:
- conda-forge
dependencies:
- c-compiler
- clang-tools==20.1.8
- clang==20.1.8
- cmake>=3.30.4
- cuda-cudart-dev
- cuda-nvcc
Expand All @@ -17,7 +15,6 @@ dependencies:
- cuda-version=12.9
- cxx-compiler
- gcc_linux-aarch64=14.*
- libclang==20.1.8
- libcublas-dev
- libcurand-dev
- libcusolver-dev
Expand Down
3 changes: 0 additions & 3 deletions conda/environments/rust_cuda-129_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ channels:
- conda-forge
dependencies:
- c-compiler
- clang-tools==20.1.8
- clang==20.1.8
- cmake>=3.30.4
- cuda-cudart-dev
- cuda-nvcc
Expand All @@ -17,7 +15,6 @@ dependencies:
- cuda-version=12.9
- cxx-compiler
- gcc_linux-64=14.*
- libclang==20.1.8
- libcublas-dev
- libcurand-dev
- libcusolver-dev
Expand Down
3 changes: 0 additions & 3 deletions conda/environments/rust_cuda-131_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ channels:
- conda-forge
dependencies:
- c-compiler
- clang-tools==20.1.8
- clang==20.1.8
- cmake>=3.30.4
- cuda-cudart-dev
- cuda-nvcc
Expand All @@ -17,7 +15,6 @@ dependencies:
- cuda-version=13.1
- cxx-compiler
- gcc_linux-aarch64=14.*
- libclang==20.1.8
- libcublas-dev
- libcurand-dev
- libcusolver-dev
Expand Down
3 changes: 0 additions & 3 deletions conda/environments/rust_cuda-131_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ channels:
- conda-forge
dependencies:
- c-compiler
- clang-tools==20.1.8
- clang==20.1.8
- cmake>=3.30.4
- cuda-cudart-dev
- cuda-nvcc
Expand All @@ -17,7 +15,6 @@ dependencies:
- cuda-version=13.1
- cxx-compiler
- gcc_linux-64=14.*
- libclang==20.1.8
- libcublas-dev
- libcurand-dev
- libcusolver-dev
Expand Down
2 changes: 0 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ files:
cuda: ["12.9", "13.1"]
arch: [x86_64, aarch64]
includes:
# clang/libclang only needed for bindgen support
- clang
- cuda
- cuda_version
- rapids_build
Expand Down
10 changes: 8 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0

[workspace]
members = [
"cuvs",
Expand All @@ -7,9 +10,12 @@ resolver = "2"

[workspace.package]
version = "26.6.0"
edition = "2021"
edition = "2024"
repository = "https://github.com/rapidsai/cuvs"
homepage = "https://github.com/rapidsai/cuvs"
description = "RAPIDS vector search library"
description = "Vector Search and Clustering on the GPU"
authors = ["NVIDIA Corporation"]
license = "Apache-2.0"

[workspace.dependencies]
cuvs-sys = { path = "cuvs-sys", version = "26.6.0" }
74 changes: 0 additions & 74 deletions rust/cuvs-sys/CMakeLists.txt

This file was deleted.

23 changes: 18 additions & 5 deletions rust/cuvs-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0

[package]
name = "cuvs-sys"
description = "Low-level rust bindings to libcuvs"
links = "cuvs"
description = "Low-level FFI bindings for the cuVS C API (libcuvs_c)"
links = "cuvs" # expose build variables to downstream crates via "DEP_CUVS_*"
version.workspace = true
edition.workspace = true
repository.workspace = true
homepage.workspace = true
authors.workspace = true
license.workspace = true

[dependencies]
[features]
default = []
generate-bindings = ["bindgen"]
doc-only = []

[build-dependencies]
cmake = ">=0.1"
bindgen = ">=0.69"
bindgen = { version = "0.72", optional = true }
cmake-package = "0.1.15"
anyhow = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tempfile = "3"

[package.metadata.docs.rs]
features = ["doc-only"]
1 change: 0 additions & 1 deletion rust/cuvs-sys/RAPIDS_BRANCH

This file was deleted.

1 change: 0 additions & 1 deletion rust/cuvs-sys/VERSION

This file was deleted.

17 changes: 17 additions & 0 deletions rust/cuvs-sys/bindgen-stubs/cuda_runtime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

/*
* Minimal bindgen-only CUDA runtime stub.
*
* cuVS C headers currently include <cuda_runtime.h> only for cudaStream_t and
* cudaDataType_t in public C ABI declarations. The Rust bindings provide their
* own ABI-compatible definitions and blocklist CUDA items, so bindgen only needs
* these declarations to parse the headers without having to discover a CUDA Toolkit.
*/
typedef struct CUstream_st* cudaStream_t;
typedef unsigned int cudaDataType_t;
Loading
Loading