From 55d6710dddacdc4fc629fb85405dfd773b9d8496 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Wed, 13 Mar 2024 14:15:49 -0700 Subject: [PATCH] Update build.sh to build rust bindings * Update build.sh to build the rust bindings * update ci/release/update-version.sh to keep the rust version up to date * remove references to the cuvs-rs conda package from the README --- README.md | 8 ++++---- build.sh | 19 +++++++++++++------ ci/release/update-version.sh | 7 ++++++- rust/Cargo.toml | 2 +- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4a2d2de16..57f91c103 100755 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ cuVS contains state-of-the-art implementations of several algorithms for running cuVS comes with pre-built packages that can be installed through [conda](https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python). Different packages are available for the different languages supported by cuVS: -| Python | C++ | C | Rust | -|--------|-----|---|------| -| `pycuvs`| `libcuvs` | `libcuvs_c` | `cuvs-rs` | +| Python | C++ | C | +|--------|-----|---| +| `pycuvs`| `libcuvs` | `libcuvs_c` | ### Stable release @@ -170,7 +170,7 @@ fn cagra_example() -> Result<()> { ## Contributing -If you are interested in contributing to the cuVS library, please read our [Contributing guidelines](docs/source/contributing.md). Refer to the [Developer Guide](docs/source/developer_guide.md) for details on the developer guidelines, workflows, and principals. +If you are interested in contributing to the cuVS library, please read our [Contributing guidelines](docs/source/contributing.md). Refer to the [Developer Guide](docs/source/developer_guide.md) for details on the developer guidelines, workflows, and principles. ## References diff --git a/build.sh b/build.sh index 8c4ece05e..96832797b 100755 --- a/build.sh +++ b/build.sh @@ -18,13 +18,14 @@ ARGS=$* # scripts, and that this script resides in the repo dir! REPODIR=$(cd $(dirname $0); pwd) -VALIDARGS="clean libcuvs python docs tests examples clean --uninstall -v -g -n --compile-static-lib --allgpuarch --no-nvtx --show_depr_warn --incl-cache-stats --time -h" +VALIDARGS="clean libcuvs python rust docs tests examples --uninstall -v -g -n --compile-static-lib --allgpuarch --no-nvtx --show_depr_warn --incl-cache-stats --time -h" HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool=] [--limit-tests=] [--build-metrics=] where is: clean - remove all existing build artifacts and configuration (start over) libcuvs - build the cuvs C++ code only. Also builds the C-wrapper library around the C++ code. python - build the cuvs Python package + rust - build the cuvs Rust bindings docs - build the documentation tests - build the tests examples - build the examples @@ -54,8 +55,8 @@ LIBCUVS_BUILD_DIR=${LIBCUVS_BUILD_DIR:=${REPODIR}/cpp/build} SPHINX_BUILD_DIR=${REPODIR}/docs DOXYGEN_BUILD_DIR=${REPODIR}/cpp/doxygen PYTHON_BUILD_DIR=${REPODIR}/python/cuvs/_skbuild -RUST_BUILD_DIR=${REPODIR}/rust -BUILD_DIRS="${LIBCUVS_BUILD_DIR} ${PYTHON_BUILD_DIR}" +RUST_BUILD_DIR=${REPODIR}/rust/target +BUILD_DIRS="${LIBCUVS_BUILD_DIR} ${PYTHON_BUILD_DIR} ${RUST_BUILD_DIR}" # Set defaults for vars modified by flags to this script CMAKE_LOG_LEVEL="" @@ -392,6 +393,12 @@ if (( ${NUMARGS} == 0 )) || hasArg python; then python -m pip install --no-build-isolation --no-deps -vvv ${REPODIR}/python/cuvs fi +# Build the cuvs Rust bindings +if (( ${NUMARGS} == 0 )) || hasArg rust; then + cd ${REPODIR}/rust + cargo build --examples --lib +fi + export RAPIDS_VERSION="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2.\3/' "${REPODIR}/VERSION")" export RAPIDS_VERSION_MAJOR_MINOR="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2/' "${REPODIR}/VERSION")" @@ -399,11 +406,11 @@ if hasArg docs; then set -x cd ${DOXYGEN_BUILD_DIR} doxygen Doxyfile - cd ${RUST_BUILD_DIR} - cargo doc -p cuvs --no-deps - rsync -av ${RUST_BUILD_DIR}/target/doc/ ${SPHINX_BUILD_DIR}/source/_static/rust cd ${SPHINX_BUILD_DIR} sphinx-build -b html source _html + cd ${REPODIR}/rust + cargo doc -p cuvs --no-deps + rsync -av ${RUST_BUILD_DIR}/doc/ ${SPHINX_BUILD_DIR}/_html/_static/rust fi ################################################################################ diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 7dc4d1273..589110ab1 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright (c) 2020-2024, NVIDIA CORPORATION. ######################## -# RAFT Version Updater # +# CUVS Version Updater # ######################## ## Usage @@ -21,6 +21,7 @@ CURRENT_SHORT_TAG=${CURRENT_MAJOR}.${CURRENT_MINOR} #Get . for next version NEXT_MAJOR=$(echo $NEXT_FULL_TAG | awk '{split($0, a, "."); print a[1]}') NEXT_MINOR=$(echo $NEXT_FULL_TAG | awk '{split($0, a, "."); print a[2]}') +NEXT_PATCH=$(echo $NEXT_FULL_TAG | awk '{split($0, a, "."); print a[3]}') NEXT_SHORT_TAG=${NEXT_MAJOR}.${NEXT_MINOR} NEXT_UCX_PY_SHORT_TAG="$(curl -sL https://version.gpuci.io/rapids/${NEXT_SHORT_TAG})" NEXT_UCX_PY_VERSION="${NEXT_UCX_PY_SHORT_TAG}.*" @@ -81,6 +82,10 @@ sed_runner "s|:[0-9][0-9].[0-9][0-9]|:${NEXT_SHORT_TAG}|g" docs/source/raft_ann_ sed_runner "s|branch-[0-9][0-9].[0-9][0-9]|branch-${NEXT_SHORT_TAG}|g" README.md +# 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 + # .devcontainer files find .devcontainer/ -type f -name devcontainer.json -print0 | while IFS= read -r -d '' filename; do sed_runner "s@rapidsai/devcontainers:[0-9.]*@rapidsai/devcontainers:${NEXT_SHORT_TAG}@g" "${filename}" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 7e9bfe4ec..689fd0565 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -6,7 +6,7 @@ members = [ resolver = "2" [workspace.package] -version = "0.1.0" +version = "24.4.0" edition = "2021" repository = "https://github.com/rapidsai/cuvs" homepage = "https://github.com/rapidsai/cuvs"