-
Notifications
You must be signed in to change notification settings - Fork 546
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
WIP: [DO NOT MERGE] introduce libcuml wheels #6199
Draft
jameslamb
wants to merge
60
commits into
rapidsai:branch-25.02
Choose a base branch
from
jameslamb:libcuml-wheels
base: branch-25.02
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+866
−212
Draft
Changes from 57 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
e42f3d1
initial libcuml wheel
jameslamb 13db0a9
remove uses of ASSOCIATED_TARGETS, lots of other refactoring
jameslamb f33e5ed
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb 368faea
more changes
jameslamb bbc4742
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb e99a2b7
use static treelite
jameslamb b6eeb73
merge branch-25.02
jameslamb 8082c45
one more merge conflict
jameslamb 8434d77
more fiddling
jameslamb 9bda048
more changes
jameslamb eb14ede
more changes
jameslamb c5d385b
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb 8c1f38d
got importing minimally working
jameslamb 7c09598
use conda packages from RAFT PR
jameslamb c7ad450
pre-commit
jameslamb 8d058e6
copyright
jameslamb cbf26a2
fix scripts
jameslamb dc8a5a4
fix wheel downloads
jameslamb 9773c81
clone cumlprims_mg in CI
jameslamb a56e3d4
fix pins, fix script
jameslamb dba121f
pull in changes from logger targets
jameslamb 2290fb7
more changes
jameslamb e6f4d73
update handling of cumlprims_mg
jameslamb a224fc1
more todo
jameslamb afe7c4f
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb 96b90f3
merge branch-25.02
jameslamb 05f8fbf
start unwinding CPM debugging changes
jameslamb 8f505e3
undo exporting
jameslamb 829d714
add debugging prints, update RAFT commit
jameslamb 8151e62
this is working
jameslamb cae868e
revert some debugging changes
jameslamb def5a4d
use static treelite
jameslamb 9ae5941
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb 83b28d9
bigger pydistcheck threshold, remove cuvs from build env
jameslamb e6cf739
Merge branch 'libcuml-wheels' of github.com:jameslamb/cuml into libcu…
jameslamb 1d5326f
fix validation working dir
jameslamb 2ef32ea
try to fix more builds
jameslamb e35df32
use dynamic treelite in conda builds
jameslamb 7853681
refine build dependencies
jameslamb 7e94d7d
merge branch-25.02
jameslamb ba3387f
more dependency fixes
jameslamb 1f9ac89
fix scripts
jameslamb 82e3f16
update RAFT commit, build cuml without build isolation
jameslamb 53c8b35
try fixing math wheels linkage for CUDA 11
jameslamb 002c0f3
add use_cuda_wheels
jameslamb 35c88ac
fix build_wheel_cuml.sh again
jameslamb 0e62018
try to fix build_wheel_cuml.sh again
jameslamb f5b6590
misc. changes
jameslamb e4c1fad
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb c79617b
rapids_cuda_init_architectures()
jameslamb 57db9f7
Revert libraft testing changes.
bdice e7109c4
simplify CMake
jameslamb e2ae2dc
Merge branch 'libcuml-wheels' of github.com:jameslamb/cuml into libcu…
jameslamb b17f613
fix typo in rapids_cuda_init_architectures
jameslamb 2623cc9
fix SINGLEGPU arg
jameslamb 77c8f14
updates
jameslamb 668e46b
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb 3a02bf5
use libcuvs wheels
jameslamb bd8de88
CUVS_COMMIT
jameslamb 610970a
fix depends_on_libcuvs
jameslamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,15 +66,38 @@ jobs: | |
branch: ${{ inputs.branch }} | ||
date: ${{ inputs.date }} | ||
sha: ${{ inputs.sha }} | ||
wheel-build-libcuml: | ||
secrets: inherit | ||
uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||
with: | ||
build_type: ${{ inputs.build_type || 'branch' }} | ||
branch: ${{ inputs.branch }} | ||
sha: ${{ inputs.sha }} | ||
date: ${{ inputs.date }} | ||
script: ci/build_wheel_libcuml.sh | ||
# build for every combination of arch and CUDA version, but only for the latest Python | ||
matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber))) | ||
wheel-publish-libcuml: | ||
needs: wheel-build-libcuml | ||
secrets: inherit | ||
uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||
with: | ||
build_type: ${{ inputs.build_type || 'branch' }} | ||
branch: ${{ inputs.branch }} | ||
sha: ${{ inputs.sha }} | ||
date: ${{ inputs.date }} | ||
package-name: libcuml | ||
package-type: cpp | ||
wheel-build-cuml: | ||
needs: wheel-build-libcuml | ||
secrets: inherit | ||
uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||
with: | ||
build_type: ${{ inputs.build_type || 'branch' }} | ||
branch: ${{ inputs.branch }} | ||
sha: ${{ inputs.sha }} | ||
date: ${{ inputs.date }} | ||
script: ci/build_wheel.sh | ||
script: ci/build_wheel_cuml.sh | ||
# Note that this approach to cloning repos obviates any modification to | ||
# the CMake variables in get_cumlprims_mg.cmake since CMake will just use | ||
# the clone as is. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
- conda-notebook-tests | ||
- docs-build | ||
- telemetry-setup | ||
- wheel-build-libcuml | ||
- wheel-build-cuml | ||
- wheel-tests-cuml | ||
- devcontainer | ||
|
@@ -166,13 +167,28 @@ jobs: | |
arch: "amd64" | ||
container_image: "rapidsai/ci-conda:latest" | ||
run_script: "ci/build_docs.sh" | ||
wheel-build-cuml: | ||
wheel-build-libcuml: | ||
needs: checks | ||
secrets: inherit | ||
uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||
with: | ||
build_type: pull-request | ||
script: ci/build_wheel.sh | ||
branch: ${{ inputs.branch }} | ||
sha: ${{ inputs.sha }} | ||
date: ${{ inputs.date }} | ||
script: ci/build_wheel_libcuml.sh | ||
extra-repo: rapidsai/cumlprims_mg | ||
extra-repo-sha: branch-25.02 | ||
extra-repo-deploy-key: CUMLPRIMS_SSH_PRIVATE_DEPLOY_KEY | ||
# build for every combination of arch and CUDA version, but only for the latest Python | ||
matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber))) | ||
wheel-build-cuml: | ||
needs: [checks, wheel-build-libcuml] | ||
secrets: inherit | ||
uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||
with: | ||
build_type: pull-request | ||
script: ci/build_wheel_cuml.sh | ||
extra-repo: rapidsai/cumlprims_mg | ||
extra-repo-sha: branch-25.02 | ||
extra-repo-deploy-key: CUMLPRIMS_SSH_PRIVATE_DEPLOY_KEY | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,26 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023-2024, NVIDIA CORPORATION. | ||
# Copyright (c) 2023-2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_dir="python/cuml" | ||
package_name=$1 | ||
package_dir=$2 | ||
|
||
source rapids-configure-sccache | ||
source rapids-date-string | ||
|
||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
rapids-generate-version > ./VERSION | ||
|
||
cd ${package_dir} | ||
|
||
case "${RAPIDS_CUDA_VERSION}" in | ||
12.*) | ||
EXCLUDE_ARGS=( | ||
--exclude "libcuvs.so" | ||
--exclude "libcublas.so.12" | ||
--exclude "libcublasLt.so.12" | ||
--exclude "libcufft.so.11" | ||
--exclude "libcurand.so.10" | ||
--exclude "libcusolver.so.11" | ||
--exclude "libcusparse.so.12" | ||
--exclude "libnvJitLink.so.12" | ||
) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=ON" | ||
;; | ||
11.*) | ||
EXCLUDE_ARGS=( | ||
--exclude "libcuvs.so" | ||
) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=OFF" | ||
;; | ||
esac | ||
cd "${package_dir}" | ||
|
||
sccache --zero-stats | ||
|
||
SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/;-DUSE_CUVS_WHEEL=ON${EXTRA_CMAKE_ARGS}" \ | ||
python -m pip wheel . \ | ||
rapids-logger "Building '${package_name}' wheel" | ||
python -m pip wheel \ | ||
-w dist \ | ||
-v \ | ||
--no-deps \ | ||
--disable-pip-version-check | ||
--disable-pip-version-check \ | ||
. | ||
|
||
sccache --show-adv-stats | ||
|
||
mkdir -p final_dist | ||
python -m auditwheel repair -w final_dist "${EXCLUDE_ARGS[@]}" dist/* | ||
|
||
../../ci/validate_wheel.sh final_dist | ||
|
||
RAPIDS_PY_WHEEL_NAME="cuml_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 python final_dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023-2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_name="cuml" | ||
package_dir="python/cuml" | ||
|
||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
# Download the libcuml wheel built in the previous step and make it | ||
# available for pip to find. | ||
RAPIDS_PY_WHEEL_NAME="libcuml_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/libcuml_dist | ||
|
||
rapids-logger "Generating build requirements" | ||
|
||
rapids-dependency-file-generator \ | ||
--output requirements \ | ||
--file-key "py_build_${package_name}" \ | ||
--file-key "py_rapids_build_${package_name}" \ | ||
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};cuda_suffixed=true" \ | ||
| tee /tmp/requirements-build.txt | ||
|
||
rapids-logger "Installing build requirements" | ||
python -m pip install \ | ||
-v \ | ||
--prefer-binary \ | ||
-r /tmp/requirements-build.txt \ | ||
/tmp/libcuml_dist/libcuml_*.whl | ||
|
||
# build with '--no-build-isolation', for better sccache hit rate | ||
# 0 really means "add --no-build-isolation" (ref: https://github.com/pypa/pip/issues/5735) | ||
export PIP_NO_BUILD_ISOLATION=0 | ||
|
||
EXCLUDE_ARGS=( | ||
--exclude "libcuml++.so" | ||
--exclude "libcumlprims_mg.so" | ||
--exclude "libcuvs.so" | ||
) | ||
|
||
case "${RAPIDS_CUDA_VERSION}" in | ||
12.*) | ||
EXCLUDE_ARGS+=( | ||
--exclude "libcublas.so.12" | ||
--exclude "libcublasLt.so.12" | ||
--exclude "libcufft.so.11" | ||
--exclude "libcurand.so.10" | ||
--exclude "libcusolver.so.11" | ||
--exclude "libcusparse.so.12" | ||
--exclude "libnvJitLink.so.12" | ||
) | ||
EXTRA_CMAKE_ARGS="-DUSE_CUDA_MATH_WHEELS=ON" | ||
;; | ||
11.*) | ||
EXTRA_CMAKE_ARGS="-DUSE_CUDA_MATH_WHEELS=OFF" | ||
;; | ||
esac | ||
|
||
export SKBUILD_CMAKE_ARGS="-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/;${EXTRA_CMAKE_ARGS};-DSINGLEGPU=OFF;-DUSE_LIBCUML_WHEEL=ON" | ||
./ci/build_wheel.sh "${package_name}" "${package_dir}" | ||
|
||
mkdir -p ${package_dir}/final_dist | ||
python -m auditwheel repair \ | ||
"${EXCLUDE_ARGS[@]}" \ | ||
-w ${package_dir}/final_dist \ | ||
${package_dir}/dist/* | ||
|
||
./ci/validate_wheel.sh ${package_dir} final_dist | ||
|
||
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 python "${package_dir}/final_dist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_name="libcuml" | ||
package_dir="python/libcuml" | ||
|
||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
rapids-logger "Generating build requirements" | ||
|
||
rapids-dependency-file-generator \ | ||
--output requirements \ | ||
--file-key "py_build_${package_name}" \ | ||
--file-key "py_rapids_build_${package_name}" \ | ||
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};cuda_suffixed=true" \ | ||
| tee /tmp/requirements-build.txt | ||
|
||
rapids-logger "Installing build requirements" | ||
python -m pip install \ | ||
-v \ | ||
--prefer-binary \ | ||
-r /tmp/requirements-build.txt | ||
|
||
# build with '--no-build-isolation', for better sccache hit rate | ||
# 0 really means "add --no-build-isolation" (ref: https://github.com/pypa/pip/issues/5735) | ||
export PIP_NO_BUILD_ISOLATION=0 | ||
|
||
# NOTE: 'libcumlprims_mg.so' is marked as '--exclude' here because auditwheel doesn't detect it, | ||
# but it really is intentionally included in 'libcuml' wheels | ||
EXCLUDE_ARGS=( | ||
--exclude "libcumlprims_mg.so" | ||
--exclude "libcuvs.so" | ||
--exclude "libraft.so" | ||
) | ||
|
||
# Avoid ever vendoring CUDA libraries into wheels. | ||
# | ||
# On CUDA 11 builds these excludes should technically be unnecessary because | ||
# there cuml and its dependencies statically link again these libraries, but | ||
# this is here unconditionally to ensure those wheels don't accidentally pick up | ||
# these libraries transitively. | ||
EXCLUDE_ARGS+=( | ||
--exclude "libcublas.so.12" | ||
--exclude "libcublasLt.so.12" | ||
--exclude "libcufft.so.11" | ||
--exclude "libcurand.so.10" | ||
--exclude "libcusolver.so.11" | ||
--exclude "libcusparse.so.12" | ||
--exclude "libnvJitLink.so.12" | ||
) | ||
|
||
case "${RAPIDS_CUDA_VERSION}" in | ||
12.*) | ||
EXTRA_CMAKE_ARGS="-DUSE_CUDA_MATH_WHEELS=ON" | ||
;; | ||
11.*) | ||
EXTRA_CMAKE_ARGS="-DUSE_CUDA_MATH_WHEELS=OFF" | ||
;; | ||
esac | ||
|
||
export SKBUILD_CMAKE_ARGS="-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/;${EXTRA_CMAKE_ARGS}" | ||
./ci/build_wheel.sh "${package_name}" "${package_dir}" | ||
|
||
mkdir -p ${package_dir}/final_dist | ||
python -m auditwheel repair \ | ||
"${EXCLUDE_ARGS[@]}" \ | ||
-w ${package_dir}/final_dist \ | ||
${package_dir}/dist/* | ||
|
||
./ci/validate_wheel.sh ${package_dir} final_dist | ||
|
||
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 cpp "${package_dir}/final_dist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found the root cause yet, but the CUDA 11
cuml
wheels being produced on this branch are a lot bigger than I'd expect.Suspect it's related to static linking against the CUDA math wheels, but I'm surprised that the difference could be so large for these Cython extensions.
For context, the Cython extension sizes don't really same to vary much by CUDA version on latest
branch-25.02
:It's just
libcuml++.so
driving the big difference in total size onbranch-25.02
.CUDA 11.8.0, arm64, Python 3.11
(build link)
CUDA 12.5.1, arm64, Python 3.11
(build link)