Skip to content

Commit

Permalink
Switch to scikit-build-core
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Dec 12, 2023
1 parent 3dfdb6e commit 122b7f0
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 145 deletions.
13 changes: 7 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,15 @@ fi

# Build and (optionally) install the cuml Python package
if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs); then
# 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.
SKBUILD_EXTRA_CMAKE_ARGS="${CUML_EXTRA_CMAKE_ARGS}"
if [[ "${CUML_EXTRA_CMAKE_ARGS}" != *"DFIND_CUML_CPP"* ]]; then
SKBUILD_EXTRA_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS} -DFIND_CUML_CPP=ON"
if [[ "${SKBUILD_EXTRA_CMAKE_ARGS}" != *"DFIND_CUML_CPP"* ]]; then
SKBUILD_EXTRA_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS};-DFIND_CUML_CPP=ON"
fi

SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} ${SKBUILD_EXTRA_CMAKE_ARGS}" \
SKBUILD_CMAKE_ARGS="-DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL};${SKBUILD_EXTRA_CMAKE_ARGS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
python -m pip install --no-build-isolation --no-deps ${REPODIR}/python

Expand All @@ -297,7 +299,6 @@ if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs
fi

if hasArg cuml-cpu; then
SKBUILD_CONFIGURE_OPTIONS="-DCUML_CPU=ON -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
SKBUILD_CMAKE_ARGS="-DCUML_CPU=ON;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE" \
python -m pip install --no-build-isolation --no-deps -v ${REPODIR}/python
fi
2 changes: 1 addition & 1 deletion ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi

cd ${package_dir}

SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DDISABLE_DEPRECATION_WARNINGS=ON -DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/" \
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
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn==1.2
- scipy>=1.8.0
- seaborn
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-120_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn==1.2
- scipy>=1.8.0
- seaborn
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cuml-cpu/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ requirements:
host:
- python x.x
- setuptools
- scikit-build>=0.13.1
- scikit-build-core >=0.7.0
- cython>=3.0.0
run:
- python x.x
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cuml/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ requirements:
- pylibraft ={{ minor_version }}
- python x.x
- raft-dask ={{ minor_version }}
- scikit-build >=0.13.1
- scikit-build-core >=0.7.0
- setuptools
- treelite {{ treelite_version }}
run:
Expand Down
5 changes: 2 additions & 3 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- scikit-build>=0.13.1
- cython>=3.0.0
- &treelite treelite==3.9.1
- output_types: conda
packages:
- &pylibraft_conda pylibraft==24.2.*
- &rmm_conda rmm==24.2.*
- scikit-build-core>=0.7.0
- output_types: requirements
packages:
# pip recognizes the index as a global option for the requirements.txt file
Expand All @@ -166,8 +166,7 @@ dependencies:
- --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple
- output_types: [pyproject, requirements]
packages:
- wheel
- setuptools
- scikit-build-core[pyproject]>=0.7.0
- &treelite_runtime treelite_runtime==3.9.1
specific:
- output_types: [conda, requirements, pyproject]
Expand Down
10 changes: 3 additions & 7 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include(../fetch_rapids.cmake)
set(CUML_VERSION 24.02.00)

option(CUML_CPU "Build only cuML CPU Python components." OFF)
set(language_list "C;CXX")
set(language_list "CXX")

if(NOT CUML_CPU)
# We always need CUDA for cuML GPU because the raft dependency brings in a
Expand All @@ -32,11 +32,7 @@ endif()
project(
cuml-python
VERSION ${CUML_VERSION}
LANGUAGES # TODO: Building Python extension modules via the python_extension_module requires the C
# language to be enabled here. The test project that is built in scikit-build to verify
# various linking options for the python library is hardcoded to build with C, so until
# that is fixed we need to keep C.
${language_list}
LANGUAGES ${language_list}
)

################################################################################
Expand Down Expand Up @@ -75,7 +71,7 @@ else()
set(cuml_FOUND OFF)
endif()

include(rapids-cython)
include(rapids-cython-core)

set(CUML_PYTHON_TREELITE_TARGET treelite::treelite)

Expand Down
25 changes: 15 additions & 10 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ requires = [
"ninja",
"pylibraft==24.2.*",
"rmm==24.2.*",
"scikit-build>=0.13.1",
"setuptools",
"scikit-build-core[pyproject]>=0.7.0",
"treelite==3.9.1",
"treelite_runtime==3.9.1",
"wheel",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
build-backend = "setuptools.build_meta"
build-backend = "scikit_build_core.build"

[tool.pytest.ini_options]
markers = [
Expand Down Expand Up @@ -102,12 +100,6 @@ test = [
Homepage = "https://github.com/rapidsai/cuml"
Documentation = "https://docs.rapids.ai/api/cuml/stable/"

[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {file = "cuml/VERSION"}

[tool.black]
line-length = 79
target-version = ["py39"]
Expand All @@ -131,3 +123,16 @@ versioneer\.py |
thirdparty
)/
'''

[tool.scikit-build]
cmake.minimum-version = "3.26.4"
ninja.make-fallback = true
cmake.build-type = "Release"
sdist.reproducible = true
wheel.packages = ["cuml"]
build-dir = "build/{wheel_tag}"

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "cuml/VERSION"
regex = "(?P<value>.*)"
114 changes: 0 additions & 114 deletions python/setup.py

This file was deleted.

0 comments on commit 122b7f0

Please sign in to comment.