Skip to content

Commit

Permalink
Switch to scikit-build-core (#2051)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#2

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #2051
  • Loading branch information
vyasr authored Dec 13, 2023
1 parent 6c95f9c commit 80a48ca
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 123 deletions.
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ SKBUILD_EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS}"
if [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_RAFT_CPP"* ]]; then
SKBUILD_EXTRA_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS} -DFIND_RAFT_CPP=ON"
fi
# Replace spaces with semicolons in SKBUILD_EXTRA_CMAKE_ARGS
SKBUILD_EXTRA_CMAKE_ARGS=$(echo ${SKBUILD_EXTRA_CMAKE_ARGS} | sed 's/ /;/g')

# If clean given, run it prior to any other steps
if (( ${CLEAN} == 1 )); then
Expand Down Expand Up @@ -493,15 +495,13 @@ fi

# Build and (optionally) install the pylibraft Python package
if (( ${NUMARGS} == 0 )) || hasArg pylibraft; then
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
SKBUILD_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps ${REPODIR}/python/pylibraft
fi

# Build and (optionally) install the raft-dask Python package
if (( ${NUMARGS} == 0 )) || hasArg raft-dask; then
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
SKBUILD_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps ${REPODIR}/python/raft-dask
fi

Expand Down
2 changes: 1 addition & 1 deletion ci/build_wheel_pylibraft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
set -euo pipefail

# Set up skbuild options. Enable sccache in skbuild config options
export SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DFIND_RAFT_CPP=OFF"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_RAFT_CPP=OFF"

ci/build_wheel.sh pylibraft python/pylibraft
2 changes: 1 addition & 1 deletion ci/build_wheel_raft_dask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
set -euo pipefail

# Set up skbuild options. Enable sccache in skbuild config options
export SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DFIND_RAFT_CPP=OFF"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_RAFT_CPP=OFF"

ci/build_wheel.sh raft-dask python/raft-dask
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn
- scipy
- sphinx-copybutton
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 @@ -49,7 +49,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn
- scipy
- sphinx-copybutton
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-120_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn
- scipy
- sphinx-copybutton
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 @@ -45,7 +45,7 @@ dependencies:
- rapids-dask-dependency==24.2.*
- recommonmark
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn
- scipy
- sphinx-copybutton
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-118_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ dependencies:
- pandas
- pyyaml
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- sysroot_linux-aarch64==2.17
name: bench_ann_cuda-118_arch-aarch64
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ dependencies:
- pandas
- pyyaml
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- sysroot_linux-64==2.17
name: bench_ann_cuda-118_arch-x86_64
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-120_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ dependencies:
- pandas
- pyyaml
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- sysroot_linux-aarch64==2.17
name: bench_ann_cuda-120_arch-aarch64
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-120_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ dependencies:
- pandas
- pyyaml
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- sysroot_linux-64==2.17
name: bench_ann_cuda-120_arch-x86_64
2 changes: 1 addition & 1 deletion conda/recipes/pylibraft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ requirements:
- libraft-headers {{ version }}
- python x.x
- rmm ={{ minor_version }}
- scikit-build >=0.13.1
- scikit-build-core >=0.7.0
- setuptools
run:
- {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/raft-dask/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ requirements:
- pylibraft {{ version }}
- python x.x
- rmm ={{ minor_version }}
- scikit-build >=0.13.1
- scikit-build-core >=0.7.0
- setuptools
- ucx {{ ucx_version }}
- ucx-proc=*=gpu
Expand Down
7 changes: 4 additions & 3 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ files:
includes:
- build
- build_pylibraft
- build_wheels
py_run_pylibraft:
output: pyproject
pyproject_dir: python/pylibraft
Expand All @@ -89,7 +88,6 @@ files:
table: build-system
includes:
- build
- build_wheels
py_run_raft_dask:
output: pyproject
pyproject_dir: python/raft-dask
Expand Down Expand Up @@ -133,12 +131,15 @@ dependencies:
- &cmake_ver cmake>=3.26.4
- cython>=3.0.0
- ninja
- scikit-build>=0.13.1
- output_types: [conda]
packages:
- c-compiler
- cxx-compiler
- nccl>=2.9.9
- scikit-build-core>=0.7.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.7.0
specific:
- output_types: conda
matrices:
Expand Down
8 changes: 2 additions & 6 deletions python/pylibraft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ rapids_cuda_init_architectures(pylibraft)
project(
pylibraft
VERSION ${pylibraft_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.
C CXX CUDA
LANGUAGES CXX CUDA
)

option(FIND_RAFT_CPP "Search for existing RAFT C++ installations before defaulting to local files"
Expand All @@ -51,7 +47,7 @@ else()
set(raft_FOUND OFF)
endif()

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

if(NOT raft_FOUND)
set(BUILD_TESTS OFF)
Expand Down
1 change: 1 addition & 0 deletions python/pylibraft/README.md
25 changes: 15 additions & 10 deletions python/pylibraft/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ requires = [
"cython>=3.0.0",
"ninja",
"rmm==24.2.*",
"scikit-build>=0.13.1",
"setuptools",
"wheel",
"scikit-build-core[pyproject]>=0.7.0",
] # 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"

[project]
name = "pylibraft"
Expand Down Expand Up @@ -61,12 +59,6 @@ test = [
Homepage = "https://github.com/rapidsai/raft"
Documentation = "https://docs.rapids.ai/api/raft/stable/"

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

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

[tool.isort]
line_length = 79
multi_line_output = 3
Expand Down Expand Up @@ -109,3 +101,16 @@ skip = [
"dist",
"__init__.py",
]

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

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

This file was deleted.

8 changes: 2 additions & 6 deletions python/raft-dask/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ rapids_cuda_init_architectures(raft-dask-python)
project(
raft-dask-python
VERSION ${raft_dask_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.
C CXX CUDA
LANGUAGES CXX CUDA
)

option(FIND_RAFT_CPP "Search for existing RAFT C++ installations before defaulting to local files"
Expand Down Expand Up @@ -59,7 +55,7 @@ if(NOT raft_FOUND)
find_package(NCCL REQUIRED)
endif()

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

add_subdirectory(raft_dask/common)
Expand Down
1 change: 1 addition & 0 deletions python/raft-dask/README.md
24 changes: 15 additions & 9 deletions python/raft-dask/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@

[build-system]

build-backend = "scikit_build_core.build"
requires = [
"cmake>=3.26.4",
"cython>=3.0.0",
"ninja",
"scikit-build>=0.13.1",
"setuptools",
"wheel",
"scikit-build-core[pyproject]>=0.7.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.

[project]
Expand Down Expand Up @@ -59,12 +58,6 @@ test = [
Homepage = "https://github.com/rapidsai/raft"
Documentation = "https://docs.rapids.ai/api/raft/stable/"

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

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

[tool.isort]
line_length = 79
multi_line_output = 3
Expand Down Expand Up @@ -108,3 +101,16 @@ skip = [
"dist",
"__init__.py",
]

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

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

This file was deleted.

0 comments on commit 80a48ca

Please sign in to comment.