From 004a16dfcd63f7216bcc3c018f3cf0c5d7578a48 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 27 Feb 2023 16:27:22 -0800 Subject: [PATCH 1/5] Use scikit-build-core --- README.md | 2 +- build.sh | 2 +- .../all_cuda-118_arch-x86_64.yaml | 3 +-- .../all_cuda-120_arch-x86_64.yaml | 3 +-- conda/recipes/rmm/meta.yaml | 4 +--- dependencies.yaml | 12 ++++------ python/CMakeLists.txt | 12 ++++------ python/pyproject.toml | 24 ++++++++++--------- python/setup.py | 11 --------- 9 files changed, 28 insertions(+), 45 deletions(-) delete mode 100644 python/setup.py diff --git a/README.md b/README.md index 56bc86632..a5c626253 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ CUDA/GPU requirements: You can obtain CUDA from [https://developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads) Python requirements: -* `scikit-build` +* `scikit-build-core` * `cuda-python` * `cython` diff --git a/build.sh b/build.sh index ed37b5973..ec08fa402 100755 --- a/build.sh +++ b/build.sh @@ -176,5 +176,5 @@ fi # Build and install the rmm Python package if (( NUMARGS == 0 )) || hasArg rmm; then echo "building and installing rmm..." - SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS}" python -m pip install --no-build-isolation --no-deps ${REPODIR}/python + SKBUILD_CMAKE_ARGS="${SKBUILD_EXTRA_CMAKE_ARGS}" python -m pip install --no-build-isolation --no-deps ${REPODIR}/python fi diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 09f3ebeed..595c9fae3 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -33,12 +33,11 @@ dependencies: - pytest - pytest-cov - python>=3.9,<3.11 -- scikit-build>=0.13.1 +- scikit-build-core>=0.7.0 - spdlog>=1.12.0,<1.13 - sphinx - sphinx-copybutton - sphinx-markdown-tables - sphinx_rtd_theme - sysroot_linux-64==2.17 -- tomli name: all_cuda-118_arch-x86_64 diff --git a/conda/environments/all_cuda-120_arch-x86_64.yaml b/conda/environments/all_cuda-120_arch-x86_64.yaml index 40f1871c2..2f9c9297c 100644 --- a/conda/environments/all_cuda-120_arch-x86_64.yaml +++ b/conda/environments/all_cuda-120_arch-x86_64.yaml @@ -31,12 +31,11 @@ dependencies: - pytest - pytest-cov - python>=3.9,<3.11 -- scikit-build>=0.13.1 +- scikit-build-core>=0.7.0 - spdlog>=1.12.0,<1.13 - sphinx - sphinx-copybutton - sphinx-markdown-tables - sphinx_rtd_theme - sysroot_linux-64==2.17 -- tomli name: all_cuda-120_arch-x86_64 diff --git a/conda/recipes/rmm/meta.yaml b/conda/recipes/rmm/meta.yaml index 477927e27..05d403cb1 100644 --- a/conda/recipes/rmm/meta.yaml +++ b/conda/recipes/rmm/meta.yaml @@ -61,9 +61,7 @@ requirements: - cython >=3.0.0 - librmm ={{ version }} - python - - scikit-build >=0.13.1 - - setuptools >=61.0.0 - - tomli # [py<311] + - scikit-build-core run: {% if cuda_major == "11" %} - cudatoolkit diff --git a/dependencies.yaml b/dependencies.yaml index 805159e62..719570f60 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -62,22 +62,20 @@ dependencies: common: - output_types: [conda, requirements, pyproject] packages: - - &cmake_ver cmake>=3.26.4 - cython>=3.0.0 - - ninja - - scikit-build>=0.13.1 - - tomli - output_types: conda packages: - c-compiler + - &cmake_ver cmake>=3.26.4 - cxx-compiler - fmt>=10.1.1,<11 + - ninja + - scikit-build-core>=0.7.0 - spdlog>=1.12.0,<1.13 - python>=3.9,<3.11 - - output_types: pyproject + - output_types: [requirements, pyproject] packages: - - wheel - - setuptools>=61.0.0 + - scikit-build-core[pyproject]>=0.7.0 specific: - output_types: conda matrices: diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index dc18af3fd..077c37b20 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -16,16 +16,14 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) set(rmm_version 24.02.00) -include(../fetch_rapids.cmake) +file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.02/RAPIDS.cmake + ${CMAKE_BINARY_DIR}/RAPIDS.cmake) +include(${CMAKE_BINARY_DIR}/RAPIDS.cmake) project( rmm-python VERSION ${rmm_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) + LANGUAGES CXX) option(FIND_RMM_CPP "Search for existing RMM C++ installations before defaulting to local files" OFF) @@ -45,7 +43,7 @@ if(NOT rmm_FOUND) add_subdirectory(../ rmm-cpp EXCLUDE_FROM_ALL) endif() -include(rapids-cython) +include(rapids-cython-core) rapids_cython_init() add_compile_definitions("SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}") diff --git a/python/pyproject.toml b/python/pyproject.toml index 751d9a674..519f5d943 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,16 +13,11 @@ # limitations under the License. [build-system] -build-backend = "setuptools.build_meta" +build-backend = "scikit_build_core.build" requires = [ - "cmake>=3.26.4", "cuda-python>=11.7.1,<12.0a0", "cython>=3.0.0", - "ninja", - "scikit-build>=0.13.1", - "setuptools>=61.0.0", - "tomli", - "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] @@ -112,8 +107,15 @@ skip = [ "__init__.py", ] -[tool.setuptools] -license-files = ["LICENSE"] +[tool.scikit-build] +cmake.minimum-version = "3.26.4" +ninja.make-fallback = true +cmake.build-type = "Release" +sdist.reproducible = true +wheel.packages = ["rmm"] +build-dir = "build/{wheel_tag}" -[tool.setuptools.dynamic] -version = {file = "rmm/VERSION"} +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "rmm/VERSION" +regex = "(?P.*)" diff --git a/python/setup.py b/python/setup.py deleted file mode 100644 index af5750044..000000000 --- a/python/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. - -from setuptools import find_packages -from skbuild import setup - -packages = find_packages(include=["rmm*"]) -setup( - packages=packages, - package_data={key: ["VERSION", "*.pxd"] for key in packages}, - zip_safe=False, -) From 38a603ca0528ae6e3f4f108a05c72c517dca3f15 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 13 Dec 2023 00:10:02 +0000 Subject: [PATCH 2/5] Address reviews --- python/CMakeLists.txt | 4 +--- python/pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 077c37b20..635c4d3b5 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -16,9 +16,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) set(rmm_version 24.02.00) -file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.02/RAPIDS.cmake - ${CMAKE_BINARY_DIR}/RAPIDS.cmake) -include(${CMAKE_BINARY_DIR}/RAPIDS.cmake) +include(../fetch_rapids.cmake) project( rmm-python diff --git a/python/pyproject.toml b/python/pyproject.toml index 519f5d943..f625a55b7 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -108,12 +108,12 @@ skip = [ ] [tool.scikit-build] +build-dir = "build/{wheel_tag}" +cmake.build-type = "Release" cmake.minimum-version = "3.26.4" ninja.make-fallback = true -cmake.build-type = "Release" sdist.reproducible = true wheel.packages = ["rmm"] -build-dir = "build/{wheel_tag}" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" From 3e4f0dc73b51490625e7157fe5c116af34780d0e Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 13 Dec 2023 17:46:18 +0000 Subject: [PATCH 3/5] Add cmake and ninja back to pyproject requirements --- dependencies.yaml | 4 ++-- python/pyproject.toml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 719570f60..336852d53 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -62,14 +62,14 @@ dependencies: common: - output_types: [conda, requirements, pyproject] packages: + - &cmake_ver cmake>=3.26.4 - cython>=3.0.0 + - ninja - output_types: conda packages: - c-compiler - - &cmake_ver cmake>=3.26.4 - cxx-compiler - fmt>=10.1.1,<11 - - ninja - scikit-build-core>=0.7.0 - spdlog>=1.12.0,<1.13 - python>=3.9,<3.11 diff --git a/python/pyproject.toml b/python/pyproject.toml index f625a55b7..1e901b1ab 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -15,8 +15,10 @@ [build-system] build-backend = "scikit_build_core.build" requires = [ + "cmake>=3.26.4", "cuda-python>=11.7.1,<12.0a0", "cython>=3.0.0", + "ninja", "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`. From b5b7e714b16d77d58cfc45b008c538f3d912c8b5 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 13 Dec 2023 17:51:14 +0000 Subject: [PATCH 4/5] Add constraint back to meta --- conda/recipes/rmm/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/rmm/meta.yaml b/conda/recipes/rmm/meta.yaml index 05d403cb1..8c8df6f85 100644 --- a/conda/recipes/rmm/meta.yaml +++ b/conda/recipes/rmm/meta.yaml @@ -61,7 +61,7 @@ requirements: - cython >=3.0.0 - librmm ={{ version }} - python - - scikit-build-core + - scikit-build-core>=0.7.0 run: {% if cuda_major == "11" %} - cudatoolkit From 8bae7ba90726e8c765a89f234b4a0c8b74f750d7 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 13 Dec 2023 17:51:55 +0000 Subject: [PATCH 5/5] Fix space --- conda/recipes/rmm/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/rmm/meta.yaml b/conda/recipes/rmm/meta.yaml index 8c8df6f85..1e50853b6 100644 --- a/conda/recipes/rmm/meta.yaml +++ b/conda/recipes/rmm/meta.yaml @@ -61,7 +61,7 @@ requirements: - cython >=3.0.0 - librmm ={{ version }} - python - - scikit-build-core>=0.7.0 + - scikit-build-core >=0.7.0 run: {% if cuda_major == "11" %} - cudatoolkit