From 72e37e41fc6eeb65111780ec085784edd8e4c2aa Mon Sep 17 00:00:00 2001 From: Divye Gala Date: Fri, 5 May 2023 17:37:21 -0400 Subject: [PATCH] Support CUDA 12.0 for pip wheels (#13289) In addition to switching to the new workflow for building on CUDA 12 images, this PR includes changes to: - Use a CUDA version-specific package name when downloading cudf during dask-cudf testing - Update pyproject dependencies for packages that are either unnecessary in CUDA 12 (ptxcompiler/cubinlinker) or need different names/versions (cuda-python or cupy-cuda11x vs 12x). - Add an upper bound pinning on numpy. numpy 1.24.3 adds some deprecation warnings that cause our test suite to fail. Addressing these is being worked on in parallel. - Ensure that cubinlinker is never imported when it is not available. Authors: - Divye Gala (https://github.com/divyegala) - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) - Peter Andreas Entschev (https://github.com/pentschev) URL: https://github.com/rapidsai/cudf/pull/13289 --- .github/workflows/build.yaml | 8 ++++---- .github/workflows/pr.yaml | 14 ++++++-------- .github/workflows/test.yaml | 5 ++--- ci/release/apply_wheel_modifications.sh | 8 ++++++++ conda/environments/all_cuda-118_arch-x86_64.yaml | 2 +- conda/recipes/cudf/meta.yaml | 2 +- dependencies.yaml | 5 +++-- python/cudf/cudf/core/udf/utils.py | 12 ++++++++---- python/cudf/pyproject.toml | 4 ++-- python/cudf_kafka/pyproject.toml | 2 +- python/dask_cudf/pyproject.toml | 2 +- 11 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ead85373eaf..2d592d3f247 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,7 +66,7 @@ jobs: run_script: "ci/build_docs.sh" wheel-build-cudf: secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@cuda-120-pip with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -78,7 +78,7 @@ jobs: wheel-publish-cudf: needs: wheel-build-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-publish.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-publish.yml@cuda-120-pip with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -88,7 +88,7 @@ jobs: wheel-build-dask-cudf: needs: wheel-publish-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-build.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-build.yml@cuda-120-pip with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -99,7 +99,7 @@ jobs: wheel-publish-dask-cudf: needs: wheel-build-dask-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-publish.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-publish.yml@cuda-120-pip with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 3e4c5e2bcae..cc7309802a5 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -98,7 +98,7 @@ jobs: wheel-build-cudf: needs: checks secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@cuda-120-pip with: build_type: pull-request package-name: cudf @@ -107,30 +107,28 @@ jobs: wheel-tests-cudf: needs: wheel-build-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@cuda-120-pip with: build_type: pull-request package-name: cudf - # Install cupy-cuda11x for arm from a special index url - test-before-arm64: "python -m pip install 'cupy-cuda11x>=12.0.0' -f https://pip.cupy.dev/aarch64" test-unittest: "python -m pytest -n 8 ./python/cudf/cudf/tests" test-smoketest: "python ./ci/wheel_smoke_test_cudf.py" wheel-build-dask-cudf: needs: wheel-tests-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-build.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-build.yml@cuda-120-pip with: build_type: pull-request package-name: dask_cudf package-dir: python/dask_cudf - before-wheel: "RAPIDS_PY_WHEEL_NAME=cudf_cu11 rapids-download-wheels-from-s3 ./local-cudf && python -m pip install --no-deps ./local-cudf/cudf*.whl" + before-wheel: "RAPIDS_PY_WHEEL_NAME=cudf_${{ '${PIP_CU_VERSION}' }} rapids-download-wheels-from-s3 ./local-cudf && python -m pip install --no-deps ./local-cudf/cudf*.whl" wheel-tests-dask-cudf: needs: wheel-build-dask-cudf secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-test.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-test.yml@cuda-120-pip with: build_type: pull-request package-name: dask_cudf # Install the cudf we just built, and also test against latest dask/distributed/dask-cuda. - test-before: "RAPIDS_PY_WHEEL_NAME=cudf_cu11 rapids-download-wheels-from-s3 ./local-cudf-dep && python -m pip install --no-deps ./local-cudf-dep/cudf*.whl && pip install git+https://github.com/dask/dask.git@2023.3.2 git+https://github.com/dask/distributed.git@2023.3.2.1 git+https://github.com/rapidsai/dask-cuda.git@branch-23.06" + test-before: "RAPIDS_PY_WHEEL_NAME=cudf_${{ '${PIP_CU_VERSION}' }} rapids-download-wheels-from-s3 ./local-cudf-dep && python -m pip install --no-deps ./local-cudf-dep/cudf*.whl && pip install git+https://github.com/dask/dask.git@2023.3.2 git+https://github.com/dask/distributed.git@2023.3.2.1 git+https://github.com/rapidsai/dask-cuda.git@branch-23.06" test-unittest: "python -m pytest -n 8 ./python/dask_cudf/dask_cudf/tests" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ff1563d3c6e..6ac65fce9f3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,18 +79,17 @@ jobs: run_script: "ci/test_notebooks.sh" wheel-tests-cudf: secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-test.yml@cuda-120-pip with: build_type: nightly branch: ${{ inputs.branch }} date: ${{ inputs.date }} sha: ${{ inputs.sha }} package-name: cudf - test-before-arm64: "python -m pip install 'cupy-cuda11x>=12.0.0' -f https://pip.cupy.dev/aarch64" test-unittest: "python -m pytest -n 8 ./python/cudf/cudf/tests" wheel-tests-dask-cudf: secrets: inherit - uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-test.yml@manylinux_v2 + uses: rapidsai/shared-action-workflows/.github/workflows/wheels-pure-test.yml@cuda-120-pip with: build_type: nightly branch: ${{ inputs.branch }} diff --git a/ci/release/apply_wheel_modifications.sh b/ci/release/apply_wheel_modifications.sh index 0c55c4b9141..3de1814dfaf 100755 --- a/ci/release/apply_wheel_modifications.sh +++ b/ci/release/apply_wheel_modifications.sh @@ -22,3 +22,11 @@ sed -i "s/cubinlinker/cubinlinker${CUDA_SUFFIX}/g" python/cudf/pyproject.toml sed -i "s/^name = \"dask_cudf\"/name = \"dask_cudf${CUDA_SUFFIX}\"/g" python/dask_cudf/pyproject.toml # Need to provide the == to avoid modifying the URL sed -i "s/\"cudf==/\"cudf${CUDA_SUFFIX}==/g" python/dask_cudf/pyproject.toml + +if [[ $CUDA_SUFFIX == "-cu12" ]]; then + sed -i "s/cuda-python[<=>\.,0-9]*/cuda-python>=12.0,<13.0/g" python/cudf/pyproject.toml + sed -i "s/cupy-cuda11x/cupy-cuda12x/g" python/{cudf,dask_cudf}/pyproject.toml + sed -i "s/numba[<=>\.,0-9]*/numba>=0.57/g" python/{cudf,dask_cudf}/pyproject.toml + sed -i "/ptxcompiler/d" python/cudf/pyproject.toml + sed -i "/cubinlinker/d" python/cudf/pyproject.toml +fi diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 2c0b5448e80..5983aa4b267 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -48,7 +48,7 @@ dependencies: - ninja - notebook - numba>=0.56.4,<0.57 -- numpy>=1.21 +- numpy>=1.21,<1.24 - numpydoc - nvcc_linux-64=11.8 - nvtx>=0.2.1 diff --git a/conda/recipes/cudf/meta.yaml b/conda/recipes/cudf/meta.yaml index 327f7f90a82..af23750b516 100644 --- a/conda/recipes/cudf/meta.yaml +++ b/conda/recipes/cudf/meta.yaml @@ -66,7 +66,7 @@ requirements: - pandas >=1.3,<1.6.0dev0 - cupy >=12.0.0 - numba >=0.56.4,<0.57 - - numpy >=1.21 + - numpy>=1.21,<1.24 # Temporarily upper bound numpy to avoid overflow deprecations - {{ pin_compatible('pyarrow', max_pin='x.x.x') }} - libcudf {{ version }} - fastavro >=0.22.0 diff --git a/dependencies.yaml b/dependencies.yaml index 2c8b9430415..b23de2691ef 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -233,7 +233,7 @@ dependencies: # Hard pin the patch version used during the build. This must be kept # in sync with the version pinned in get_arrow.cmake. - pyarrow==11.0.0.* - - numpy>=1.21 + - numpy>=1.21,<1.24 # Temporarily upper bound numpy to avoid overflow deprecations build_python: common: - output_types: [conda, requirements, pyproject] @@ -341,7 +341,7 @@ dependencies: - output_types: [conda, requirements, pyproject] packages: - fsspec>=0.6.0 - - numpy>=1.21 + - numpy>=1.21,<1.24 # Temporarily upper bound numpy to avoid overflow deprecations - pandas>=1.3,<1.6.0dev0 run_cudf: common: @@ -395,6 +395,7 @@ dependencies: - distributed==2023.3.2.1 - output_types: conda packages: + - cupy>=12.0.0 - dask-core==2023.3.2 # dask-core in conda is the actual package & dask is the meta package - output_types: pyproject packages: diff --git a/python/cudf/cudf/core/udf/utils.py b/python/cudf/cudf/core/udf/utils.py index 0b7544752e2..d890b94127f 100644 --- a/python/cudf/cudf/core/udf/utils.py +++ b/python/cudf/cudf/core/udf/utils.py @@ -8,7 +8,6 @@ import cupy as cp import llvmlite.binding as ll import numpy as np -from cubinlinker.patch import _numba_version_ok, get_logger, new_patched_linker from cuda import cudart from numba import cuda, typeof from numba.core.datamodel import default_manager, models @@ -51,9 +50,6 @@ _cudf_str_dtype = dtype(str) -logger = get_logger() - - JIT_SUPPORTED_TYPES = ( NUMERIC_TYPES | BOOL_TYPES @@ -460,9 +456,17 @@ def _setup_numba_linker(path): def maybe_patch_numba_linker( driver_version, runtime_version, ptx_toolkit_version ): + from cubinlinker.patch import ( + _numba_version_ok, + get_logger, + new_patched_linker, + ) + # Numba thinks cubinlinker is only needed if the driver is older than # the ctk, but when PTX files are present, it might also need to patch # because those PTX files may newer than the driver as well + logger = get_logger() + if (driver_version < ptx_toolkit_version) or ( driver_version < runtime_version ): diff --git a/python/cudf/pyproject.toml b/python/cudf/pyproject.toml index 2a686fe3016..d13324a7404 100644 --- a/python/cudf/pyproject.toml +++ b/python/cudf/pyproject.toml @@ -6,7 +6,7 @@ requires = [ "cmake>=3.23.1,!=3.25.0", "cython>=0.29,<0.30", "ninja", - "numpy>=1.21", + "numpy>=1.21,<1.24", "protoc-wheel", "pyarrow==11.0.0.*", "rmm==23.6.*", @@ -32,7 +32,7 @@ dependencies = [ "cupy-cuda11x>=12.0.0", "fsspec>=0.6.0", "numba>=0.56.4,<0.57", - "numpy>=1.21", + "numpy>=1.21,<1.24", "nvtx>=0.2.1", "packaging", "pandas>=1.3,<1.6.0dev0", diff --git a/python/cudf_kafka/pyproject.toml b/python/cudf_kafka/pyproject.toml index d8b97f52864..df0825c846a 100644 --- a/python/cudf_kafka/pyproject.toml +++ b/python/cudf_kafka/pyproject.toml @@ -4,7 +4,7 @@ requires = [ "cython>=0.29,<0.30", - "numpy>=1.21", + "numpy>=1.21,<1.24", "pyarrow==11.0.0.*", "setuptools", "wheel", diff --git a/python/dask_cudf/pyproject.toml b/python/dask_cudf/pyproject.toml index c6c43661e9e..ff2a3f2d095 100644 --- a/python/dask_cudf/pyproject.toml +++ b/python/dask_cudf/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ "dask==2023.3.2", "distributed==2023.3.2.1", "fsspec>=0.6.0", - "numpy>=1.21", + "numpy>=1.21,<1.24", "pandas>=1.3,<1.6.0dev0", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. classifiers = [