Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build isolation in wheel builds #108

Closed
20 tasks done
jameslamb opened this issue Oct 14, 2024 · 9 comments
Closed
20 tasks done

Remove build isolation in wheel builds #108

jameslamb opened this issue Oct 14, 2024 · 9 comments
Assignees

Comments

@jameslamb
Copy link
Member

jameslamb commented Oct 14, 2024

Description

Currently, RAPIDS projects build wheels with build isolation, like pip wheel ..

With build isolation, the build tool (in our case, pip wheel), creates a virtual environment and installs of the package's build-time dependencies into it. That virtual environment is created at a random location on each build, which means source files included from other wheels (like the rmm headers from the librmm wheel) are found at a different path on each build in CI.

Path changes lead to cache misses with sccache, and therefore longer-running and more memory-intensive builds.

As more of RAPIDS build-time dependencies are provided wheels (e.g. #33), this problem is going to get worse (see #33 (comment)).

This issue tracks the work of removing build isolation in RAPIDS wheel-building CI jobs.

Benefits of this work

Better sccache hit rate = faster, cheaper CI (contributes to #95).

Stronger guarantees that packages built in CI are actually installed at test time (i.e. would close #79).

Acceptance Criteria

  • all RAPIDS C/C++ wheel builds in CI build with --no-build-isolation

Approach

Follow the approach from rapidsai/cuspatial#1473, and documented in #112.

  • pure Python? build isolation
  • Python + Cython? build isolation
  • mostly C/C++? no build isolation

Notes

These can be done in any order.

Updates

Do the GNN repos last, as some of the cugraph repos are currently being shuffled around. See e.g. rapidsai/cugraph-gnn#58 (comment).

GNN repos

@jameslamb jameslamb self-assigned this Oct 14, 2024
rapids-bot bot pushed a commit to rapidsai/cuspatial that referenced this issue Oct 22, 2024
Contributes to rapidsai/build-planning#108

Contributes to rapidsai/build-planning#111

Proposes building `libcuspatial` wheels with `--no-build-isolation`, to improve the rate of `sccache` cache hits and therefore reduce CI times.

Also proposes printing `sccache` stats to CI logs after wheel and conda builds.

## Notes for Reviewers

#

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

Approvers:
  - Mike Sarahan (https://github.com/msarahan)
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Bradley Dice (https://github.com/bdice)

URL: #1473
@jameslamb
Copy link
Member Author

I've updated the description to reflect our decision from an offline conversation:

  • pure Python? build isolation
  • just Python + Cython? build isolation
  • mostly C/C++? no build isolation

And proposed documenting that in the build-planning docs: #112

rapids-bot bot pushed a commit to rapidsai/dask-cuda that referenced this issue Oct 23, 2024
Contributes to rapidsai/build-planning#108

This is a pure Python project, so it doesn't need configuration about CMake or `sccache`.

This proposes removing them to simplify build scripts a bit.

It also proposes updating the `rapids-dependency-file-generator` pre-commit hook to it's latest version, something I'm trying to roll out across RAPIDS as part of rapidsai/build-planning#108.

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

Approvers:
  - Jake Awe (https://github.com/AyodeAwe)

URL: #1400
@vyasr
Copy link
Contributor

vyasr commented Oct 25, 2024

We shouldn't need to do this for any of the packages that haven't switched to using C++ wheels from other libraries yet, i.e. anything that is still statically linking everything. cugraph, cuml, cuvs, and raft (that may be exhaustive, or I may have missed some) don't have relevant changes yet.

rapids-bot bot pushed a commit to rapidsai/cucim that referenced this issue Oct 28, 2024
…792)

Contributes to rapidsai/build-planning#108
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* removes the use of build isolation in wheel builds
* printing `sccache` stats to CI logs
* reducing `pip`'s verbosity in wheel building scripts
* using the RAPIDS conventions `py_build_{project}` and `py_rapids_build_{project}` in `dependencies.yaml`
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)

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

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

URL: #792
rapids-bot bot pushed a commit to rapidsai/cuxfilter that referenced this issue Oct 28, 2024
…uilding scripts (#641)

Contributes to rapidsai/build-planning#108

Proposes removing `sccache` configuraiton in CI scripts ... this is a pure Python project, so it doesn't need that.

It also proposes updating the `rapids-dependency-file-generator` pre-commit hook to it's latest version (something I'm trying to roll out across RAPIDS as part of rapidsai/build-planning#108), and reducing the verbosity of wheel-building scripts.

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

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

URL: #641
@jameslamb
Copy link
Member Author

We shouldn't need to do this for ... cugraph, cuml, cuvs, and raft

Oh interesting. I'd expected that all of them were at least getting RMM headers from the librmm wheels, but looking around that appears not to be the case.

evidence of that (click me)

Looking at recent nightly wheel builds, it seems like all those projects you mentioned are getting rmm via CPM.

-- CPM: Adding package [email protected] (branch-24.12)

(pylibcugraph wheel build)

(cugraph wheel build)

(cuml wheel build)

(pylibraft wheel build)

cuvs is slightly different in that it gets it via CPM via raft's CMake, but the result is the same:

-- CPM: raft: Adding package [email protected] (branch-24.12)

(cuvs wheel build)

I'm comparing that to other projects like libcudf, which are using the librmm wheels and therefore have logs like this:

-- CPM: Using local package [email protected]

(cudf wheel build)

And any other build-time dependencies those projects are getting via wheels appear to only be reference in Cython code, which we've already said we don't want to use build isolation for (#108 (comment)).

I'll update the issue description here and add notes about using build isolation to the corresponding issues that track the work for delivering more C++ dependencies in those projects via wheels.

@vyasr
Copy link
Contributor

vyasr commented Oct 28, 2024

I'd expected that all of them were at least getting RMM headers from the librmm wheels, but looking around that appears not to be the case.

Yeah we've been following a depth-first rather than breadth-first approach to migrating packages over to use C++ wheels i.e. instead of updating everything to use librmm wheels once they existed we switched kvikio to C++ wheels (using rmm), then cudf (using kvikio and rmm), etc. It makes more sense that way since there's very little benefit to doing this partially until you get to the leaf nodes in our tree anyway (cugraph/cuml using raft).

@jameslamb
Copy link
Member Author

We shouldn't need to do this for any of the packages that haven't switched to using C++ wheels from other libraries yet

By this additional standard of "only use --no-build-isolation if at least 1 not-just-for-Cython C/C++ build-time dependency is delivered via wheels", we could skip all of these for the purpose of this issue, I think:

  • cugraph (cugraph, pylibcugraph, nx-cugraph, cugraph-equivariant, cugraph-dgl, cugraph-pyg)
  • cugraph-gnn (cugraph-pyg, cugraph-dgl, and pylibwholegraph)
  • cugraph-ops (pylibcugraphops)
  • cuml
  • cuopt
  • cuvs
  • kvikio (libkvikio, kvikio)
  • pynvjitlink
  • raft (pylibraft, raft-dask)
  • wholegraph (pylibwholegraph)

Some of those have e.g. rmm or pylibraft in build dependencies, but only for cimports in Cython code. None have build-time dependencies delivered via wheels that will otherwise show up on compile lines (e.g. libcudf, librmm).

Have I understood this correctly @vyasr ?

rapids-bot bot pushed a commit to rapidsai/cudf that referenced this issue Oct 28, 2024
Contributes to rapidsai/build-planning#108
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* building `libcudf` wheels with `--no-build-isolation` (for better `sccache` hit rate)
* printing `sccache` stats to CI logs
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`

#

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

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

URL: #17088
@vyasr
Copy link
Contributor

vyasr commented Oct 28, 2024

Yup, that is correct. AFAIK right now we should really only need to make changes to cudf, cuspatial, and kvikio (rmm would need this if it had any dependencies, but since it's our root node it doesn't). For the other libraries we'll have to remember to set this up correctly when we get around to making the C++ wheels.

@jameslamb
Copy link
Member Author

Great, thank you.

For the other libraries we'll have to remember to set this up correctly when we get around to making the C++ wheels.

Agreed. I'm going to fill out the remaining issues tracking each individual dynamic-wheels thing (e.g. https://github.com/rapidsai/rapids-wheels-planning/issues/66 for cugraph) with details about all the things that need to be done for those issues to be considered "done". Should be pretty straightforward and mostly copy-paste, and hopefully that'll make it easier for anyone to pick up the work.

AFAIK right now we should really only need to make changes to cudf, cuspatial, and kvikio

I think we want ucxx as well... libucxx wheels pull in librmm and libucx wheels at build time (pyproject.toml).

And I think we don't want kvikio, because it isn't actually pulling in any build dependencies via wheels except cmake and ninja (kvikio pyproject.toml).

@vyasr
Copy link
Contributor

vyasr commented Oct 28, 2024

You're right about both ucxx and kvikio, thanks.

rapids-bot bot pushed a commit to rapidsai/cuvs that referenced this issue Oct 29, 2024
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* printing `sccache` stats to CI logs
* reducing `pip`'s verbosity in wheel building scripts
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`
* modifying `dependencies.yaml` to match RAPIDS-wide naming conventions

## Notes for Reviewers

This originally also ran wheel builds with `--no-build-isolation`, but I reverted that based on rapidsai/build-planning#108 (comment).

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

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

URL: #413
rapids-bot bot pushed a commit to rapidsai/cugraph that referenced this issue Oct 30, 2024
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* printing `sccache` stats to CI logs
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`

## Notes for Reviewers

This originally also ran wheel builds with `--no-build-isolation`, but I reverted that based on rapidsai/build-planning#108 (comment).

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

Approvers:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

URL: #4719
rapids-bot bot pushed a commit to rapidsai/ucxx that referenced this issue Oct 31, 2024
Contributes to rapidsai/build-planning#108
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* building `libucxx` wheels with `--no-build-isolation` (for better `sccache` hit rate)
* printing `sccache` stats to CI logs
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`
* moving more one-wheel-specific logic into `build_wheel_{project}.sh` scripts, mimicking how `cudf` has structured its scripts

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

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

URL: #301
rapids-bot bot pushed a commit to rapidsai/cuml that referenced this issue Oct 31, 2024
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* printing `sccache` stats to CI logs
* reducing `pip`'s verbosity in wheel building scripts
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`

## Notes for Reviewers

This originally also ran wheel builds with `--no-build-isolation`, but I reverted that based on rapidsai/build-planning#108 (comment).

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

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

URL: #6111
rapids-bot bot pushed a commit to rapidsai/raft that referenced this issue Oct 31, 2024
Contributes to rapidsai/build-planning#111

Proposes some small packaging/CI changes, matching similar changes being made across RAPIDS.

* printing `sccache` stats to CI logs
* reducing `pip`'s verbosity in wheel building scripts
* updating to the latest `rapids-dependency-file-generator` (v1.16.0)
* always explicitly specifying `cpp` / `python` in calls to `rapids-upload-wheels-to-s3`

## Notes for Reviewers

This originally also ran wheel builds with `--no-build-isolation`, but I reverted that based on rapidsai/build-planning#108 (comment).

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

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

URL: #2470
@jameslamb
Copy link
Member Author

I've added notes about this to the "Approach" sections in all the rest of the C++ wheels issues, so I think this can now be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants