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

WIP: [DO NOT MERGE] introduce libcuml wheels #6199

Draft
wants to merge 60 commits into
base: branch-25.02
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e42f3d1
initial libcuml wheel
jameslamb Dec 24, 2024
13db0a9
remove uses of ASSOCIATED_TARGETS, lots of other refactoring
jameslamb Dec 30, 2024
f33e5ed
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb Dec 30, 2024
368faea
more changes
jameslamb Dec 31, 2024
bbc4742
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb Dec 31, 2024
e99a2b7
use static treelite
jameslamb Dec 31, 2024
b6eeb73
merge branch-25.02
jameslamb Dec 31, 2024
8082c45
one more merge conflict
jameslamb Dec 31, 2024
8434d77
more fiddling
jameslamb Jan 2, 2025
9bda048
more changes
jameslamb Jan 2, 2025
eb14ede
more changes
jameslamb Jan 6, 2025
c5d385b
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb Jan 6, 2025
8c1f38d
got importing minimally working
jameslamb Jan 6, 2025
7c09598
use conda packages from RAFT PR
jameslamb Jan 6, 2025
c7ad450
pre-commit
jameslamb Jan 6, 2025
8d058e6
copyright
jameslamb Jan 6, 2025
cbf26a2
fix scripts
jameslamb Jan 6, 2025
dc8a5a4
fix wheel downloads
jameslamb Jan 7, 2025
9773c81
clone cumlprims_mg in CI
jameslamb Jan 7, 2025
a56e3d4
fix pins, fix script
jameslamb Jan 7, 2025
dba121f
pull in changes from logger targets
jameslamb Jan 8, 2025
2290fb7
more changes
jameslamb Jan 9, 2025
e6f4d73
update handling of cumlprims_mg
jameslamb Jan 9, 2025
a224fc1
more todo
jameslamb Jan 9, 2025
afe7c4f
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb Jan 9, 2025
96b90f3
merge branch-25.02
jameslamb Jan 10, 2025
05f8fbf
start unwinding CPM debugging changes
jameslamb Jan 10, 2025
8f505e3
undo exporting
jameslamb Jan 10, 2025
829d714
add debugging prints, update RAFT commit
jameslamb Jan 13, 2025
8151e62
this is working
jameslamb Jan 13, 2025
cae868e
revert some debugging changes
jameslamb Jan 13, 2025
def5a4d
use static treelite
jameslamb Jan 13, 2025
9ae5941
Merge branch 'branch-25.02' into libcuml-wheels
jameslamb Jan 13, 2025
83b28d9
bigger pydistcheck threshold, remove cuvs from build env
jameslamb Jan 13, 2025
e6cf739
Merge branch 'libcuml-wheels' of github.com:jameslamb/cuml into libcu…
jameslamb Jan 13, 2025
1d5326f
fix validation working dir
jameslamb Jan 13, 2025
2ef32ea
try to fix more builds
jameslamb Jan 13, 2025
e35df32
use dynamic treelite in conda builds
jameslamb Jan 13, 2025
7853681
refine build dependencies
jameslamb Jan 14, 2025
7e94d7d
merge branch-25.02
jameslamb Jan 14, 2025
ba3387f
more dependency fixes
jameslamb Jan 14, 2025
1f9ac89
fix scripts
jameslamb Jan 14, 2025
82e3f16
update RAFT commit, build cuml without build isolation
jameslamb Jan 14, 2025
53c8b35
try fixing math wheels linkage for CUDA 11
jameslamb Jan 14, 2025
002c0f3
add use_cuda_wheels
jameslamb Jan 14, 2025
35c88ac
fix build_wheel_cuml.sh again
jameslamb Jan 14, 2025
0e62018
try to fix build_wheel_cuml.sh again
jameslamb Jan 14, 2025
f5b6590
misc. changes
jameslamb Jan 16, 2025
e4c1fad
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb Jan 16, 2025
c79617b
rapids_cuda_init_architectures()
jameslamb Jan 16, 2025
57db9f7
Revert libraft testing changes.
bdice Jan 17, 2025
e7109c4
simplify CMake
jameslamb Jan 17, 2025
e2ae2dc
Merge branch 'libcuml-wheels' of github.com:jameslamb/cuml into libcu…
jameslamb Jan 17, 2025
b17f613
fix typo in rapids_cuda_init_architectures
jameslamb Jan 17, 2025
2623cc9
fix SINGLEGPU arg
jameslamb Jan 17, 2025
77c8f14
updates
jameslamb Jan 17, 2025
668e46b
Merge branch 'branch-25.02' of github.com:rapidsai/cuml into libcuml-…
jameslamb Jan 17, 2025
3a02bf5
use libcuvs wheels
jameslamb Jan 21, 2025
bd8de88
CUVS_COMMIT
jameslamb Jan 21, 2025
610970a
fix depends_on_libcuvs
jameslamb Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- conda-notebook-tests
- docs-build
- telemetry-setup
- wheel-build-libcuml
- wheel-build-cuml
- wheel-tests-cuml
- devcontainer
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019-2024, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.

# cuml build script

Expand Down Expand Up @@ -288,11 +288,6 @@ if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs
# Replace spaces with semicolons in SKBUILD_EXTRA_CMAKE_ARGS
SKBUILD_EXTRA_CMAKE_ARGS=$(echo ${SKBUILD_EXTRA_CMAKE_ARGS} | sed 's/ /;/g')

# Append `-DFIND_CUML_CPP=ON` to CUML_EXTRA_CMAKE_ARGS unless a user specified the option.
if [[ "${SKBUILD_EXTRA_CMAKE_ARGS}" != *"DFIND_CUML_CPP"* ]]; then
SKBUILD_EXTRA_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS};-DFIND_CUML_CPP=ON"
fi

SKBUILD_CMAKE_ARGS="-DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL};${SKBUILD_EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true ${REPODIR}/python/cuml

Expand Down
5 changes: 4 additions & 1 deletion ci/build_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -9,6 +9,9 @@ source rapids-configure-sccache

source rapids-date-string

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ci/use_conda_packages_from_prs.sh

export CMAKE_GENERATOR=Ninja

rapids-print-env
Expand Down
5 changes: 4 additions & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.
set -euo pipefail

rapids-logger "Create test conda environment"
. /opt/conda/etc/profile.d/conda.sh

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ci/use_conda_packages_from_prs.sh

RAPIDS_VERSION="$(rapids-version)"
export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"

Expand Down
5 changes: 4 additions & 1 deletion ci/build_python.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -9,6 +9,9 @@ source rapids-configure-sccache

source rapids-date-string

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ci/use_conda_packages_from_prs.sh

export CMAKE_GENERATOR=Ninja

rapids-print-env
Expand Down
45 changes: 8 additions & 37 deletions ci/build_wheel.sh
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
73 changes: 73 additions & 0 deletions ci/build_wheel_cuml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

set -euo pipefail

package_name="cuml"
package_dir="python/cuml"

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ./ci/use_wheels_from_prs.sh

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"
77 changes: 77 additions & 0 deletions ci/build_wheel_libcuml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
# Copyright (c) 2025, NVIDIA CORPORATION.

set -euo pipefail

package_name="libcuml"
package_dir="python/libcuml"

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ./ci/use_wheels_from_prs.sh

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"
5 changes: 4 additions & 1 deletion ci/test_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -8,6 +8,9 @@ cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../

. /opt/conda/etc/profile.d/conda.sh

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ci/use_conda_packages_from_prs.sh

rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)

Expand Down
5 changes: 4 additions & 1 deletion ci/test_notebooks.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
set -euo pipefail

. /opt/conda/etc/profile.d/conda.sh

# TODO(jameslamb): remove this when https://github.com/rapidsai/raft/pull/2531 is merged
source ci/use_conda_packages_from_prs.sh

rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)
Expand Down
Loading
Loading