Skip to content

add libcuvs Python builds#440

Merged
bdice merged 3 commits intorapidsai:branch-25.02from
jameslamb:libcuvs-wheels
Jan 22, 2025
Merged

add libcuvs Python builds#440
bdice merged 3 commits intorapidsai:branch-25.02from
jameslamb:libcuvs-wheels

Conversation

@jameslamb
Copy link
Member

Contributes to rapidsai/build-planning#33

Adjusts rapids-build-utils manifest for release 25.02 to account for the introduction of new libcuvs wheels (rapidsai/cuvs#594).

Notes for Reviewers

This shouldn't be merged still pointing at my forks. Plan:

  1. see CI pass here
  2. see all CI except devcontainers pass on introduce libcuvs wheels cuvs#594
  3. point this PR back at upstream and admin-merge it
  4. re-run devcontainers CI on introduce libcuvs wheels cuvs#594 and see it pass

@jameslamb jameslamb added breaking Introduces a breaking change improvement Improves an existing functionality labels Jan 21, 2025
@jameslamb
Copy link
Member Author

🎉 builds succeeded here! (build link)

That's strong evidence that rapidsai/cuvs#594 won't break devcontainers.

@jameslamb jameslamb requested a review from bdice January 22, 2025 19:39
@jameslamb jameslamb changed the title WIP: add libcuvs Python builds add libcuvs Python builds Jan 22, 2025
@jameslamb jameslamb marked this pull request as ready for review January 22, 2025 19:39
@jameslamb jameslamb requested a review from a team as a code owner January 22, 2025 19:39
Co-authored-by: James Lamb <jaylamb20@gmail.com>
@bdice
Copy link
Contributor

bdice commented Jan 22, 2025

Discussed with @jameslamb -- we will go ahead and merge this to unblock rapidsai/cuvs#594.

@bdice bdice merged commit 5c6d283 into rapidsai:branch-25.02 Jan 22, 2025
14 of 16 checks passed
rapids-bot bot pushed a commit to rapidsai/cuvs that referenced this pull request Jan 23, 2025
Contributes to rapidsai/build-planning#33.

Proposes packaging `libcuvs` as a wheel, which is then re-used by `cuvs-cu{11,12}`.

Similar changes were recently made in RAFT: rapidsai/raft#2531

As part of this, also proposes:

* introducing a new CMake option, `CUVS_COMPILE_DYNAMIC_ONLY`, to allow building/installing only the dynamic shared library (i.e. skipping the static library)
* enforcing `rapids-cmake`'s preferred CMake style (similar rapidsai/raft#2531 (comment))
* standardizing `clang` pins across the project, and pinning to `clang` 16 for Rust builds (#594 (comment))

## Notes for Reviewers

### Benefits of these changes

* smaller wheels for projects that depend on cuVS (they can dynamically link against `libcuvs` instead of statically linking in the pieces they need)
* fewer CI resources used for cuVS wheels (no more re-compiling for every Python minor version)
* faster, cheaper cuML wheel builds (rapidsai/cuml#6199 (comment))
* other benefits mentioned in rapidsai/build-planning#33

### Wheel contents

`libcuvs`:

* `libcuvs.so` and `libcuvs_c.so` (shared library)
* cuVS headers
* vendored dependencies (hnswlib)

`cuvs`:

* `cuvs` Python / Cython code and compiled Cython extensions

### Size changes (CUDA 12, Python 3.12, x86_64)

| wheel                | num files (before) | num files (this PR) | size (before)  | size (this PR) |
|:---------------:|------------------:|-----------------:|--------------:|---------------:|
| `libcuvs`          |   ---                        |  67                        | ---                   | 843M               |
| `cuvs`              | 88                          |   84                       |845M               | 2M                    |
|**TOTAL**          |   **88**                |   **131**                 | **845M**       | **845M**         |

*NOTES: size = compressed, "before" = 2025-01-22 nightlies*

<details><summary>how I calculated those (click me)</summary>

* nightly commit = rapidsai/cuml@7c715c4
* PR = this PR

```shell
docker run \
    --rm \
    --network host \
    --env RAPIDS_NIGHTLY_DATE=2025-01-22 \
    --env CUVS_NIGHTLY_SHA=f1de1b2 \
    --env CUVS_PR="pull-request/594" \
    --env CUVS_PR_SHA="97c56178cd0e07e4b6b138bb0904af78379f1bb3" \
    --env RAPIDS_PY_CUDA_SUFFIX=cu12 \
    --env WHEEL_DIR_BEFORE=/tmp/wheels-before \
    --env WHEEL_DIR_AFTER=/tmp/wheels-after \
    -it rapidsai/ci-wheel:cuda12.5.1-rockylinux8-py3.12 \
    bash

# --- nightly wheels --- #
mkdir -p ./wheels-before

export RAPIDS_BUILD_TYPE=branch
export RAPIDS_REF_NAME="branch-25.02"

# cuvs
RAPIDS_PY_WHEEL_NAME="cuvs_${RAPIDS_PY_CUDA_SUFFIX}" \
RAPIDS_REPOSITORY=rapidsai/cuvs \
RAPIDS_SHA=${CUVS_NIGHTLY_SHA} \
    rapids-download-wheels-from-s3 python ./wheels-before

# --- wheels from CI --- #
mkdir -p ./wheels-after

export RAPIDS_BUILD_TYPE="pull-request"

# libcuvs
RAPIDS_PY_WHEEL_NAME="libcuvs_${RAPIDS_PY_CUDA_SUFFIX}" \
RAPIDS_REPOSITORY=rapidsai/cuvs \
RAPIDS_REF_NAME="${CUVS_PR}" \
RAPIDS_SHA="${CUVS_PR_SHA}" \
    rapids-download-wheels-from-s3 cpp ./wheels-after

# cuvs
RAPIDS_PY_WHEEL_NAME="cuvs_${RAPIDS_PY_CUDA_SUFFIX}" \
RAPIDS_REPOSITORY=rapidsai/cuvs \
RAPIDS_REF_NAME="${CUVS_PR}" \
RAPIDS_SHA="${CUVS_PR_SHA}" \
    rapids-download-wheels-from-s3 python ./wheels-after

pip install pydistcheck
pydistcheck \
    --inspect \
    --select 'distro-too-large-compressed' \
    ./wheels-before/*.whl \
| grep -E '^checking|files: | compressed' \
> ./before.txt

# get more exact sizes
du -sh ./wheels-before/*

pydistcheck \
    --inspect \
    --select 'distro-too-large-compressed' \
    ./wheels-after/*.whl \
| grep -E '^checking|files: | compressed' \
> ./after.txt

# get more exact sizes
du -sh ./wheels-after/*
```

</details>

### How I tested this

* rapidsai/devcontainers#440
* rapidsai/cuml#6199

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Ben Frederickson (https://github.com/benfred)

URL: #594
vyasr pushed a commit that referenced this pull request Jan 23, 2025
Contributes to rapidsai/build-planning#33

Adjusts `rapids-build-utils` manifest for release 25.02 to account for
the introduction of new `libcuml` wheels
(rapidsai/cuml#6199).

## Notes for Reviewers

This shouldn't be merged still pointing at my forks.

Plan:

1. merge #440, then update
this branch
2. see CI pass here
3. see all CI except devcontainers pass on
rapidsai/cuml#6199
4. point this PR back at upstream and admin-merge it
5. re-run devcontainers CI on rapidsai/cuml#6199
and see it pass
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants