Skip to content

Commit

Permalink
Switch to scikit-build-core (#4053)
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:
  - Bradley Dice (https://github.com/bdice)
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #4053
  • Loading branch information
vyasr authored Dec 14, 2023
1 parent 5890d80 commit d7c88d1
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 427 deletions.
61 changes: 13 additions & 48 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ HELP="$0 [<target> ...] [<flag> ...]
-v - verbose build mode
-g - build for debug
-n - do not install after a successful build (does not affect Python packages)
--pydevelop - use setup.py develop instead of install
--pydevelop - install the Python packages in editable mode
--allgpuarch - build for all supported GPU architectures
--skip_cpp_tests - do not build the SG test binaries as part of the libcugraph and libcugraph_etl targets
--without_cugraphops - do not build algos that require cugraph-ops
Expand Down Expand Up @@ -187,14 +187,18 @@ if hasArg --cmake_default_generator; then
CMAKE_GENERATOR_OPTION=""
fi
if hasArg --pydevelop; then
PYTHON_ARGS_FOR_INSTALL="-m pip install --no-build-isolation --no-deps -e"
PYTHON_ARGS_FOR_INSTALL="${PYTHON_ARGS_FOR_INSTALL} -e"
fi

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

# Replace spaces with semicolons in SKBUILD_EXTRA_CMAKE_ARGS
SKBUILD_EXTRA_CMAKE_ARGS=$(echo ${SKBUILD_EXTRA_CMAKE_ARGS} | sed 's/ /;/g')

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

# If clean or uninstall targets given, run them prior to any other steps
if hasArg uninstall; then
Expand All @@ -213,8 +217,7 @@ if hasArg uninstall; then
if [ -e ${LIBCUGRAPH_BUILD_DIR}/install_manifest.txt ]; then
xargs rm -f < ${LIBCUGRAPH_BUILD_DIR}/install_manifest.txt > /dev/null 2>&1
fi
# uninstall cugraph and pylibcugraph installed from a prior "setup.py
# install"
# uninstall cugraph and pylibcugraph installed from a prior install
# FIXME: if multiple versions of these packages are installed, this only
# removes the latest one and leaves the others installed. build.sh uninstall
# can be run multiple times to remove all of them, but that is not obvious.
Expand All @@ -226,10 +229,6 @@ if hasArg clean; then
# Ignore errors for clean since missing files, etc. are not failures
set +e
# remove artifacts generated inplace
# FIXME: ideally the "setup.py clean" command would be used for this, but
# currently running any setup.py command has side effects (eg. cloning
# repos).
# (cd ${REPODIR}/python && python setup.py clean)
if [[ -d ${REPODIR}/python ]]; then
cleanPythonDir ${REPODIR}/python
fi
Expand Down Expand Up @@ -317,24 +316,7 @@ if buildDefault || hasArg pylibcugraph || hasArg all; then
if hasArg --clean; then
cleanPythonDir ${REPODIR}/python/pylibcugraph
else
# FIXME: skbuild with setuptools>=64 has a bug when called from a "pip
# install -e" command, resulting in a broken editable wheel. Continue
# to use "setup.py bdist_ext --inplace" for a develop build until
# https://github.com/scikit-build/scikit-build/issues/981 is closed.
if hasArg --pydevelop; then
cd ${REPODIR}/python/pylibcugraph
python setup.py build_ext \
--inplace \
-- \
-DFIND_CUGRAPH_CPP=ON \
-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS} \
-Dcugraph_ROOT=${LIBCUGRAPH_BUILD_DIR} \
-- \
-j${PARALLEL_LEVEL:-1}
cd -
fi
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS} -DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
SKBUILD_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS};-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
python ${PYTHON_ARGS_FOR_INSTALL} ${REPODIR}/python/pylibcugraph
fi
fi
Expand All @@ -344,24 +326,7 @@ if buildDefault || hasArg cugraph || hasArg all; then
if hasArg --clean; then
cleanPythonDir ${REPODIR}/python/cugraph
else
# FIXME: skbuild with setuptools>=64 has a bug when called from a "pip
# install -e" command, resulting in a broken editable wheel. Continue
# to use "setup.py bdist_ext --inplace" for a develop build until
# https://github.com/scikit-build/scikit-build/issues/981 is closed.
if hasArg --pydevelop; then
cd ${REPODIR}/python/cugraph
python setup.py build_ext \
--inplace \
-- \
-DFIND_CUGRAPH_CPP=ON \
-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS} \
-Dcugraph_ROOT=${LIBCUGRAPH_BUILD_DIR} \
-- \
-j${PARALLEL_LEVEL:-1}
cd -
fi
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS} -DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
SKBUILD_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS};-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
python ${PYTHON_ARGS_FOR_INSTALL} ${REPODIR}/python/cugraph
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion ci/build_wheel_cugraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
RAPIDS_PY_WHEEL_NAME=pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX} rapids-download-wheels-from-s3 ./local-pylibcugraph
export PIP_FIND_LINKS=$(pwd)/local-pylibcugraph

export SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DFIND_CUGRAPH_CPP=OFF -DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF;-DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/"

./ci/build_wheel.sh cugraph python/cugraph
2 changes: 1 addition & 1 deletion ci/build_wheel_pylibcugraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

set -euo pipefail

export SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DFIND_CUGRAPH_CPP=OFF -DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF;-DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/"

./ci/build_wheel.sh pylibcugraph python/pylibcugraph
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:
- recommonmark
- requests
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn>=0.23.1
- scipy
- setuptools>=61.0.0
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 @@ -62,7 +62,7 @@ dependencies:
- recommonmark
- requests
- rmm==24.2.*
- scikit-build>=0.13.1
- scikit-build-core>=0.7.0
- scikit-learn>=0.23.1
- scipy
- setuptools>=61.0.0
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-pyg/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ requirements:
host:
- cython >=3.0.0
- python
- scikit-build >=0.13.1
- scikit-build-core >=0.7.0
run:
- rapids-dask-dependency ={{ minor_version }}
- numba >=0.57
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ requirements:
- python
- raft-dask ={{ minor_version }}
- rmm ={{ minor_version }}
- scikit-build >=0.13.1
- scikit-build-core >=0.7.0
- setuptools
run:
- aiohttp
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/pylibcugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ requirements:
- libcugraph ={{ version }}
- pylibraft ={{ minor_version }}
- python
- 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
7 changes: 6 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,12 @@ dependencies:
- output_types: [conda, pyproject, requirements]
packages:
- cython>=3.0.0
- scikit-build>=0.13.1
- output_types: conda
packages:
- scikit-build-core>=0.7.0
- output_types: [pyproject, requirements]
packages:
- scikit-build-core[pyproject]>=0.7.0
python_run_cugraph:
common:
- output_types: [conda, pyproject]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ __Other Packages__:
* cython
* setuputils3
* scikit-learn
* scikit-build
* scikit-build-core
* nanobind>=0.2.0

## Building wholegraph
Expand Down
19 changes: 0 additions & 19 deletions python/cugraph-dgl/setup.py

This file was deleted.

66 changes: 0 additions & 66 deletions python/cugraph-pyg/setup.py

This file was deleted.

86 changes: 0 additions & 86 deletions python/cugraph-pyg/setuputils.py

This file was deleted.

19 changes: 0 additions & 19 deletions python/cugraph-service/client/setup.py

This file was deleted.

Loading

0 comments on commit d7c88d1

Please sign in to comment.