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

Build C++ wheel #1512

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
18dc8e0
Move rmm Python package to subdirectory
vyasr Mar 29, 2024
b47da0b
Fix paths
vyasr Mar 29, 2024
5900498
Add cpp wheel
vyasr Mar 29, 2024
655305c
Update dependencies.yaml
vyasr Mar 29, 2024
d1c8af1
Fix pre-commit paths
vyasr Mar 29, 2024
8df5ca2
Work around skbuild issue
vyasr Mar 29, 2024
5918e36
Fix one more path
vyasr Mar 29, 2024
38f6eca
Make Python find the cpp wheel
vyasr Mar 29, 2024
a2db2b6
Move version into package since we have it and can use it
vyasr Mar 29, 2024
7f62bd9
Remove extraneous comment
vyasr Apr 1, 2024
55252d5
Specify that the C++ wheel is independent of Python version
vyasr Apr 1, 2024
a5e750f
Build the wheel in CI
vyasr Apr 1, 2024
4635bc0
Fix one more path
vyasr Apr 1, 2024
00e3d6d
Fix typo
vyasr Apr 1, 2024
7ee5b62
Convert Python version to string
vyasr Apr 1, 2024
1c5d22d
Remove librmm from requirements for now
vyasr Apr 1, 2024
ecee659
Fix the filter properly
vyasr Apr 1, 2024
112e1d1
Change permissions
vyasr Apr 1, 2024
9ea2cd4
No auditwheel
vyasr Apr 1, 2024
3baefd6
Fix path for conda builds
vyasr Apr 1, 2024
bc76ed8
Update build.sh
vyasr Apr 1, 2024
6be9767
Update build script name
vyasr Apr 1, 2024
9ae89d9
Temporarily spoof the Python version
vyasr Apr 1, 2024
872cbed
Patch the wheel requirement to account for the CUDA version
vyasr Apr 1, 2024
3b80064
Fix path to dist
vyasr Apr 1, 2024
3d0bb7d
Simplify name
vyasr Apr 1, 2024
8a6567d
Fix docs dir
vyasr Apr 1, 2024
0dc610e
Use new version of tools that supports cpp wheels
vyasr Apr 2, 2024
583d42d
Also set final Python upload
vyasr Apr 2, 2024
63a2d2a
Fix paths
vyasr Apr 2, 2024
954a176
Put cloned tools first on the path
vyasr Apr 2, 2024
683dafd
Get rid of unnecessary absolute paths
vyasr Apr 2, 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
17 changes: 13 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
- conda-python-build
- conda-python-tests
- docs-build
- wheel-build
- wheel-build-cpp
- wheel-build-python
- wheel-tests
- devcontainer
secrets: inherit
Expand Down Expand Up @@ -62,15 +63,23 @@ jobs:
arch: "amd64"
container_image: "rapidsai/ci-conda:latest"
run_script: "ci/build_docs.sh"
wheel-build:
wheel-build-cpp:
needs: checks
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.sh
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: pull-request
script: ci/build_wheel_python.sh
wheel-tests:
needs: wheel-build
needs: wheel-build-python
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ repos:
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-path=python/pyproject.toml"]
args: ["--settings-path=python/rmm/pyproject.toml"]
files: python/.*
types_or: [python, cython, pyi]
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
args: ["--config=python/pyproject.toml"]
args: ["--config=python/rmm/pyproject.toml"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ fi
# Build and install the rmm Python package
if (( NUMARGS == 0 )) || hasArg rmm; then
echo "building and installing rmm..."
SKBUILD_CMAKE_ARGS="${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/rmm
fi
2 changes: 1 addition & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ doxygen Doxyfile
popd

rapids-logger "Build Python docs"
pushd python/docs
pushd python/rmm/docs
make dirhtml
make text
mkdir -p "${RAPIDS_DOCS_DIR}/rmm/"{html,txt}
Expand Down
2 changes: 1 addition & 1 deletion ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export CMAKE_GENERATOR=Ninja
rapids-print-env

package_name="rmm"
package_dir="python"
package_dir="python/rmm"

version=$(rapids-generate-version)
commit=$(git rev-parse HEAD)
Expand Down
19 changes: 8 additions & 11 deletions ci/build_wheel.sh → ci/build_wheel_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

package_name="rmm"
package_dir="python"
package_name="librmm"
package_dir="python/librmm"

source rapids-configure-sccache
source rapids-date-string
Expand All @@ -25,15 +25,12 @@ sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFF
echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_dir}/${package_name}/_version.py"

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

cd "${package_dir}"

python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check

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
if [[ ! -d "/tmp/gha-tools" ]]; then
git clone https://github.com/msarahan/gha-tools.git -b get-pr-wheel-artifact /tmp/gha-tools
export PATH="/tmp/gha-tools/tools:${PATH}"
fi
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 cpp dist
51 changes: 51 additions & 0 deletions ci/build_wheel_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.

set -euo pipefail

package_name="rmm"
package_dir="python/rmm"

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})"

if [[ ! -d "/tmp/gha-tools" ]]; then
git clone https://github.com/msarahan/gha-tools.git -b get-pr-wheel-artifact /tmp/gha-tools
export PATH="/tmp/gha-tools/tools:${PATH}"
fi

RAPIDS_PY_WHEEL_NAME="librmm_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/librmm_dist

# 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"

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/librmm==(.*)\"/librmm${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}
fi

cd "${package_dir}"

PIP_FIND_LINKS="/tmp/librmm_dist" python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check

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 python 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/rmm/

pytest --cache-clear -v "$@" .
2 changes: 1 addition & 1 deletion ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ python -m pip install $(echo ./dist/rmm*.whl)[test]
if [[ "$(arch)" == "aarch64" && ${RAPIDS_BUILD_TYPE} == "pull-request" ]]; then
python ./ci/wheel_smoke_test.py
else
python -m pytest ./python/rmm/tests
python -m pytest ./python/rmm/rmm/tests
fi
24 changes: 23 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ files:
arch: [x86_64]
includes:
- build
- cython_build
- checks
- cuda
- cuda_version
Expand Down Expand Up @@ -37,20 +38,31 @@ files:
- cuda_version
- docs
- py_version
py_cpp_build:
output: pyproject
pyproject_dir: python/librmm
extras:
table: build-system
includes:
- build
py_build:
output: pyproject
pyproject_dir: python/rmm
extras:
table: build-system
includes:
- build
- cython_build
py_run:
output: pyproject
pyproject_dir: python/rmm
extras:
table: project
includes:
- run
py_optional_test:
output: pyproject
pyproject_dir: python/rmm
extras:
table: project.optional-dependencies
key: test
Expand All @@ -65,7 +77,6 @@ dependencies:
- output_types: [conda, requirements, pyproject]
packages:
- &cmake_ver cmake>=3.26.4
- cython>=3.0.0
- ninja
- output_types: conda
packages:
Expand Down Expand Up @@ -106,6 +117,17 @@ dependencies:
cuda: "12.*"
packages:
- cuda-nvcc
cython_build:
common:
- output_types: [conda, requirements, pyproject]
packages:
- cython>=3.0.0
# TODO: Currently this is a hack for devcontainers. Need to figure out the best solution.
#- output_types: [requirements, pyproject]
- output_types: [pyproject]
packages:
- librmm==24.6.*
specific:
- output_types: [conda, requirements, pyproject]
matrices:
- matrix:
Expand Down
1 change: 0 additions & 1 deletion python/LICENSE

This file was deleted.

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

This file was deleted.

28 changes: 28 additions & 0 deletions python/librmm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# =============================================================================
# Copyright (c) 2022, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(../../rapids_config.cmake)

project(
librmm-python
VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX)

set(BUILD_TESTS OFF)
set(BUILD_BENCHMARKS OFF)
set(CUDA_STATIC_RUNTIME ON)

add_subdirectory(../.. rmm-cpp)
1 change: 1 addition & 0 deletions python/librmm/LICENSE
1 change: 1 addition & 0 deletions python/librmm/README.md
1 change: 1 addition & 0 deletions python/librmm/librmm/VERSION
15 changes: 15 additions & 0 deletions python/librmm/librmm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from librmm._version import __git_commit__, __version__
20 changes: 20 additions & 0 deletions python/librmm/librmm/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.resources

__version__ = (
importlib.resources.files("librmm").joinpath("VERSION").read_text().strip()
)
__git_commit__ = ""
61 changes: 61 additions & 0 deletions python/librmm/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
build-backend = "scikit_build_core.build"
requires = [
"cmake>=3.26.4",
"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`.

[project]
name = "librmm"
dynamic = ["version"]
description = "rmm - RAPIDS Memory Manager"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.9"
classifiers = [
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: C++",
"Environment :: GPU :: NVIDIA CUDA",
]

[project.urls]
Homepage = "https://github.com/rapidsai/rmm"

[project.entry-points."cmake.prefix"]
librmm = "librmm"

[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 = ["librmm"]
wheel.install-dir = "librmm"
wheel.py-api = "py3"

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "librmm/VERSION"
regex = "(?P<value>.*)"
File renamed without changes.
Loading
Loading