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 build wheel script and accompanying version info #167

Merged
merged 86 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
28afe76
add build wheel script and accompanying version info
msarahan Jan 17, 2024
a92cf98
move pip args to requirements output
msarahan Jan 17, 2024
14c8799
Remove hardcoded versions
vyasr Jan 17, 2024
d48d5a4
Fix sed expressions so that they run (overzealous, but OK)
vyasr Jan 17, 2024
99b940d
Find Development.Embed component to make Python3::Python target avail…
vyasr Jan 17, 2024
7e2426c
SKBUILD_CMAKE_ARGS is semicolon-separated
vyasr Jan 17, 2024
955b360
Don't change to dir and just use absolute paths everywhere
vyasr Jan 17, 2024
6c894db
Make sure ucxx_python is also installed
vyasr Jan 17, 2024
a175ee7
Make sure all associated targets are set
vyasr Jan 17, 2024
ef88198
Enabling Python is now automatic
vyasr Jan 17, 2024
a0c72b0
Don't load gtest if not necessary
vyasr Jan 17, 2024
0d6c53a
Consolidate rmm logic and ensure it is only called when requested
vyasr Jan 17, 2024
b7a9d6e
Properly enable Python by default
vyasr Jan 17, 2024
df1150d
Switch back to raw find_package
vyasr Jan 17, 2024
d0e2046
Make `ci/test_wheel.sh` executable
pentschev Jan 17, 2024
697c799
Remove policy from upload artifact
vyasr Jan 17, 2024
e24e23c
Also update cudf
vyasr Jan 18, 2024
3580d0b
Fix cupy dependencies and patching
vyasr Jan 18, 2024
cd01361
Move CI C++/Python test implementations to common script
pentschev Jan 18, 2024
47ed425
Add basic wheel test set
pentschev Jan 18, 2024
fd4aab7
Fix `BINARY_PATH`
pentschev Jan 18, 2024
5f8b0c9
Check for `ucx_info` presence before running
pentschev Jan 18, 2024
3742bb5
Fix `ucx_info` chek
pentschev Jan 18, 2024
9305a32
Prevent `which` call from causing a failure
pentschev Jan 18, 2024
1da02e6
Simplify `ucx_info` error handling
pentschev Jan 18, 2024
fff8e48
Disable C++ testing in wheels tests
pentschev Jan 18, 2024
f888489
Run tests with `python -m`
pentschev Jan 18, 2024
7378821
Patch UCX libraries
pentschev Jan 18, 2024
40d5e8a
Switch to `rapids-dask-dependency` for `dask-cudf`
pentschev Jan 18, 2024
fb1c523
Build wheel for distributed-ucxx package
pentschev Jan 18, 2024
abe6e7e
Merge remote-tracking branch 'upstream/branch-0.36' into wheel-build-ci
pentschev Jan 18, 2024
f470e02
Fix pyproject
pentschev Jan 18, 2024
e2e9951
Add distributed-ucxx build/tests to GH workflows
pentschev Jan 18, 2024
5858b02
Add execution permission for new wheel build scripts
pentschev Jan 18, 2024
257ad3d
Add missing `fi` statement
pentschev Jan 18, 2024
07f9b42
Fix distributed-ucxx package directory
pentschev Jan 18, 2024
7818f33
Set `RAPIDS_PY_CUDA_SUFFIX` in caller scripts
pentschev Jan 18, 2024
0d7330b
Export `RAPIDS_PY_CUDA_SUFFIX`
pentschev Jan 18, 2024
a43a9bf
Update distributed-ucxx versioning
pentschev Jan 18, 2024
3e1fb71
Add missing distributed-ucxx wheel build step
pentschev Jan 18, 2024
17adea4
Package name fixes
pentschev Jan 18, 2024
0ad3955
Do not export `PROJECT_NAME`
pentschev Jan 18, 2024
bcbed26
Use `rapids-dask-dependency` for `distributed-ucxx` conda package
pentschev Jan 18, 2024
f09d4d7
Comment out distributed-ucxx wheels GH workflows
pentschev Jan 18, 2024
d7dc399
Only use rapids-dask-dependency in conda until we enable distributed-…
bdice Jan 18, 2024
3de787f
Skip distributed-ucxx jobs.
bdice Jan 18, 2024
535a830
Use RAPIDS version for rapids-dask-dependency.
bdice Jan 18, 2024
f7044a3
Merge remote-tracking branch 'upstream/branch-0.36' into wheel-build-ci
bdice Jan 19, 2024
1b6c1df
Increase nofile ulimit in CI workflows for wheels
pentschev Jan 19, 2024
32c14a2
Merge remote-tracking branch 'upstream/branch-0.37' into wheel-build-ci
bdice Jan 19, 2024
27f68dc
Update to 24.04.
bdice Jan 19, 2024
0fa2763
Uncomment distributed-ucxx CI jobs.
bdice Jan 19, 2024
05fb96b
Rename ucxx dependency lists.
bdice Jan 19, 2024
0ee77f6
Use rapids-dependency-file-generator for distributed-ucxx.
bdice Jan 19, 2024
360f559
Fix conda dependency list.
bdice Jan 19, 2024
a12e420
Add ucxx dependency to distributed-ucxx.
bdice Jan 19, 2024
0ab6f18
Update update-version.sh.
bdice Jan 19, 2024
dbb3350
Rewrite alpha_spec for distributed-ucxx's dependency on ucxx.
bdice Jan 19, 2024
3d97f46
Fix sed command.
bdice Jan 19, 2024
6199aea
Fix sed command again.
bdice Jan 19, 2024
199cb25
Install ucxx from this build when testing distributed-ucxx.
bdice Jan 19, 2024
128237d
Install ucxx deps.
bdice Jan 20, 2024
f5182cc
Add missing RMM dependency to ucxx run requirements.
bdice Jan 22, 2024
47bceb5
Merge remote-tracking branch 'upstream/branch-0.37' into wheel-build-ci
vyasr Jan 23, 2024
27573d9
Update VERSION to 0.37.00
bdice Jan 24, 2024
b596c25
Merge remote-tracking branch 'upstream/branch-0.37' into wheel-build-ci
bdice Jan 25, 2024
8b5007f
Clean up merge diff.
bdice Jan 25, 2024
7748935
Add VERSION symlink to distributed-ucxx.
bdice Jan 25, 2024
35c211d
Update copyrights.
bdice Jan 25, 2024
1348dcb
Add alpha_spec to rapids-dask-dependency.
bdice Jan 25, 2024
7ba3ae7
Merge remote-tracking branch 'upstream/branch-0.37' into wheel-build-ci
pentschev Jan 29, 2024
02dc566
Install Distributed development version in wheel test
pentschev Jan 29, 2024
3ef814b
Add smoke tests for aarch wheel
pentschev Jan 29, 2024
dd4e439
Don't print ucx info
vyasr Jan 30, 2024
e782fc7
Run pytest via python
vyasr Jan 30, 2024
cc017be
Fix path to wheel smoke tests
pentschev Jan 30, 2024
90c3152
Merge remote-tracking branch 'msarahan/wheel-build-ci' into wheel-bui…
pentschev Jan 30, 2024
3d43a5c
Fix smoke test copyright headers
pentschev Jan 30, 2024
2107f16
Remove irrelevant comment from wheel smoke test
pentschev Jan 30, 2024
1b3977f
Fix CMake comment on spdlog
pentschev Jan 30, 2024
9e6ce88
Move `ci/test_utils.sh` functions to `ci/test_common.sh`
pentschev Jan 30, 2024
d6af7c6
Remove unneeded wheel test import
pentschev Jan 30, 2024
6e4482f
GH workflow fixes
pentschev Jan 30, 2024
4fa91fb
Make wheel build script more consistent
pentschev Jan 31, 2024
2a8495d
Move `RAPIDS_PY_CUDA_SUFFIX` and build to `ci/build_wheel.sh`
pentschev Jan 31, 2024
035c453
Do not prevent errors in `print_ucx_config`
pentschev Jan 31, 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
38 changes: 38 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,41 @@ jobs:
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
wheel-build-ucxx:
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_ucxx.sh
wheel-publish-ucxx:
needs: wheel-build-ucxx
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: ucxx
wheel-build-distributed-ucxx:
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_distributed_ucxx.sh
wheel-publish-distributed-ucxx:
needs: wheel-build-distributed-ucxx
pentschev marked this conversation as resolved.
Show resolved Hide resolved
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: distributed_ucxx
36 changes: 36 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
- docs-build
- conda-cpp-tests
- conda-python-tests
- wheel-build-ucxx
- wheel-tests-ucxx
- wheel-build-distributed-ucxx
- wheel-tests-distributed-ucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
checks:
Expand Down Expand Up @@ -54,3 +58,35 @@ jobs:
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
wheel-build-ucxx:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
script: ci/build_wheel_ucxx.sh
wheel-tests-ucxx:
needs: wheel-build-ucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
script: ci/test_wheel_ucxx.sh
wheel-build-distributed-ucxx:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
script: ci/build_wheel_distributed_ucxx.sh
wheel-tests-distributed-ucxx:
needs:
- wheel-build-ucxx
- wheel-build-distributed-ucxx
pentschev marked this conversation as resolved.
Show resolved Hide resolved
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
script: ci/test_wheel_distributed_ucxx.sh
20 changes: 20 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,23 @@ jobs:
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
wheel-tests-ucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
script: ci/test_wheel_ucxx.sh
wheel-tests-distributed-ucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
script: ci/test_wheel_distributed_ucxx.sh
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.37.00
143 changes: 143 additions & 0 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#!/bin/bash
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

package_name=$1
package_dir=$2

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

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

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

# Patch project metadata files to include the CUDA version suffix and version override.
pyproject_file="${package_dir}/pyproject.toml"

sed -i -E "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"

# For nightlies we want to ensure that we're pulling in alphas as well. The
# easiest way to do so is to augment the spec with a constraint containing a
# min alpha version that doesn't affect the version bounds but does allow usage
# of alpha versions for that dependency without --pre
alpha_spec=''
if ! rapids-is-release-build; then
alpha_spec=',>=0.0.0a0'
fi

if [[ ${package_name} == "distributed-ucxx" ]]; then
sed -r -i "s/rapids-dask-dependency==(.*)\"/rapids-dask-dependency==\1${alpha_spec}\"/g" ${pyproject_file}
sed -r -i "s/\"ucxx(.*)\"/\"ucxx${PACKAGE_CUDA_SUFFIX}\1${alpha_spec}\"/g" ${pyproject_file}

cd "${package_dir}"

python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check
pentschev marked this conversation as resolved.
Show resolved Hide resolved
elif [[ ${package_name} == "ucxx" ]]; then
# Add -cuXX to package name
sed -r -i "s/rapids-dask-dependency==(.*)\"/rapids-dask-dependency==\1${alpha_spec}\"/g" ${pyproject_file}
sed -r -i "s/rmm(.*)\"/rmm${PACKAGE_CUDA_SUFFIX}\1${alpha_spec}\"/g" ${pyproject_file}
sed -r -i "s/cudf(.*)\"/cudf${PACKAGE_CUDA_SUFFIX}\1${alpha_spec}\"/g" ${pyproject_file}

# Update cupy package name (different suffix from RAPIDS)
if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then
sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file}
fi

SKBUILD_CMAKE_ARGS="-DUCXX_ENABLE_RMM=ON" \
python -m pip wheel "${package_dir}"/ -w "${package_dir}"/dist -vvv --no-deps --disable-pip-version-check

python -m auditwheel repair -w ${package_dir}/final_dist ${package_dir}/dist/*

# Auditwheel rewrites dynamic libraries that are referenced at link time in the
# package. However, UCX loads a number of sub-libraries at runtime via dlopen;
# these are not picked up by auditwheel. Since we have a priori knowledge of
# what these libraries are, we mimic the behaviour of auditwheel by using the
# same hash-based uniqueness scheme and rewriting the link paths.

WHL=$(realpath ${package_dir}/final_dist/ucxx*manylinux*.whl)

# first grab the auditwheel hashes for libuc{tms}
LIBUCM=$(unzip -l $WHL | awk 'match($4, /libucm-[^\.]+\./) { print substr($4, RSTART) }')
LIBUCT=$(unzip -l $WHL | awk 'match($4, /libuct-[^\.]+\./) { print substr($4, RSTART) }')
LIBUCS=$(unzip -l $WHL | awk 'match($4, /libucs-[^\.]+\./) { print substr($4, RSTART) }')
LIBNUMA=$(unzip -l $WHL | awk 'match($4, /libnuma-[^\.]+\./) { print substr($4, RSTART) }')

# Extract the libraries that have already been patched in by auditwheel
mkdir -p repair_dist/ucxx_${RAPIDS_PY_CUDA_SUFFIX}.libs/ucx
unzip $WHL "ucxx_${RAPIDS_PY_CUDA_SUFFIX}.libs/*.so*" -d repair_dist/

# Patch the RPATH to include ORIGIN for each library
pushd repair_dist/ucxx_${RAPIDS_PY_CUDA_SUFFIX}.libs
for f in libu*.so*
do
if [[ -f $f ]]; then
patchelf --add-rpath '$ORIGIN' $f
fi
done

popd

# Now copy in all the extra libraries that are only ever loaded at runtime
pushd repair_dist/ucxx_${RAPIDS_PY_CUDA_SUFFIX}.libs/ucx
if [[ -d /usr/lib64/ucx ]]; then
cp -P /usr/lib64/ucx/* .
elif [[ -d /usr/lib/ucx ]]; then
cp -P /usr/lib/ucx/* .
else
echo "Could not find ucx libraries"
exit 1
fi

# we link against <python>/lib/site-packages/ucxx_${RAPIDS_PY_CUDA_SUFFIX}.lib/libuc{ptsm}
# we also amend the rpath to search one directory above to *find* libuc{tsm}
for f in libu*.so*
do
# Avoid patching symlinks, which is redundant
if [[ ! -L $f ]]; then
patchelf --replace-needed libuct.so.0 $LIBUCT $f
patchelf --replace-needed libucs.so.0 $LIBUCS $f
patchelf --replace-needed libucm.so.0 $LIBUCM $f
patchelf --replace-needed libnuma.so.1 $LIBNUMA $f
patchelf --add-rpath '$ORIGIN/..' $f
fi
done

# Bring in cudart as well. To avoid symbol collision with other libraries e.g.
# cupy we mimic auditwheel by renaming the libraries to include the hashes of
# their names. Since there will typically be a chain of symlinks
# libcudart.so->libcudart.so.X->libcudart.so.X.Y.Z we need to follow the chain
# and rename all of them.

find /usr/local/cuda/ -name "libcudart*.so*" | xargs cp -P -t .
src=libcudart.so
hash=$(sha256sum ${src} | awk '{print substr($1, 0, 8)}')
target=$(basename $(readlink -f ${src}))

mv ${target} ${target/libcudart/libcudart-${hash}}
while readlink ${src} > /dev/null; do
target=$(readlink ${src})
ln -s ${target/libcudart/libcudart-${hash}} ${src/libcudart/libcudart-${hash}}
rm -f ${src}
src=${target}
done

to_rewrite=$(ldd libuct_cuda.so | awk '/libcudart/ { print $1 }')
patchelf --replace-needed ${to_rewrite} libcudart-${hash}.so libuct_cuda.so
patchelf --add-rpath '$ORIGIN' libuct_cuda.so

popd

pushd repair_dist
zip -r $WHL ucxx_${RAPIDS_PY_CUDA_SUFFIX}.libs/
popd
else
echo "Unknown package '${package_name}'"
exit 1
fi
12 changes: 12 additions & 0 deletions ci/build_wheel_distributed_ucxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

package_dir="python/distributed-ucxx"

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

./ci/build_wheel.sh distributed-ucxx ${package_dir}

RAPIDS_PY_WHEEL_NAME="distributed_ucxx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 ${package_dir}/dist
vyasr marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions ci/build_wheel_ucxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

package_dir="python"

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

./ci/build_wheel.sh ucxx ${package_dir}

RAPIDS_PY_WHEEL_NAME="ucxx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 ${package_dir}/final_dist
pentschev marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading