diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c18e9f97a..13f70c1fb2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -61,34 +61,54 @@ jobs: contents: read uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@release/26.10 with: - build_type: pull-request + build_type: ${{ inputs.build_type || 'branch' }} matrix_name: conda-cpp-build rocky8-clib-standalone-build: - needs: [build-details, rocky8-clib-standalone-build-matrix] + needs: [rocky8-clib-standalone-build-matrix] + runs-on: linux-${{ matrix.ARCH }}-cpu16 + env: + RAPIDS_BUILD_TYPE: ${{ inputs.build_type || 'branch' }} permissions: actions: read contents: read id-token: write packages: read pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@release/26.10 strategy: fail-fast: false matrix: ${{ fromJSON(needs.rocky8-clib-standalone-build-matrix.outputs.matrix) }} - with: - build_type: ${{ inputs.build_type || 'branch' }} - build-datetime: ${{ needs.build-details.outputs.build-datetime }} - branch: ${{ inputs.branch }} - arch: "${{matrix.ARCH}}" - date: ${{ inputs.date }} - container_image: "rapidsai/ci-wheel:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}" - node_type: "cpu16" - requires_license_builder: true - script: "ci/build_standalone_c.sh" - artifact-name: "libcuvs_c_${{ matrix.CUDA_VER }}_${{ matrix.ARCH }}.tar.gz" - file_to_upload: "libcuvs_c.tar.gz" - sha: ${{ inputs.sha }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Standardize repository information + uses: rapidsai/shared-actions/rapids-github-info@main + with: + branch: ${{ inputs.branch }} + date: ${{ inputs.date }} + sha: ${{ inputs.sha }} + - uses: aws-actions/configure-aws-credentials@cbe3b392738ccf3f987d68400dafcf4b0624a56c # v6.2.4 + with: + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + aws-region: ${{ vars.AWS_REGION }} + role-duration-seconds: 10800 + - name: Setup sccache-dist + uses: rapidsai/shared-actions/setup-sccache-dist@main + with: + request-timeout: 7140 + - name: Build standalone C tarball + env: + CUVS_TARBALL_CUDA_VERSION: ${{ matrix.CUDA_VER }} + CUVS_TARBALL_PYTHON_VERSION: ${{ matrix.PY_VER }} + run: | + ./build.sh tarball --tarball-build-tests + - name: Upload artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: libcuvs_c_${{ matrix.CUDA_VER }}_${{ matrix.ARCH }}.tar.gz + path: libcuvs_c.tar.gz rust-build-matrix: needs: cpp-build permissions: @@ -128,7 +148,7 @@ jobs: contents: read uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@release/26.10 with: - build_type: pull-request + build_type: ${{ inputs.build_type || 'branch' }} matrix_name: conda-cpp-build matrix_filter: map(select(.ARCH == "amd64")) go-build: @@ -161,7 +181,7 @@ jobs: contents: read uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@release/26.10 with: - build_type: pull-request + build_type: ${{ inputs.build_type || 'branch' }} matrix_name: conda-cpp-build matrix_filter: map(select(.ARCH == "amd64")) java-build: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index c4b576d6a4..10b12303e6 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -563,30 +563,45 @@ jobs: build_type: pull-request matrix_name: conda-cpp-build rocky8-clib-standalone-build: - needs: [build-details, rocky8-clib-standalone-build-matrix] + needs: [rocky8-clib-standalone-build-matrix] + runs-on: linux-${{ matrix.ARCH }}-cpu16 + env: + RAPIDS_BUILD_TYPE: pull-request permissions: actions: read contents: read id-token: write packages: read pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@release/26.10 strategy: fail-fast: false matrix: ${{ fromJSON(needs.rocky8-clib-standalone-build-matrix.outputs.matrix) }} - with: - build_type: pull-request - build-datetime: ${{ needs.build-details.outputs.build-datetime }} - arch: "${{matrix.arch}}" - date: ${{ inputs.date }}_c - container_image: "rapidsai/ci-wheel:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}" - node_type: "cpu16" - requires_license_builder: true - script: "ci/build_standalone_c.sh --build-tests" - artifact-name: "libcuvs_c_${{ matrix.CUDA_VER }}_${{ matrix.ARCH }}.tar.gz" - file_to_upload: "libcuvs_c.tar.gz" - sha: ${{ inputs.sha }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - uses: aws-actions/configure-aws-credentials@cbe3b392738ccf3f987d68400dafcf4b0624a56c # v6.2.4 + with: + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + aws-region: ${{ vars.AWS_REGION }} + role-duration-seconds: 10800 + - name: Setup sccache-dist + uses: rapidsai/shared-actions/setup-sccache-dist@main + with: + request-timeout: 7140 + - name: Build standalone C tarball + env: + CUVS_TARBALL_CUDA_VERSION: ${{ matrix.CUDA_VER }} + CUVS_TARBALL_PYTHON_VERSION: ${{ matrix.PY_VER }} + run: | + ./build.sh tarball --tarball-build-tests + - name: Upload artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: libcuvs_c_${{ matrix.CUDA_VER }}_${{ matrix.ARCH }}.tar.gz + path: libcuvs_c.tar.gz rocky8-clib-tests-matrix: needs: [rocky8-clib-standalone-build, changed-files] permissions: diff --git a/.gitignore b/.gitignore index 3627558ff5..7357b2a81e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ dist/ python/**/**/*.cpp python/cuvs/record.txt log +infrequent_licenses/ .ipynb_checkpoints .DS_Store dask-worker-space/ @@ -29,6 +30,7 @@ temporary_*.json rust/target/ rust/Cargo.lock rmm_log.txt +*.tar.gz ## example notebooks notebooks/simplewiki-2020-11-01-nq-distilbert-base-v1.pt diff --git a/Dockerfile.standalone b/Dockerfile.standalone new file mode 100644 index 0000000000..11a4580d81 --- /dev/null +++ b/Dockerfile.standalone @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Environment and runner for the standalone C build. +# +# End-user instructions: https://docs.nvidia.com/cuvs/installation#build-the-standalone-c-library-with-docker + +ARG CUDA_VERSION=notset +ARG PYTHON_VERSION=notset +ARG RAPIDS_VERSION=notset +FROM rapidsai/ci-wheel:${RAPIDS_VERSION}-cuda${CUDA_VERSION}-rockylinux8-py${PYTHON_VERSION} + +# Output directory for the standalone archive. Bind-mount a host folder here +# (e.g. -v $(pwd)/build:/build) so libcuvs_c.tar.gz is written to the host. +ENV CUVS_TARBALL_BUILD_OUTPUT_DIR=/build +ENV CUVS_TARBALL_IN_CONTAINER=1 + +# Run from repo root; the repo is expected to be bind-mounted at /workspace. +WORKDIR /workspace + +# Run the build script, which writes the standalone tarball to the mounted output dir. +# Example: docker run -v $(pwd):/workspace -v $(pwd)/build:/build cuvs-standalone-c [--tarball-build-tests] +ENTRYPOINT ["/bin/bash", "-c", "ci/standalone_c/build_standalone_c.sh \"$@\"", "--"] diff --git a/README.md b/README.md index 77d2466c6a..fa25907ca6 100755 --- a/README.md +++ b/README.md @@ -84,6 +84,10 @@ cuVS comes with pre-built packages that can be installed through [conda](https:/ Please see the [Build and Install Guide](https://docs.rapids.ai/api/cuvs/nightly/build/) for more information on installing the available cuVS packages and building from source. +### Standalone C library (Docker) + +To build the standalone C library tarball (`libcuvs_c.tar.gz`) for use in your own C/C++ projects, see **[Building the standalone C library with Docker](https://docs.nvidia.com/cuvs/installation#build-the-standalone-c-library-with-docker)**. + ## Getting Started The following code snippets train an approximate nearest neighbors index for the CAGRA algorithm in the various different languages supported by cuVS. diff --git a/build.sh b/build.sh index da8adb793f..dadbba9ce7 100755 --- a/build.sh +++ b/build.sh @@ -19,7 +19,7 @@ ARGS=$* # scripts, and that this script resides in the repo dir! REPODIR=$(cd "$(dirname "$0")"; pwd) -VALIDARGS="clean libcuvs python rust go java lucene docs tests bench-ann examples --uninstall -v -g -n --allgpuarch --no-mg --mnmg-tests --no-cpu --cpu-only --no-shared-libs --no-nvtx --show_depr_warn --incl-cache-stats --time -h --run-java-tests --build-java-examples" +VALIDARGS="clean libcuvs python rust go java lucene docs tests bench-ann examples tarball --tarball-build-tests --uninstall -v -g -n --allgpuarch --no-mg --mnmg-tests --no-cpu --cpu-only --no-shared-libs --no-nvtx --show_depr_warn --incl-cache-stats --time -h --run-java-tests --build-java-examples" HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool=] [--limit-tests=] [--limit-bench-ann=] [--build-metrics=] where is: clean - remove all existing build artifacts and configuration (start over) @@ -34,6 +34,7 @@ HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool= is: -v - verbose build mode @@ -59,6 +60,7 @@ HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool=\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument) @@ -607,3 +609,56 @@ if hasArg examples; then ./build.sh popd fi + +################################################################################ +# Build the standalone C library tarball (if requested) + +if hasArg tarball; then + if [[ "${CUVS_TARBALL_IN_CONTAINER:-0}" == "1" ]]; then + CUVS_TARBALL_BUILD_OUTPUT_DIR="${CUVS_TARBALL_BUILD_OUTPUT_DIR:-${REPODIR}}" + tar czf "${CUVS_TARBALL_BUILD_OUTPUT_DIR}/libcuvs_c.tar.gz" -C "${REPODIR}/c/build/install" . + else + CUVS_TARBALL_CUDA_VERSION="${CUVS_TARBALL_CUDA_VERSION:-13.3.0}" + CUVS_TARBALL_PYTHON_VERSION="${CUVS_TARBALL_PYTHON_VERSION:-3.14}" + CUVS_TARBALL_BUILD_OUTPUT_DIR="${CUVS_TARBALL_BUILD_OUTPUT_DIR:-${REPODIR}/build}" + CUVS_TARBALL_IMAGE_NAME="nvidia/cuvs-standalone-c:local-cuda${CUVS_TARBALL_CUDA_VERSION}-py${CUVS_TARBALL_PYTHON_VERSION}" + + mkdir -p "${CUVS_TARBALL_BUILD_OUTPUT_DIR}" + BUILD_OUTPUT_DIR_ABS=$(realpath "${CUVS_TARBALL_BUILD_OUTPUT_DIR}") + + echo "Building Docker image ${CUVS_TARBALL_IMAGE_NAME} (CUDA ${CUVS_TARBALL_CUDA_VERSION}, Python ${CUVS_TARBALL_PYTHON_VERSION})..." + docker build \ + -f "${REPODIR}/Dockerfile.standalone" \ + --build-arg CUDA_VERSION="${CUVS_TARBALL_CUDA_VERSION}" \ + --build-arg PYTHON_VERSION="${CUVS_TARBALL_PYTHON_VERSION}" \ + --build-arg RAPIDS_VERSION="${RAPIDS_VERSION_MAJOR_MINOR}" \ + -t "${CUVS_TARBALL_IMAGE_NAME}" \ + "${REPODIR}" + + # optionally pass additional arguments through to the container's entrypoint + DOCKER_ENTRYPOINT_ARGS=() + if hasArg --tarball-build-tests; then + DOCKER_ENTRYPOINT_ARGS+=(--tarball-build-tests) + fi + + echo "Running standalone C build in container..." + # NOTE: the '--env-file' trick for AWS credentials keeps them out of 'ps aux' / 'docker ps' output + docker run \ + --rm \ + -v "${REPODIR}:/workspace:rw" \ + -v "${BUILD_OUTPUT_DIR_ABS}:/build:rw" \ + --env CI="${CI:-false}" \ + --env PARALLEL_LEVEL="${PARALLEL_LEVEL}" \ + --env RAPIDS_BUILD_TYPE="${RAPIDS_BUILD_TYPE:-}" \ + --env-file <(env | grep -E '^AWS_(ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)=') \ + --env-file <(env | grep -E '^SCCACHE_.*=') \ + "${CUVS_TARBALL_IMAGE_NAME}" \ + "${DOCKER_ENTRYPOINT_ARGS[@]}" + + cp -v "${BUILD_OUTPUT_DIR_ABS}/libcuvs_c.tar.gz" "${REPODIR}/libcuvs_c.tar.gz" + echo "Copied libcuvs_c.tar.gz to ${REPODIR}/libcuvs_c.tar.gz" + fi + + # print contents of the tarball + ls -lh "${CUVS_TARBALL_BUILD_OUTPUT_DIR}/libcuvs_c.tar.gz" +fi diff --git a/ci/build_standalone_c.sh b/ci/standalone_c/build_standalone_c.sh similarity index 64% rename from ci/build_standalone_c.sh rename to ci/standalone_c/build_standalone_c.sh index e1267f71b7..9b7a4d4a47 100755 --- a/ci/build_standalone_c.sh +++ b/ci/standalone_c/build_standalone_c.sh @@ -1,67 +1,47 @@ #!/bin/bash # SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +# +# Build script for the standalone C library. +# +# Use 'Dockerfile.standalone' to build an image with all the prerequisites +# and run this in a container. set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + TOOLSET_VERSION=14 -NINJA_VERSION=v1.13.1 BUILD_C_LIB_TESTS="OFF" -if [[ "${1:-}" == "--build-tests" ]]; then +if [[ "${1:-}" == "--tarball-build-tests" ]]; then BUILD_C_LIB_TESTS="ON" fi -dnf install -y \ - patch \ - tar \ - unzip \ - wget - -if ! command -V ninja >/dev/null 2>&1; then - case "$(uname -m)" in - x86_64) - wget --no-hsts -q -O /tmp/ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/${NINJA_VERSION}/ninja-linux.zip"; - ;; - aarch64) - wget --no-hsts -q -O /tmp/ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/${NINJA_VERSION}/ninja-linux-aarch64.zip"; - ;; - *) - echo "Unrecognized platform '$(uname -m)'" >&2 - exit 1 - ;; - esac - unzip -d /usr/bin /tmp/ninja-linux.zip - chmod +x /usr/bin/ninja - rm /tmp/ninja-linux.zip -fi - source rapids-install-sccache source rapids-configure-sccache -source rapids-datetime-string -rapids-pip-retry install cmake +PIP_PACKAGES=( + 'cmake>=4.0' + 'git+https://github.com/rapidsai/spdx-license-builder.git' + 'ninja>=1.13' +) RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}" if [[ "${RAPIDS_CUDA_MAJOR}" == "13" ]]; then - rapids-pip-retry install cuda-tile "cuda-toolkit[tileiras]==${RAPIDS_CUDA_VERSION%.*}.*" + PIP_PACKAGES+=( + cuda-tile + ) fi +rapids-pip-retry install "${PIP_PACKAGES[@]}" pyenv rehash -rapids-print-env - rapids-logger "Begin cpp build" sccache --stop-server 2>/dev/null || true -RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) -export RAPIDS_PACKAGE_VERSION - -RAPIDS_ARTIFACTS_DIR=${RAPIDS_ARTIFACTS_DIR:-"${PWD}/artifacts"} -mkdir -p "${RAPIDS_ARTIFACTS_DIR}" -export RAPIDS_ARTIFACTS_DIR - scl enable gcc-toolset-${TOOLSET_VERSION} -- \ cmake -S cpp -B cpp/build/ -GNinja \ -DCMAKE_CUDA_HOST_COMPILER=/opt/rh/gcc-toolset-${TOOLSET_VERSION}/root/usr/bin/gcc \ @@ -107,11 +87,8 @@ if [ "${BUILD_C_LIB_TESTS}" != "OFF" ]; then cmake --install c/build --prefix c/build/install --component testing fi - rapids-logger "Begin gathering licenses" -rapids-pip-retry install git+https://github.com/rapidsai/spdx-license-builder.git license-builder . --output-json c/build/install/licenses.json --output-txt c/build/install/LICENSE rapids-logger "Begin c tarball creation" -tar czf libcuvs_c.tar.gz -C c/build/install/ . -ls -lh libcuvs_c.tar.gz +"${REPO_ROOT}/build.sh" tarball diff --git a/ci/standalone_c/dlsym_smoke.c b/ci/standalone_c/dlsym_smoke.c new file mode 100644 index 0000000000..e9148a5012 --- /dev/null +++ b/ci/standalone_c/dlsym_smoke.c @@ -0,0 +1,36 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +int main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 2; + } + + void* handle = dlopen(argv[1], RTLD_NOW | RTLD_LOCAL); + if (handle == NULL) { + fprintf(stderr, "Failed to load %s: %s\n", argv[1], dlerror()); + return 1; + } + + dlerror(); + void* symbol = dlsym(handle, "cuvsResourcesCreate"); + const char* error = dlerror(); + if (error != NULL || symbol == NULL) { + fprintf(stderr, + "Failed to resolve cuvsResourcesCreate: %s\n", + error != NULL ? error : "unknown error"); + dlclose(handle); + return 1; + } + + printf("Successfully loaded %s and resolved cuvsResourcesCreate\n", argv[1]); + dlclose(handle); + return 0; +} diff --git a/ci/test_standalone_c.sh b/ci/test_standalone_c.sh index 894d687bff..519fa2470d 100755 --- a/ci/test_standalone_c.sh +++ b/ci/test_standalone_c.sh @@ -1,5 +1,5 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail @@ -7,6 +7,7 @@ set -euo pipefail rapids-pip-retry install cmake pyenv rehash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" INSTALL_PREFIX="${PWD}/libcuvs_c_install" mkdir -p "${INSTALL_PREFIX}" @@ -24,6 +25,25 @@ DOWNLOAD_LOCATION=$(rapids-download-from-github "${payload_name}") # Extract the artifact to a staging directory tar -xf "${DOWNLOAD_LOCATION}/${pkg_name}" -C "${INSTALL_PREFIX}" +rapids-logger "Validate C API shared library" +C_API_LIBRARY="" +for C_API_LIBRARY_DIR in "${INSTALL_PREFIX}/lib" "${INSTALL_PREFIX}/lib64"; do + if [[ -f "${C_API_LIBRARY_DIR}/libcuvs_c.so" ]]; then + C_API_LIBRARY="${C_API_LIBRARY_DIR}/libcuvs_c.so" + break + fi +done + +if [[ -z "${C_API_LIBRARY}" ]]; then + echo "Error: C API shared library not found under ${INSTALL_PREFIX}/lib or ${INSTALL_PREFIX}/lib64" >&2 + exit 1 +fi + +C_API_SMOKE_TEST="${INSTALL_PREFIX}/bin/cuvs_c_dlsym_smoke" +"${CC:-cc}" -std=c11 -Wall -Wextra -Werror \ + "${SCRIPT_DIR}/standalone_c/dlsym_smoke.c" -ldl -o "${C_API_SMOKE_TEST}" +LD_LIBRARY_PATH="$(dirname "${C_API_LIBRARY}"):${LD_LIBRARY_PATH:-}" \ + "${C_API_SMOKE_TEST}" "${C_API_LIBRARY}" rapids-logger "Run C API tests" ls -l "${INSTALL_PREFIX}" diff --git a/fern/pages/build.md b/fern/pages/build.md index e8fabd8d27..4cd49bba2b 100644 --- a/fern/pages/build.md +++ b/fern/pages/build.md @@ -41,6 +41,118 @@ conda activate cuvs You may prefer `mamba` over `conda` for faster environment solves. The `conda/environments` directory also contains language-specific environment YAML files for narrower development environments. Conda is not required, but if you do not use it, install all required build dependencies explicitly before running `build.sh`. +## Build the Standalone C Library with Docker + + +The standalone tarball is built with Docker so that it uses the supported toolchain versions and the build remains portable and reproducible across all supported installation platforms. + + +Use the standalone Docker build when you want a `libcuvs_c.tar.gz` archive that you can unpack and use to build your own C or C++ binaries for deployment or integration. + +### Prerequisites + +- Docker with support for the target platform: x86_64 or aarch64. +- At least 16 GB of memory and 20 GB of free disk space available to Docker. +- NVIDIA Container Toolkit and a GPU if you want to run GPU-dependent steps. The image is based on CUDA and may require GPU support at runtime. + +### Use the Helper Script + +From the repository root, run: + +```bash +# (optional) clean old build directories +rm -rf ./{build,c/build/,cpp/build} + +# build +./build.sh tarball +``` + +The script builds the Docker image, runs the build in a container, writes the tarball to `./build/libcuvs_c.tar.gz`, and copies it to `./libcuvs_c.tar.gz` for CI artifact upload and convenience. + +The helper accepts the following environment variables: + +| Variable | Default | Purpose | +| --- | --- | --- | +| `CUVS_TARBALL_CUDA_VERSION` | `13.3.0` | CUDA version for the `rapidsai/ci-wheel` base image. | +| `CUVS_TARBALL_PYTHON_VERSION` | `3.14` | Python version for the `rapidsai/ci-wheel` base image. | +| `CUVS_TARBALL_BUILD_OUTPUT_DIR` | `./build` | Host directory where the tarball is written. | + +CUDA and Python versions should match an existing `rapidsai/ci-wheel` tag. +See https://hub.docker.com/r/rapidsai/ci-wheel/tags + +For example: + +```bash +CUVS_TARBALL_CUDA_VERSION=13.3.0 \ +CUVS_TARBALL_PYTHON_VERSION=3.14 \ + ./build.sh tarball +``` + +To write the tarball to another directory, set `CUVS_TARBALL_BUILD_OUTPUT_DIR`: + +```console +$ CUVS_TARBALL_BUILD_OUTPUT_DIR="${PWD}/dist" ./build.sh tarball +$ find . -name 'libcuvs_c.tar.gz' +./dist/libcuvs_c.tar.gz +./libcuvs_c.tar.gz +``` + +To build and install the C library tests in the archive, pass `--tarball-build-tests`: + +```bash +./build.sh tarball --tarball-build-tests +``` + +### Tarball Contents + +The archive contains the headers, libraries, CMake configuration, and license information needed to compile and link C or C++ applications against the standalone NVIDIA cuVS libraries. + +### Build and Run the Docker Image Manually + +If you do not want to use the helper script, build the image directly from the repository root: + +```bash +docker build \ + -f Dockerfile.standalone \ + --build-arg CUDA_VERSION="13.3.0" \ + --build-arg PYTHON_VERSION="3.14" \ + --build-arg RAPIDS_VERSION="$(head -1 ./VERSION | cut -d. -f1,2 )" \ + -t cuvs-standalone-c:local \ + . +``` + +This command builds a local image and tags it as `cuvs-standalone-c:local`. + +Run the build in a container using that image and mount the repository plus an output directory: + +```bash +mkdir -p build +docker run --rm \ + -v "${PWD}:/workspace" \ + -v "${PWD}/build:/build" \ + cuvs-standalone-c:local +``` + +Mount another host directory at `/build` to change the output location: + +```bash +mkdir -p "${PWD}/dist" +docker run --rm \ + -v "${PWD}:/workspace" \ + -v "${PWD}/dist:/build" \ + cuvs-standalone-c:local +``` + +Pass `--tarball-build-tests` to include the C library tests: + +```bash +mkdir -p build +docker run --rm \ + -v "${PWD}:/workspace" \ + -v "${PWD}/build:/build" \ + cuvs-standalone-c:local --tarball-build-tests +``` + ## Documentation Preview The NVIDIA cuVS documentation is a Fern project in the repository's `fern` directory. Fern requires Node.js 22 or newer. If the docs fail with an error such as `SyntaxError: Unexpected token '.'`, check `node --version` and activate a newer Node.js runtime.