From fd578a0664b9b5b7079b0d76a9603b3b0c6b54bb Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 16 Aug 2024 12:34:39 -0400 Subject: [PATCH 1/4] Fix several issues with wheel builds * Ensure correct directory layout in both wheels * Add CMake entry point to libkvikio wheel * Require kvikio wheel to use libkvikio wheel * Exclude unneeded source files from wheel --- ci/build_wheel_python.sh | 1 + cpp/cmake/rapids_config.cmake | 4 +++- python/kvikio/CMakeLists.txt | 2 +- python/kvikio/pyproject.toml | 1 + python/libkvikio/pyproject.toml | 4 ++++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/build_wheel_python.sh b/ci/build_wheel_python.sh index a75ef5b08b..faaea9ecf9 100755 --- a/ci/build_wheel_python.sh +++ b/ci/build_wheel_python.sh @@ -24,6 +24,7 @@ cd "${package_dir}" echo "libkvikio-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${CPP_WHEELHOUSE}/libkvikio_*.whl)" > ./constraints.txt PIP_CONSTRAINT="${PWD}/constraints.txt" \ +SKBUILD_CMAKE_ARGS="-DFIND_KVIKIO_CPP=ON;-DCMAKE_INSTALL_INCLUDEDIR=kvikio/include;-DCMAKE_INSTALL_LIBDIR=kvikio/lib64" \ python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check mkdir -p final_dist diff --git a/cpp/cmake/rapids_config.cmake b/cpp/cmake/rapids_config.cmake index c3a6a0ef13..c578004605 100644 --- a/cpp/cmake/rapids_config.cmake +++ b/cpp/cmake/rapids_config.cmake @@ -26,10 +26,12 @@ else() ) endif() +set(rapids-cmake-repo KyleFromNVIDIA/rapids-cmake) +set(rapids-cmake-branch nvcomp-nested-dir) if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") file( DOWNLOAD - "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" + "https://raw.githubusercontent.com/KyleFromNVIDIA/rapids-cmake/nvcomp-nested-dir/RAPIDS.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake" ) endif() diff --git a/python/kvikio/CMakeLists.txt b/python/kvikio/CMakeLists.txt index 9217645637..2121da90f2 100644 --- a/python/kvikio/CMakeLists.txt +++ b/python/kvikio/CMakeLists.txt @@ -34,7 +34,7 @@ option(FIND_KVIKIO_CPP include(../../cpp/cmake/Modules/FindcuFile.cmake) if(FIND_KVIKIO_CPP) - find_package(KvikIO "${RAPIDS_VERSION}") + find_package(KvikIO REQUIRED "${RAPIDS_VERSION}") else() set(KvikIO_FOUND OFF) endif() diff --git a/python/kvikio/pyproject.toml b/python/kvikio/pyproject.toml index 3f68177280..e81649753b 100644 --- a/python/kvikio/pyproject.toml +++ b/python/kvikio/pyproject.toml @@ -127,6 +127,7 @@ ninja.make-fallback = true sdist.exclude = ["*tests*"] sdist.reproducible = true wheel.packages = ["kvikio"] +wheel.exclude = ["*.pyx", "*.pxd"] [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" diff --git a/python/libkvikio/pyproject.toml b/python/libkvikio/pyproject.toml index 51306fcf94..80b5baaeb3 100644 --- a/python/libkvikio/pyproject.toml +++ b/python/libkvikio/pyproject.toml @@ -41,6 +41,7 @@ sdist.exclude = ["*tests*"] sdist.reproducible = true wheel.packages = ["libkvikio"] wheel.py-api = "py3" +wheel.install-dir = "libkvikio" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" @@ -55,3 +56,6 @@ requires = [ "cmake>=3.26.4,!=3.30.0", "ninja", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[project.entry-points."cmake.prefix"] +libkvikio = "libkvikio" From d53c84a08a8c518ab778a363ad8bde0221d39ddf Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 16 Aug 2024 15:03:53 -0400 Subject: [PATCH 2/4] Undo temporary rapids-cmake changes --- cpp/cmake/rapids_config.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/cmake/rapids_config.cmake b/cpp/cmake/rapids_config.cmake index c578004605..c3a6a0ef13 100644 --- a/cpp/cmake/rapids_config.cmake +++ b/cpp/cmake/rapids_config.cmake @@ -26,12 +26,10 @@ else() ) endif() -set(rapids-cmake-repo KyleFromNVIDIA/rapids-cmake) -set(rapids-cmake-branch nvcomp-nested-dir) if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") file( DOWNLOAD - "https://raw.githubusercontent.com/KyleFromNVIDIA/rapids-cmake/nvcomp-nested-dir/RAPIDS.cmake" + "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KVIKIO_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake" ) endif() From 1a90ffe7704ac8a0aa9bccf1575afd8fab511194 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 16 Aug 2024 15:28:21 -0400 Subject: [PATCH 3/4] Review feedback --- ci/build_wheel_python.sh | 2 +- python/kvikio/cmake/thirdparty/get_nvcomp.cmake | 4 +--- python/kvikio/pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ci/build_wheel_python.sh b/ci/build_wheel_python.sh index faaea9ecf9..4f50a1e376 100755 --- a/ci/build_wheel_python.sh +++ b/ci/build_wheel_python.sh @@ -24,7 +24,7 @@ cd "${package_dir}" echo "libkvikio-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${CPP_WHEELHOUSE}/libkvikio_*.whl)" > ./constraints.txt PIP_CONSTRAINT="${PWD}/constraints.txt" \ -SKBUILD_CMAKE_ARGS="-DFIND_KVIKIO_CPP=ON;-DCMAKE_INSTALL_INCLUDEDIR=kvikio/include;-DCMAKE_INSTALL_LIBDIR=kvikio/lib64" \ +SKBUILD_CMAKE_ARGS="-DFIND_KVIKIO_CPP=ON" \ python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check mkdir -p final_dist diff --git a/python/kvikio/cmake/thirdparty/get_nvcomp.cmake b/python/kvikio/cmake/thirdparty/get_nvcomp.cmake index ff39366bff..fa621e798a 100644 --- a/python/kvikio/cmake/thirdparty/get_nvcomp.cmake +++ b/python/kvikio/cmake/thirdparty/get_nvcomp.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-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. You may obtain a copy of the License at @@ -19,8 +19,6 @@ function(find_and_configure_nvcomp) include(${rapids-cmake-dir}/cpm/nvcomp.cmake) rapids_cpm_nvcomp( - BUILD_EXPORT_SET kvikio-exports - INSTALL_EXPORT_SET kvikio-exports USE_PROPRIETARY_BINARY ${KVIKIO_USE_PROPRIETARY_BINARY} ) diff --git a/python/kvikio/pyproject.toml b/python/kvikio/pyproject.toml index e81649753b..1485ebd87c 100644 --- a/python/kvikio/pyproject.toml +++ b/python/kvikio/pyproject.toml @@ -127,7 +127,7 @@ ninja.make-fallback = true sdist.exclude = ["*tests*"] sdist.reproducible = true wheel.packages = ["kvikio"] -wheel.exclude = ["*.pyx", "*.pxd"] +wheel.exclude = ["*.pyx", "CMakeLists.txt"] [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" From 1f93362cdc3b4415456cd8bb8341c322119b0070 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 16 Aug 2024 15:30:17 -0400 Subject: [PATCH 4/4] Style --- python/kvikio/cmake/thirdparty/get_nvcomp.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/kvikio/cmake/thirdparty/get_nvcomp.cmake b/python/kvikio/cmake/thirdparty/get_nvcomp.cmake index fa621e798a..9361624c07 100644 --- a/python/kvikio/cmake/thirdparty/get_nvcomp.cmake +++ b/python/kvikio/cmake/thirdparty/get_nvcomp.cmake @@ -18,9 +18,7 @@ set(KVIKIO_USE_PROPRIETARY_BINARY ON) function(find_and_configure_nvcomp) include(${rapids-cmake-dir}/cpm/nvcomp.cmake) - rapids_cpm_nvcomp( - USE_PROPRIETARY_BINARY ${KVIKIO_USE_PROPRIETARY_BINARY} - ) + rapids_cpm_nvcomp(USE_PROPRIETARY_BINARY ${KVIKIO_USE_PROPRIETARY_BINARY}) # Per-thread default stream if(TARGET nvcomp AND PER_THREAD_DEFAULT_STREAM)