Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wheel output #369

Merged
merged 82 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
d650fa7
WIP: add wheel output
msarahan Apr 17, 2024
1faa517
reorganize python folder to allow for libkvikio wheel
msarahan Apr 17, 2024
ea1992b
fix matrix_filter in the wrong place
msarahan Apr 17, 2024
3b35c05
fix executability and add missing pyproject.toml
msarahan Apr 17, 2024
3f9e1fe
fix version file location
msarahan Apr 17, 2024
a3e25f1
fix missing lib files
msarahan Apr 22, 2024
f8b55e0
remove load.py (kvikio is header-only)
msarahan Apr 23, 2024
1c7ebd9
renaming workflows for consistency. Fix path for build.sh python
msarahan Apr 30, 2024
f3cfff0
straighten out paths from python deeper nesting
msarahan Apr 30, 2024
3dceb00
linting cmake format
msarahan Apr 30, 2024
4ebecce
add librmm wheel dep from PR, disable cmake find debugging
msarahan May 1, 2024
9206dcd
adapt devcontainer run to account for different python package path
msarahan May 1, 2024
3298a1a
adjust cpm path; add cpm init to libkvikio wheel
msarahan May 1, 2024
5002499
fix relpath to findcufile
msarahan May 1, 2024
0a9b650
rapids cuda init architectures fix
msarahan May 1, 2024
eebdb55
Apply suggestions from code review
msarahan May 3, 2024
7f2a9d7
adjusting dependencies and wheel tagging
msarahan May 3, 2024
e016651
remove build deps from py_wheel_cpp
msarahan May 3, 2024
e056546
remove findCufile in libkvikio wheel cmakelists
msarahan May 3, 2024
55349a0
add wheel-python-tests in pr.yaml
msarahan May 3, 2024
3bc31e2
comment librmm inclusion
msarahan May 3, 2024
1249409
fix dependency on scikit-build for wheel
msarahan May 3, 2024
430ffd2
fix dependency on scikit-build for wheel
msarahan May 3, 2024
977d905
fix dependency on scikit-build for wheel
msarahan May 3, 2024
28f0dbd
add wheel dep
msarahan May 3, 2024
4fd111f
wheel has to be installed in build scripts
msarahan May 3, 2024
e2e73b8
wheel has to be installed in build scripts
msarahan May 3, 2024
550b21d
fix s3 download cpp wheel filename
msarahan May 3, 2024
71ba140
move libkvikio wheel to build reqs for kvikio wheel (header-only!)
msarahan May 3, 2024
33d5b8a
add wheel.py-api to libkvikio wheel
msarahan May 6, 2024
04801ef
fix missing -cuXY version for libkvikio
msarahan May 6, 2024
ff4e2bb
add install_aliased_imported_targets for nvcomp
msarahan May 7, 2024
abef47d
style
msarahan May 7, 2024
4331fd8
try to get CMake install_aliased_imported_targets working
msarahan May 7, 2024
899f249
remove unused get_nvcomp.cmake
msarahan May 7, 2024
ab4deb5
fix wrong WheelHelpers.cmake
msarahan May 7, 2024
a048172
reorganize python kvikio cmake
msarahan May 7, 2024
a58f445
restore get_nvcomp.cmake, move WheelHelpers.cmake
msarahan May 7, 2024
e8d1f22
typo in cmake thirdparty include
msarahan May 7, 2024
891c1ce
set cython lib dir
msarahan May 7, 2024
a8d7377
install nvcomp stuff into _lib subfolder alongside cython .so's
msarahan May 7, 2024
f4fbf11
add simple wheel install/test script
msarahan May 7, 2024
5e1f76b
Merge remote-tracking branch 'upstream/branch-24.06' into wheel-build
msarahan May 7, 2024
a33f3fa
chmod +x test_wheel.sh
msarahan May 7, 2024
efa116e
fix nesting too deep in test folder
msarahan May 7, 2024
5eb6b80
Apply suggestions from code review
msarahan May 7, 2024
798c60b
fix cuda-python not adjusting for cuda version
msarahan May 7, 2024
de87c1c
adjust more copyright dates
msarahan May 7, 2024
2b22c5a
add sed for cupy-cuda11x -> cupy-cuda12x on cuda 12
msarahan May 7, 2024
3d97ce3
add early cmake exit in libkvikio wheel if kvikio is already available
msarahan May 8, 2024
0860a99
add wheel publishing in build.yaml
msarahan May 8, 2024
9b89b29
cmake style fix
msarahan May 8, 2024
0e4beee
Update .github/workflows/build.yaml
msarahan May 8, 2024
649397d
Merge branch 'branch-24.06' into wheel-build
hcho3 May 28, 2024
d04de8b
Merge branch 'branch-24.08' into wheel-build
hcho3 Jun 4, 2024
d82635e
Bump libkvikio version
hcho3 Jun 6, 2024
619b9a1
Merge remote-tracking branch 'origin/branch-24.08' into wheel-build
hcho3 Jun 6, 2024
bbed671
Use latest workflows
hcho3 Jun 6, 2024
3dce076
Address reviewers' comments
hcho3 Jun 6, 2024
ff2182a
Fix formatting
hcho3 Jun 6, 2024
1b415f0
Defer to existing FindcuFile module
hcho3 Jun 6, 2024
3d1ac24
Remove unneeded build.sh
hcho3 Jun 6, 2024
8f058b9
Apply suggestions from code review
hcho3 Jun 7, 2024
ccbfd22
Removed outdated comment
hcho3 Jun 7, 2024
84d9e33
Use a separate build.sh
hcho3 Jun 7, 2024
eb127c4
Merge branch 'branch-24.08' into wheel-build
hcho3 Jun 7, 2024
e5c322b
Merge branch 'branch-24.08' of github.com:rapidsai/kvikio into wheel-…
msarahan Jun 17, 2024
5b9da4a
rapids-build-backend for python extension-only wheel
msarahan Jun 17, 2024
7c83f47
fix dependencies-file relative path
msarahan Jun 17, 2024
e2e46fe
always set cython_lib_dir
msarahan Jun 17, 2024
cbfd5f5
attempt to cut out sed stuff that RBB obviates
msarahan Jun 17, 2024
a32ad58
add RBB for libkvikio
msarahan Jun 17, 2024
df85d25
install RBB in build_wheel_*scripts
msarahan Jun 18, 2024
db0ce3b
rbb in build deps for libkvikio
msarahan Jun 18, 2024
bf7dc54
tweak build-backend in libkvikio pyproject.toml
msarahan Jun 18, 2024
f461ab2
libkvikio dynamic dep for pyproject
msarahan Jun 18, 2024
5e2560b
allow alpha specs
msarahan Jun 18, 2024
dd2d246
clean up some unnecessary changes
msarahan Jun 18, 2024
5706ee3
revert WheelHelpers removal and add note about install_aliased_import…
msarahan Jun 18, 2024
b728c93
Apply suggestions from code review
msarahan Jun 18, 2024
5a8ab66
clean up extraneous skbuild stuff (from review)
msarahan Jun 18, 2024
3cf7f82
Apply suggestions from code review
vyasr Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,45 @@ jobs:
node_type: "gpu-v100-latest-1"
run_script: "ci/build_docs.sh"
sha: ${{ inputs.sha }}
wheel-build-cpp:
vyasr marked this conversation as resolved.
Show resolved Hide resolved
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber)))
vyasr marked this conversation as resolved.
Show resolved Hide resolved
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
script: ci/build_wheel_cpp.sh
wheel-build-python:
needs: wheel-build-cpp
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
script: ci/build_wheel_python.sh
wheel-publish-cpp:
needs: wheel-build-cpp
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: libkvikio
package-type: cpp
wheel-publish-python:
needs: wheel-build-python
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: kvikio
package-type: python
27 changes: 27 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- conda-python-tests
- docs-build
- devcontainer
- wheel-cpp-build
- wheel-python-build
- wheel-python-tests
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
checks:
Expand Down Expand Up @@ -64,7 +67,31 @@ jobs:
with:
arch: '["amd64"]'
cuda: '["12.2"]'
# HACK: the yq and rapids-generate-script here is a stopgap until both of these PRs are merged:
# - https://github.com/rapidsai/kvikio/pull/369
# - https://github.com/rapidsai/devcontainers/pull/283
hcho3 marked this conversation as resolved.
Show resolved Hide resolved
build_command: |
sccache -z;
build-all --verbose;
sccache -s;
wheel-cpp-build:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber)))
build_type: pull-request
script: ci/build_wheel_cpp.sh
wheel-python-build:
msarahan marked this conversation as resolved.
Show resolved Hide resolved
needs: wheel-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
script: ci/build_wheel_python.sh
wheel-python-tests:
needs: wheel-python-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
script: ci/test_wheel.sh
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
hooks:
- id: black
files: python/.*
args: ["--config", "python/pyproject.toml"]
args: ["--config", "python/kvikio/pyproject.toml"]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
Expand All @@ -37,11 +37,11 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-cachetools]
args: ["--config-file=python/pyproject.toml",
"python/kvikio",
"python/tests",
"python/examples",
"python/benchmarks"]
args: ["--config-file=python/kvikio/pyproject.toml",
"python/kvikio/kvikio",
"python/kvikio/tests",
"python/kvikio/examples",
"python/kvikio/benchmarks"]
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fi
# Build and install the kvikio Python package
if (( NUMARGS == 0 )) || hasArg kvikio; then
echo "building kvikio..."
cd ${REPODIR}/python
cd ${REPODIR}/python/kvikio
SKBUILD_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX};-DCMAKE_LIBRARY_PATH=${LIBKVIKIO_BUILD_DIR};${EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps .
fi
33 changes: 33 additions & 0 deletions ci/build_wheel_cpp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

set -euo pipefail

package_name="libkvikio"
package_dir="python/libkvikio"

source rapids-configure-sccache
source rapids-date-string

version=$(rapids-generate-version)
commit=$(git rev-parse HEAD)

RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"

# This is the version of the suffix with a preceding hyphen. It's used
# everywhere except in the final wheel name.
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"

pyproject_file="${package_dir}/pyproject.toml"
msarahan marked this conversation as resolved.
Show resolved Hide resolved

sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_dir}/${package_name}/_version.py"

cd "${package_dir}"

python -m pip install wheel
python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check
vyasr marked this conversation as resolved.
Show resolved Hide resolved
python -m wheel tags --platform any dist/* --remove

RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 cpp dist
48 changes: 48 additions & 0 deletions ci/build_wheel_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

set -euo pipefail

package_name="kvikio"
package_dir="python/kvikio"

source rapids-configure-sccache
source rapids-date-string

version=$(rapids-generate-version)
commit=$(git rev-parse HEAD)
msarahan marked this conversation as resolved.
Show resolved Hide resolved

RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"

vyasr marked this conversation as resolved.
Show resolved Hide resolved
# This is the version of the suffix with a preceding hyphen. It's used
# everywhere except in the final wheel name.
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"

pyproject_file="${package_dir}/pyproject.toml"
msarahan marked this conversation as resolved.
Show resolved Hide resolved

sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_dir}/${package_name}/_version.py"

alpha_spec=''
if ! rapids-is-release-build; then
alpha_spec=',>=0.0.0a0'
fi
sed -r -i "s/libkvikio==(.*)\"/libkvikio${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file}

if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then
sed -i "s/cuda-python[<=>\.,0-9a]*/cuda-python>=12.0,<13.0a0/g" ${pyproject_file}
sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file}
fi

CPP_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="libkvikio_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/libkvikio_dist)

cd "${package_dir}"

python -m pip install wheel
vyasr marked this conversation as resolved.
Show resolved Hide resolved
python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check --find-links ${CPP_WHEELHOUSE}

mkdir -p final_dist
python -m auditwheel repair -w final_dist dist/*

RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 final_dist
2 changes: 1 addition & 1 deletion ci/run_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
set -euo pipefail

# Support invoking run_pytests.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/kvikio

pytest --cache-clear --verbose "$@" tests
12 changes: 12 additions & 0 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

set -eou pipefail

RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
WHEELHOUSE="${PWD}/dist/"
RAPIDS_PY_WHEEL_NAME="kvikio_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python "${WHEELHOUSE}"

python -m pip install "kvikio-${RAPIDS_PY_CUDA_SUFFIX}[test]>=0.0.0a0" --find-links "${WHEELHOUSE}"
hcho3 marked this conversation as resolved.
Show resolved Hide resolved

python -m pytest ./python/kvikio/tests
4 changes: 0 additions & 4 deletions conda/recipes/kvikio/build.sh

This file was deleted.

3 changes: 3 additions & 0 deletions conda/recipes/kvikio/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ build:
- SCCACHE_S3_KEY_PREFIX=kvikio-linux64 # [linux64]
- SCCACHE_S3_USE_SSL
- SCCACHE_S3_NO_CREDENTIALS
script:
- cd python/kvikio
- python -m pip install . -vv
hcho3 marked this conversation as resolved.
Show resolved Hide resolved
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
Expand Down
12 changes: 10 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ add_library(kvikio::kvikio ALIAS kvikio)

# Enable CUDA in KvikIO
if(CUDAToolkit_FOUND)
target_link_libraries(kvikio INTERFACE $<BUILD_LOCAL_INTERFACE:CUDA::toolkit>)
if(CUDA_STATIC_RUNTIME)
target_link_libraries(kvikio INTERFACE $<BUILD_LOCAL_INTERFACE:CUDA::cudart_static>)
else()
target_link_libraries(kvikio INTERFACE $<BUILD_LOCAL_INTERFACE:CUDA::cudart>)
endif()
target_compile_definitions(kvikio INTERFACE $<BUILD_LOCAL_INTERFACE:KVIKIO_CUDA_FOUND>)
else()
message(WARNING "Building KvikIO without CUDA")
Expand Down Expand Up @@ -167,7 +171,11 @@ if(NOT already_set_kvikio)

find_package(CUDAToolkit QUIET)
if(CUDAToolkit_FOUND)
target_link_libraries(kvikio::kvikio INTERFACE CUDA::toolkit)
if(CUDA_STATIC_RUNTIME)
target_link_libraries(kvikio::kvikio INTERFACE CUDA::cudart_static)
else()
target_link_libraries(kvikio::kvikio INTERFACE CUDA::cudart)
endif()
target_compile_definitions(kvikio::kvikio INTERFACE KVIKIO_CUDA_FOUND)
else()
message(WARNING "Building KvikIO without CUDA")
Expand Down
62 changes: 51 additions & 11 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ files:
cuda: ["11.8", "12.2"]
arch: [x86_64]
includes:
- build
- build-universal
- build-cpp
- build-py
- build-py-wrapper
- checks
- cuda
- cuda_version
Expand Down Expand Up @@ -38,22 +41,44 @@ files:
- py_version
py_build:
output: pyproject
pyproject_dir: python
pyproject_dir: python/kvikio
extras:
table: build-system
includes:
- build
- build-universal
- build-cpp
- build-py
- build-py-wrapper
py_run:
output: pyproject
pyproject_dir: python
pyproject_dir: python/kvikio
extras:
table: project
includes:
- depends_on_cupy
- run
py_wheel_cpp:
output: pyproject
pyproject_dir: python/libkvikio
extras:
table: build-system
includes:
- build-universal
- build-py
py_wheel_python:
output: pyproject
pyproject_dir: python/kvikio
extras:
table: build-system
includes:
- build-universal
- build-cpp
- build-py
- build-py-wrapper
- build-use-libkvikio-wheel
py_optional_test:
output: pyproject
pyproject_dir: python
pyproject_dir: python/kvikio
extras:
table: project.optional-dependencies
key: test
Expand All @@ -65,21 +90,18 @@ channels:
- conda-forge
- nvidia
dependencies:
build:
build-universal:
common:
- output_types: [conda, requirements, pyproject]
packages:
- cmake>=3.26.4
- cython>=3.0.0
- ninja
build-cpp:
common:
- output_types: conda
packages:
- c-compiler
- cxx-compiler
- 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 Expand Up @@ -109,6 +131,24 @@ dependencies:
cuda: "12.*"
packages:
- cuda-nvcc
build-py:
common:
- output_types: conda
packages:
- scikit-build-core>=0.7.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.7.0
build-use-libkvikio-wheel:
common:
- output_types: [pyproject]
packages:
- libkvikio==24.8.*
build-py-wrapper:
common:
- output_types: [conda, requirements, pyproject]
packages:
- cython>=3.0.0
checks:
common:
- output_types: [conda, requirements]
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zarr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ The following is an example of how to use the convenience function :py:meth:`kvi
to create a new Zarr array and how open an existing Zarr array.


.. literalinclude:: ../../python/examples/zarr_cupy_nvcomp.py
.. literalinclude:: ../../python/kvikio/examples/zarr_cupy_nvcomp.py
:language: python
1 change: 0 additions & 1 deletion python/.gitattributes
msarahan marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

1 change: 0 additions & 1 deletion python/README.md

This file was deleted.

File renamed without changes.
Loading
Loading