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

use rapids-build-backend #234

Merged
merged 12 commits into from
Jun 10, 2024
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
files: \.(h|cpp)$
# exclude: path/to/myfile.h
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.8.0
rev: v1.13.11
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ if buildAll || hasArg ucxx; then

cd ${REPODIR}/python/
SKBUILD_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX};-DCMAKE_BUILD_TYPE=${BUILD_TYPE};${SKBUILD_EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps .
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does rapidsai.disable-cuda=true do exactly? Note that the libucxx Cython SO does link to CUDA currently (at least in the conda package):

ldd ./lib/python3.10/site-packages/ucxx/_lib/libucxx.cpython-310-x86_64-linux-gnu.so
        linux-vdso.so.1 (0x00007ffc2d996000)
        libucxx_python.so => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libucxx_python.so (0x00007f1c8b42a000)
        libpython3.10.so.1.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libpython3.10.so.1.0 (0x00007f1c8b08d000)
        libucxx.so => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libucxx.so (0x00007f1c8affa000)
        libcudart.so.11.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libcudart.so.11.0 (0x00007f1c8ad53000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1c8ad38000)
        libucp.so.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libucp.so.0 (0x00007f1c8ac68000)
        libstdc++.so.6 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libstdc++.so.6 (0x00007f1c8aa85000)
        libgcc_s.so.1 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../libgcc_s.so.1 (0x00007f1c8aa6a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1c8a878000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1c8a855000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f1c8a84e000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1c8a6ff000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1c8a6f5000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1c8b4e4000)
        libuct.so.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../.././libuct.so.0 (0x00007f1c8a6b8000)
        libucs.so.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../.././libucs.so.0 (0x00007f1c8a65a000)
        libucm.so.0 => /datasets/pentschev/miniconda3/envs/rn-240610/./lib/python3.10/site-packages/ucxx/_lib/../../../../././libucm.so.0 (0x00007f1c8a63e000)

It probably doesn't need to as I'd assume libucxx.so/libucxx_python.so would do any necessary CUDA linkage though, but admittedly I get confused as to what is (not) necessary to satisfy all the dependency tree.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if the name is confusing. This does NOT disable linking against anything from the CUDA Toolkit.

This option tells rapids-build-backend to avoid doing the following:

  • add a suffix like -cu11 or -cu12 to the name of the package it builds
  • update the list of dependencies by reading the output of running rapids-dependency-file-generator with something like cuda="12.2"

It's passed here in build.sh for conda builds because the conda packages we publish don't have -cu{version} type of suffixes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the details. In that case we're good here! 😄

fi

# Build and install the distributed_ucxx Python package
if buildAll || hasArg distributed_ucxx; then

cd ${REPODIR}/python/distributed-ucxx/
python -m pip install --no-build-isolation --no-deps .
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true .
fi
2 changes: 1 addition & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV_YAML_DIR="$(mktemp -d)"

rapids-dependency-file-generator \
--output conda \
--file_key docs \
--file-key docs \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee "${ENV_YAML_DIR}/env.yaml"

rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n docs
Expand Down
36 changes: 1 addition & 35 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,11 @@ rm -rf /usr/include/uct
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}"

# 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

# 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}
sed -r -i "s/libucx(.*)\"/libucx${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
rapids-generate-version > ./VERSION

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

python -m pip wheel "${package_dir}/" -w "${package_dir}/dist" -vvv --no-deps --disable-pip-version-check

RAPIDS_PY_WHEEL_NAME="distributed_ucxx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 ${package_dir}/dist
Expand Down
2 changes: 1 addition & 1 deletion ci/check_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rapids-logger "Create checks conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key checks \
--file-key checks \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n checks
Expand Down
16 changes: 7 additions & 9 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ function sed_runner() {
echo "${NEXT_FULL_TAG}" > VERSION

# bump RAPIDS libs
sed_runner "/- librmm =/ s/=.*/=${NEXT_RAPIDS_VERSION}/g" conda/recipes/ucxx/meta.yaml
sed_runner "/- rmm =/ s/=.*/=${NEXT_RAPIDS_VERSION}/g" conda/recipes/ucxx/meta.yaml
sed_runner "/- rapids-dask-dependency =/ s/=.*/=${NEXT_RAPIDS_VERSION}/g" conda/recipes/ucxx/meta.yaml
sed_runner "/^rapids_version:$/ {n;s/.*/ - \"${NEXT_RAPIDS_SHORT_TAG_PEP440}\.*\"/}" conda/recipes/ucxx/conda_build_config.yaml

DEPENDENCIES=(
cudf
Expand All @@ -49,10 +47,10 @@ DEPENDENCIES=(
)
for DEP in "${DEPENDENCIES[@]}"; do
for FILE in dependencies.yaml conda/environments/*.yaml; do
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_RAPIDS_SHORT_TAG_PEP440}.*/g" "${FILE}"
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_RAPIDS_SHORT_TAG_PEP440}.*,>=0.0.0a0/g" "${FILE}"
done
sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_RAPIDS_SHORT_TAG_PEP440}\.*\"/g" python/pyproject.toml
sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_RAPIDS_SHORT_TAG_PEP440}\.*\"/g" python/distributed-ucxx/pyproject.toml
sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_RAPIDS_SHORT_TAG_PEP440}\.*,>=0.0.0a0\"/g" python/pyproject.toml
sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_RAPIDS_SHORT_TAG_PEP440}\.*,>=0.0.0a0\"/g" python/distributed-ucxx/pyproject.toml
done

UCXX_DEPENDENCIES=(
Expand All @@ -61,10 +59,10 @@ UCXX_DEPENDENCIES=(
)
for DEP in "${UCXX_DEPENDENCIES[@]}"; do
for FILE in dependencies.yaml; do
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}.*/g" "${FILE}"
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}.*/,>=0.0.0a0/g" "${FILE}"
done
sed_runner "/\"${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}\.*\"/g" python/pyproject.toml
sed_runner "/\"${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}\.*\"/g" python/distributed-ucxx/pyproject.toml
sed_runner "/\"${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}\.*,>=0.0.0a0\"/g" python/pyproject.toml
sed_runner "/\"${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}\.*,>=0.0.0a0\"/g" python/distributed-ucxx/pyproject.toml
done

# rapids-cmake version
Expand Down
2 changes: 1 addition & 1 deletion ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rapids-logger "Create test conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key test_cpp \
--file-key test_cpp \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n test
Expand Down
2 changes: 1 addition & 1 deletion ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rapids-logger "Create test conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key test_python \
--file-key test_python \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n test
Expand Down
2 changes: 1 addition & 1 deletion ci/test_python_distributed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rapids-logger "Create test conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key test_python_distributed \
--file-key test_python_distributed \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n test
Expand Down
6 changes: 5 additions & 1 deletion ci/test_wheel_distributed_ucxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"

RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist
ucxx_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="ucxx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-ucxx-dep)
python -m pip install -v "$(echo ./dist/${package_name}_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]"

python -m pip install \
-v \
"${ucxx_wheelhouse}"/ucxx_${RAPIDS_PY_CUDA_SUFFIX}*.whl \
"$(echo ./dist/${package_name}_${RAPIDS_PY_CUDA_SUFFIX}*.whl)[test]"

rapids-logger "Distributed Tests"

Expand Down
13 changes: 7 additions & 6 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ dependencies:
- cmake>=3.26.4
- cuda-version=11.8
- cudatoolkit
- cudf==24.8.*
- cudf==24.8.*,>=0.0.0a0
- cupy>=12.0.0
- cxx-compiler
- cython>=3.0.0
- dask-cuda==24.8.*
- dask-cudf==24.8.*
- dask-cuda==24.8.*,>=0.0.0a0
- dask-cudf==24.8.*,>=0.0.0a0
- doxygen=1.9.1
- fmt>=10.1.1,<11
- librmm==24.8.*
- librmm==24.8.*,>=0.0.0a0
- libtool
- ninja
- numba>=0.57.1
Expand All @@ -35,8 +35,9 @@ dependencies:
- pytest-rerunfailures
- pytest==7.*
- python>=3.9,<3.12
- rapids-dask-dependency==24.8.*
- rmm==24.8.*
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==24.8.*,>=0.0.0a0
- rmm==24.8.*,>=0.0.0a0
- scikit-build-core>=0.7.0
- setuptools>=64.0.0
- spdlog>=1.12.0,<1.13
Expand Down
13 changes: 7 additions & 6 deletions conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ dependencies:
- cmake>=3.26.4
- cuda-cudart-dev
- cuda-version=12.2
- cudf==24.8.*
- cudf==24.8.*,>=0.0.0a0
- cupy>=12.0.0
- cxx-compiler
- cython>=3.0.0
- dask-cuda==24.8.*
- dask-cudf==24.8.*
- dask-cuda==24.8.*,>=0.0.0a0
- dask-cudf==24.8.*,>=0.0.0a0
- doxygen=1.9.1
- fmt>=10.1.1,<11
- librmm==24.8.*
- librmm==24.8.*,>=0.0.0a0
- libtool
- ninja
- numba>=0.57.1
Expand All @@ -35,8 +35,9 @@ dependencies:
- pytest-rerunfailures
- pytest==7.*
- python>=3.9,<3.12
- rapids-dask-dependency==24.8.*
- rmm==24.8.*
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==24.8.*,>=0.0.0a0
- rmm==24.8.*,>=0.0.0a0
- scikit-build-core>=0.7.0
- setuptools>=64.0.0
- spdlog>=1.12.0,<1.13
Expand Down
3 changes: 3 additions & 0 deletions conda/recipes/ucxx/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ gmock:

gtest:
- ">=1.13.0"

rapids_version:
- "24.8.*"
9 changes: 6 additions & 3 deletions conda/recipes/ucxx/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ requirements:
- cuda-cudart-dev
{% endif %}
- cuda-version ={{ cuda_version }}
- rapids-build-backend >=0.3.0,<0.4.0.dev0
- ucx
- python
- librmm =24.08
- librmm {{ rapids_version }}

outputs:
- name: libucxx
Expand Down Expand Up @@ -225,7 +226,8 @@ outputs:
- numpy 1.23
- {{ pin_subpackage('libucxx', exact=True) }}
- ucx
- rmm =24.08
- rapids-build-backend >=0.3.0,<0.4.0.dev0
- rmm {{ rapids_version }}
- cuda-version {{ cuda_version }}
run:
- python * *_cpython
Expand Down Expand Up @@ -273,11 +275,12 @@ outputs:
host:
- python
- pip
- rapids-build-backend >=0.3.0,<0.4.0.dev0
- setuptools
- wheel
run:
- python * *_cpython
- rapids-dask-dependency =24.08
- rapids-dask-dependency {{ rapids_version }}
- {{ pin_subpackage('ucxx', max_pin='x.x') }}
test:
imports:
Expand Down
Loading