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

Use rapids-build-backend #5804

Merged
merged 62 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1008a77
Use rapids-build-backend
KyleFromNVIDIA Mar 14, 2024
f6171d9
Fix build_wheel.sh
KyleFromNVIDIA Mar 14, 2024
0f0ddd6
Fix build_wheel.sh
KyleFromNVIDIA Mar 14, 2024
58ec8e4
Fix devcontainers
KyleFromNVIDIA Mar 14, 2024
f046ba8
Fix devcontainers
KyleFromNVIDIA Mar 14, 2024
66e117a
Fix build.sh
KyleFromNVIDIA Mar 14, 2024
5cd19ec
Fix dependencies
KyleFromNVIDIA Mar 14, 2024
d9be176
Fix dependencies
KyleFromNVIDIA Mar 14, 2024
8bfa5f2
Fix dependencies
KyleFromNVIDIA Mar 14, 2024
fcb2a7d
Fix dependencies
KyleFromNVIDIA Mar 15, 2024
071b186
Fix meta.yaml
KyleFromNVIDIA Mar 15, 2024
1c0db89
Fix meta.yaml
KyleFromNVIDIA Mar 15, 2024
5ed005e
Merge branch 'branch-24.04' into rapids-build-backend
KyleFromNVIDIA Mar 15, 2024
531b274
Merge remote-tracking branch 'github/origin/branch-24.06' into rapids…
KyleFromNVIDIA Mar 19, 2024
cff5de7
rapids-build-backend packages are now available
KyleFromNVIDIA Mar 19, 2024
924c8e1
Add rapids-build-backend to conda recipes
KyleFromNVIDIA Mar 19, 2024
d6175e8
Merge branch 'branch-24.06' into rapids-build-backend
KyleFromNVIDIA Mar 19, 2024
1608bb8
Merge branch 'branch-24.06' into rapids-build-backend
bdice Mar 20, 2024
e21e86f
Revert "Add rapids-build-backend to conda recipes"
KyleFromNVIDIA Mar 26, 2024
e73ef62
Revert "rapids-build-backend packages are now available"
KyleFromNVIDIA Mar 26, 2024
a7ae5ee
Use the use-dfg branch of rbb
KyleFromNVIDIA Mar 26, 2024
90bf7b2
Set dependencies-file
KyleFromNVIDIA Mar 26, 2024
15c3214
Use DFG's pyproject matrix capabilities
KyleFromNVIDIA Mar 26, 2024
204ac93
pip install instead of pip wheel
KyleFromNVIDIA Mar 26, 2024
8a10d22
Revert "pip install instead of pip wheel"
KyleFromNVIDIA Mar 26, 2024
907a908
Add alpha version specifiers
KyleFromNVIDIA Mar 26, 2024
81278a5
Remove unneeded variable
KyleFromNVIDIA Mar 26, 2024
4004adb
Update dask-cuda dependency
KyleFromNVIDIA Mar 27, 2024
96a7728
Update rapids-dask-dependency
KyleFromNVIDIA Mar 27, 2024
24f9c44
Update rmm dependency
KyleFromNVIDIA Mar 27, 2024
18f04f4
Add temporary DFG dependency
KyleFromNVIDIA Mar 27, 2024
45f0136
Fix conda recipe dependencies
KyleFromNVIDIA Mar 27, 2024
63b1762
Merge branch 'branch-24.06' into rapids-build-backend
KyleFromNVIDIA Apr 24, 2024
2dc7853
Forcefully bump RBB version
KyleFromNVIDIA Apr 24, 2024
41d9a55
Bump version in more places
KyleFromNVIDIA Apr 24, 2024
58def44
Merge branch 'branch-24.06' into rapids-build-backend
KyleFromNVIDIA Apr 25, 2024
424ce9b
Review feedback
KyleFromNVIDIA May 1, 2024
dd76a0a
Merge branch 'branch-24.06' into rapids-build-backend
KyleFromNVIDIA May 1, 2024
ff267f7
Use main branch of RBB
KyleFromNVIDIA May 3, 2024
8d7b562
Add back fake dependencies
KyleFromNVIDIA May 8, 2024
b42e17c
Read VERSION and GIT_COMMIT relative to __package__
KyleFromNVIDIA May 9, 2024
c807146
Use published rapids-build-backend packages
KyleFromNVIDIA May 9, 2024
b7bac94
Don't depend on RBB in conda
KyleFromNVIDIA May 9, 2024
0b6eec9
Add rapids-build-backend back to Conda
KyleFromNVIDIA May 13, 2024
52a3e16
Update for RBB 0.2.0
KyleFromNVIDIA May 15, 2024
d147f5b
Update RBB version
KyleFromNVIDIA May 16, 2024
c211478
Merge branch 'branch-24.08' into rapids-build-backend
KyleFromNVIDIA May 21, 2024
42c5abe
Add alpha specifiers everywhere
KyleFromNVIDIA May 21, 2024
fe50181
disable-cuda
KyleFromNVIDIA May 22, 2024
9f815dd
config-setting
KyleFromNVIDIA May 22, 2024
ebdea8f
Update RBB to version 0.3.0
KyleFromNVIDIA May 23, 2024
cc459cd
Pipe rapids-generate-version directly to VERSION
KyleFromNVIDIA May 23, 2024
7de358b
Merge branch 'branch-24.08' into rapids-build-backend
KyleFromNVIDIA May 23, 2024
c19f2bf
Merge branch 'branch-24.08' into rapids-build-backend
KyleFromNVIDIA May 24, 2024
260a5c2
s/--config-setting/--config-settings/
KyleFromNVIDIA May 24, 2024
167bb34
Test cuml._version
KyleFromNVIDIA May 29, 2024
4cd072a
cupy does not require alpha spec
KyleFromNVIDIA May 29, 2024
c66b832
Update DFG, reorder dependencies
KyleFromNVIDIA May 30, 2024
b3a7550
Update dependencies.yaml
jameslamb May 31, 2024
3256ff4
Update ci/build_wheel.sh
jameslamb May 31, 2024
29911b6
consolidate version informatin in build scripts
jameslamb May 31, 2024
351b0e0
Merge branch 'branch-24.08' into rapids-build-backend
jameslamb Jun 4, 2024
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
8 changes: 8 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ jobs:
cuda: '["12.2"]'
extra-repo-deploy-key: CUMLPRIMS_SSH_PRIVATE_DEPLOY_KEY
build_command: |
# For testing, will be removed when the package is released
git clone -b use-dfg https://github.com/KyleFromNVIDIA/rapids-build-backend.git
pushd rapids-build-backend
sed -e 's/^version =.*/version = "0.0.2"/' -i pyproject.toml
python -m pip install .
popd
export PIP_FIND_LINKS="file://${PWD}/rapids-build-backend"

sccache -z;
build-all --verbose;
sccache -s;
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ repos:
pass_filenames: false
language: python
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.8.0
rev: v1.11.0
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ if (( ${CLEAN} == 1 )); then
fi


# For testing, will be removed when the package is released
git clone -b use-dfg https://github.com/KyleFromNVIDIA/rapids-build-backend.git
pushd rapids-build-backend
sed -e 's/^version =.*/version = "0.0.2"/' -i pyproject.toml
python -m pip install .
popd

################################################################################
# Configure for building all C++ targets
if completeBuild || hasArg libcuml || hasArg prims || hasArg bench || hasArg prims-bench || hasArg cppdocs || hasArg cpp-mgtests; then
Expand Down
7 changes: 1 addition & 6 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -13,15 +13,10 @@ export CMAKE_GENERATOR=Ninja

rapids-print-env

package_name="cuml"
package_dir="python"

version=$(rapids-generate-version)
git_commit=$(git rev-parse HEAD)
export RAPIDS_PACKAGE_VERSION=${version}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We changed up how this works for some other packages, to something like rapids-generate-version > ./VERSION. Does this need a similar change?

e.g. https://github.com/rapidsai/cudf/blob/branch-24.08/ci/build_python.sh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think so, you're right. I'll change that here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed 29911b6 doing that.

Made a similar change in build_cpp.sh as well (which doesn't need the version to be written to the VERSION file).


echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/_version.py"

rapids-logger "Begin py build"

Expand Down
39 changes: 9 additions & 30 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -10,46 +10,25 @@ source rapids-configure-sccache
source rapids-date-string

version=$(rapids-generate-version)
git_commit=$(git rev-parse HEAD)

RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"

# This is the version of the suffix with a preceding hyphen. It's used
# everywhere except in the final wheel name.
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"

# Patch project metadata files to include the CUDA version suffix and version override.
pyproject_file="${package_dir}/pyproject.toml"

sed -i "/^name.*cuml/ s/= \"cuml\"/= \"cuml${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
echo "${version}" > VERSION
sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/_version.py"

# For nightlies we want to ensure that we're pulling in alphas as well. The
# easiest way to do so is to augment the spec with a constraint containing a
# min alpha version that doesn't affect the version bounds but does allow usage
# of alpha versions for that dependency without --pre
alpha_spec=''
if ! rapids-is-release-build; then
alpha_spec=',>=0.0.0a0'
fi

for dep in cudf pylibraft raft-dask rmm; do
sed -r -i "s/${dep}==(.*)\"/${dep}${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file}
done

for dep in dask-cuda rapids-dask-dependency; do
sed -r -i "s/${dep}==(.*)\"/${dep}==\1${alpha_spec}\"/g" ${pyproject_file}
done

if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then
sed -i "s/cuda-python[<=>\.,0-9]*/cuda-python>=12.0,<13.0/g" ${pyproject_file}
sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file}
fi

cd ${package_dir}

SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/" \
# For testing, will be removed when the package is released
git clone -b use-dfg https://github.com/KyleFromNVIDIA/rapids-build-backend.git
pushd rapids-build-backend
sed -e 's/^version =.*/version = "0.0.2"/' -i pyproject.toml
python -m pip wheel . --no-deps
popd

KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
PIP_FIND_LINKS="$PWD/rapids-build-backend" SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/" \
python -m pip wheel . \
-w dist \
-vvv \
Expand Down
7 changes: 7 additions & 0 deletions conda/recipes/cuml-cpu/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ requirements:
- setuptools
- scikit-build-core >=0.7.0
- cython>=3.0.0
# TODO: Add rapids-build-backend once the package exists. Then we can remove dependencies up to the next TODO.
#- rapids-build-backend
- tomli
- tomli-w
- packaging
- rapids-dependency-file-generator
# TODO: Remove above dependencies after rapids-build-backend packages exist
run:
- python x.x
- numpy>=1.23,<2.0a0
Expand Down
7 changes: 7 additions & 0 deletions conda/recipes/cuml/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ requirements:
- scikit-build-core >=0.7.0
- setuptools
- treelite {{ treelite_version }}
# TODO: Add rapids-build-backend once the package exists. Then we can remove dependencies up to the next TODO.
#- rapids-build-backend
- tomli
- tomli-w
- packaging
- rapids-dependency-file-generator
# TODO: Remove above dependencies after rapids-build-backend packages exist
run:
- {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
{% if cuda_major == "11" %}
Expand Down
73 changes: 45 additions & 28 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ files:
- py_build
- py_run
- py_version
- rapids_build_backend
- test_python
cpp_all:
output: conda
Expand Down Expand Up @@ -69,6 +70,13 @@ files:
output: pyproject
extras:
table: build-system
includes:
- rapids_build_backend
py_rapids_build:
output: pyproject
extras:
table: tool.rapids-build-backend
key: requires
includes:
- common_build
- py_build
Expand All @@ -92,6 +100,17 @@ channels:
- conda-forge
- nvidia
dependencies:
rapids_build_backend:
common:
- output_types: [pyproject] # TODO: Enable requirements once packages are available
packages:
- rapids-build-backend
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.7.0
- output_types: [conda]
packages:
- scikit-build-core>=0.7.0
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
checks:
common:
- output_types: [conda, requirements]
Expand Down Expand Up @@ -159,54 +178,54 @@ dependencies:
packages:
- &pylibraft_conda pylibraft==24.6.*
- &rmm_conda rmm==24.6.*
- scikit-build-core>=0.7.0
- output_types: requirements
packages:
# pip recognizes the index as a global option for the requirements.txt file
# This index is needed for cudf and rmm.
- --extra-index-url=https://pypi.nvidia.com
- --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple
- output_types: [pyproject, requirements]
packages:
- scikit-build-core[pyproject]>=0.7.0
specific:
- output_types: [conda, requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
packages:
- cuda-python>=12.0,<13.0a0
- matrix: # All CUDA 11 versions
- matrix:
cuda: "11.*"
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
packages:
- cuda-python>=11.7.1,<12.0a0
- matrix:
packages:
- output_types: [requirements, pyproject]
matrices:
- matrix: {cuda: "12.*"}
packages:
- pylibraft-cu12==24.6.*
- rmm-cu12==24.6.*
- pylibraft-cu12==24.6.*,>=0.0.0a0
- rmm-cu12==24.6.*,>=0.0.0a0
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
- matrix: {cuda: "11.*"}
packages:
- &pylibraft_cu11 pylibraft-cu11==24.6.*
- &rmm_cu11 rmm-cu11==24.6.*
- {matrix: null, packages: [*pylibraft_conda, *rmm_conda] }
- &pylibraft_cu11 pylibraft-cu11==24.6.*,>=0.0.0a0
- &rmm_cu11 rmm-cu11==24.6.*,>=0.0.0a0
- matrix:
packages:

py_run:
common:
- output_types: [conda, requirements, pyproject]
packages:
- dask-cuda==24.6.*
- joblib>=0.11
- numba>=0.57
# TODO: Is scipy really a hard dependency, or should
# we make it optional (i.e. an extra for pip
# installation/run_constrained for conda)?
- scipy>=1.8.0
- packaging
- rapids-dask-dependency==24.6.*
- *treelite
- output_types: conda
packages:
- dask-cuda==24.6.*
- rapids-dask-dependency==24.6.*
- &cudf_conda cudf==24.6.*
- &cupy_conda cupy>=12.0.0
- &dask_cudf_conda dask-cudf==24.6.*
Expand All @@ -217,33 +236,31 @@ dependencies:
# This index is needed for cudf and rmm.
- --extra-index-url=https://pypi.nvidia.com
- --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple
- output_types: [requirements, pyproject]
packages:
- dask-cuda==24.6.*,>=0.0.0a0
- rapids-dask-dependency==24.6.*,>=0.0.0a0
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
specific:
- output_types: [requirements, pyproject]
matrices:
- matrix: {cuda: "12.*"}
packages:
- cudf-cu12==24.6.*
- cudf-cu12==24.6.*,>=0.0.0a0
- cupy-cuda12x>=12.0.0
- dask-cudf-cu12==24.6.*
- pylibraft-cu12==24.6.*
- raft-dask-cu12==24.6.*
- rmm-cu12==24.6.*
- dask-cudf-cu12==24.6.*,>=0.0.0a0
- pylibraft-cu12==24.6.*,>=0.0.0a0
- raft-dask-cu12==24.6.*,>=0.0.0a0
- rmm-cu12==24.6.*,>=0.0.0a0
- matrix: {cuda: "11.*"}
packages: &py_run_packages_cu11
- cudf-cu11==24.6.*
- &cupy_pyproject_cu11 cupy-cuda11x>=12.0.0
- dask-cudf-cu11==24.6.*
- cudf-cu11==24.6.*,>=0.0.0a0
- &cupy_pyproject_cu11 cupy-cuda11x>=12.0.0,>=0.0.0a0
- dask-cudf-cu11==24.6.*,>=0.0.0a0
- *pylibraft_cu11
- raft-dask-cu11==24.6.*
- raft-dask-cu11==24.6.*,>=0.0.0a0
- *rmm_cu11
- matrix: null
- matrix:
packages:
- *cudf_conda
- *cupy_pyproject_cu11
- *dask_cudf_conda
- *pylibraft_conda
- *raft_dask_conda
- *rmm_conda
cuda_version:
specific:
- output_types: conda
Expand Down
7 changes: 5 additions & 2 deletions python/cuml/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,4 +18,7 @@
__version__ = (
importlib.resources.files("cuml").joinpath("VERSION").read_text().strip()
)
__git_commit__ = ""
try:
__git_commit__ = importlib.resources.files("cuml").joinpath("GIT_COMMIT").read_text().strip()
except FileNotFoundError:
__git_commit__ = ""
31 changes: 15 additions & 16 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@

[build-system]
requires = [
"cmake>=3.26.4",
"cuda-python>=11.7.1,<12.0a0",
"cython>=3.0.0",
"ninja",
"pylibraft==24.6.*",
"rmm==24.6.*",
"rapids-build-backend",
"scikit-build-core[pyproject]>=0.7.0",
"treelite==4.1.2",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
build-backend = "scikit_build_core.build"
build-backend = "rapids_build_backend.build"

[tool.pytest.ini_options]
markers = [
Expand Down Expand Up @@ -55,17 +49,11 @@ authors = [
license = { text = "Apache 2.0" }
requires-python = ">=3.9"
dependencies = [
"cudf==24.6.*",
"cupy-cuda11x>=12.0.0",
"dask-cuda==24.6.*",
"dask-cudf==24.6.*",
"dask-cuda==24.6.*,>=0.0.0a0",
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
"joblib>=0.11",
"numba>=0.57",
"packaging",
"pylibraft==24.6.*",
"raft-dask==24.6.*",
"rapids-dask-dependency==24.6.*",
"rmm==24.6.*",
"rapids-dask-dependency==24.6.*,>=0.0.0a0",
"scipy>=1.8.0",
"treelite==4.1.2",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
Expand Down Expand Up @@ -125,6 +113,17 @@ versioneer\.py |
)/
'''

[tool.rapids-build-backend]
build-backend = "scikit_build_core.build"
requires = [
"cmake>=3.26.4",
"cython>=3.0.0",
"ninja",
"treelite==4.1.2",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
commit-file = "cuml/GIT_COMMIT"
dependencies-file = "../dependencies.yaml"

[tool.scikit-build]
build-dir = "build/{wheel_tag}"
cmake.build-type = "Release"
Expand Down
Loading