Skip to content

Commit

Permalink
Merge branch 'branch-0.33' into ci-tests-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev authored Jul 25, 2023
2 parents 97481b0 + f34c0a0 commit 923b0ff
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 91 deletions.
64 changes: 0 additions & 64 deletions .github/build-scripts/patch-wheel.sh

This file was deleted.

11 changes: 4 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,20 @@ jobs:
sha: ${{ inputs.sha }}
wheel-build:
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@branch-23.08
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.08
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: ucx_py
package-dir: .
post-repair-amd64: "${GITHUB_WORKSPACE}/.github/build-scripts/patch-wheel.sh $(realpath ucx_py*manylinux*.whl)"
post-repair-arm64: "${GITHUB_WORKSPACE}/.github/build-scripts/patch-wheel.sh $(realpath ucx_py*manylinux*.whl)"
script: ci/build_wheel.sh
wheel-publish:
needs: wheel-build
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-publish.yml@branch-23.08
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-publish.yaml@branch-23.08
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: ucx_py
script: ci/test_wheel.sh
14 changes: 4 additions & 10 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,15 @@ jobs:
wheel-build:
needs: checks
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@branch-23.08
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.08
with:
build_type: pull-request
package-name: ucx_py
package-dir: .
post-repair-amd64: "${GITHUB_WORKSPACE}/.github/build-scripts/patch-wheel.sh $(realpath ucx_py*manylinux*.whl)"
post-repair-arm64: "${GITHUB_WORKSPACE}/.github/build-scripts/patch-wheel.sh $(realpath ucx_py*manylinux*.whl)"
script: ci/build_wheel.sh
wheel-tests:
needs: wheel-build
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@branch-23.08
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.08
with:
build_type: pull-request
package-name: ucx_py
script: ci/test_wheel.sh
test-docker-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g"
# skipped test context: https://github.com/rapidsai/ucx-py/issues/797
test-unittest: "cd tests && python -m pytest --cache-clear -vs . && cd ../ucp && python -m pytest -k 'not test_send_recv_am' --cache-clear -vs ./_libs/tests/; cd .."
test-smoketest: "cd tests && python -m pytest --cache-clear -vs . && cd ../ucp && python -m pytest -k 'not test_send_recv_am' --cache-clear -vs ./_libs/tests/; cd .."
6 changes: 2 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ jobs:
sha: ${{ inputs.sha }}
wheel-tests:
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@branch-23.08
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.08
with:
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
package-name: ucx_py
script: ci/test_wheel.sh
test-docker-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g"
# skipped test context: https://github.com/rapidsai/ucx-py/issues/797
test-unittest: "cd tests && python -m pytest --cache-clear -vs . && cd ../ucp && python -m pytest -k 'not test_send_recv_am' --cache-clear -vs ./_libs/tests/; cd .."
100 changes: 100 additions & 0 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.

set -euo pipefail

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

# Use gha-tools rapids-pip-wheel-version to generate wheel version then
# update the necessary files
version_override="$(rapids-pip-wheel-version ${RAPIDS_DATE_STRING})"

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

bash ci/release/apply_wheel_modifications.sh ${version_override} "-${RAPIDS_PY_CUDA_SUFFIX}"
echo "The package name and/or version was modified in the package source. The git diff is:"
git diff

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/*

# 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 final_dist/ucx_py*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/ucx_py_${RAPIDS_PY_CUDA_SUFFIX}.libs/ucx
unzip $WHL "ucx_py_${RAPIDS_PY_CUDA_SUFFIX}.libs/*.so*" -d repair_dist/

# Patch the RPATH to include ORIGIN for each library
pushd repair_dist/ucx_py_${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/ucx_py_${RAPIDS_PY_CUDA_SUFFIX}.libs/ucx
cp -P /usr/lib/ucx/* .

# we link against <python>/lib/site-packages/ucx_py_${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 ucx_py_${RAPIDS_PY_CUDA_SUFFIX}.libs/
popd

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

set -eoxu pipefail

mkdir -p ./dist
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
RAPIDS_PY_WHEEL_NAME="ucx_py_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist

# echo to expand wildcard before adding `[extra]` requires for pip
python -m pip install $(echo ./dist/ucx_py*.whl)[test]

cd tests
python -m pytest --cache-clear -vs .
cd ../ucp
# skipped test context: https://github.com/rapidsai/ucx-py/issues/797
python -m pytest -k 'not test_send_recv_am' --cache-clear -vs ./_libs/tests/
2 changes: 0 additions & 2 deletions conda/recipes/ucx-py/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ requirements:
{% endfor %}

test:
requires:
- cudatoolkit {{ cuda_version }}.*
imports:
- ucp

Expand Down
17 changes: 13 additions & 4 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,28 @@ dependencies:
- matrix:
cuda: "11.2"
packages:
- cudatoolkit=11.2
- cuda-version=11.2
- cudatoolkit
- matrix:
cuda: "11.4"
packages:
- cudatoolkit=11.4
- cuda-version=11.4
- cudatoolkit
- matrix:
cuda: "11.5"
packages:
- cudatoolkit=11.5
- cuda-version=11.5
- cudatoolkit
- matrix:
cuda: "11.8"
packages:
- cudatoolkit=11.8
- cuda-version=11.8
- cudatoolkit
- matrix:
cuda: "12.0"
packages:
- cuda-version=12.0
- cuda-cudart
py_version:
specific:
- output_types: conda
Expand Down

0 comments on commit 923b0ff

Please sign in to comment.