Skip to content

Commit

Permalink
Unpin dask and distributed for 23.12 development (#14320)
Browse files Browse the repository at this point in the history
This PR relaxes `dask` and `distributed` versions pinnings for `23.12` development.

Authors:
   - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
   - https://github.com/jakirkham
   - Peter Andreas Entschev (https://github.com/pentschev)
   - Ray Douglass (https://github.com/raydouglass)
  • Loading branch information
galipremsagar authored Oct 26, 2023
1 parent 203f1df commit 2e85a3f
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 67 deletions.
2 changes: 1 addition & 1 deletion ci/test_wheel_dask_cudf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RAPIDS_PY_WHEEL_NAME="cudf_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from
python -m pip install --no-deps ./local-cudf-dep/cudf*.whl

# Always install latest dask for testing
python -m pip install git+https://github.com/dask/dask.git@2023.9.2 git+https://github.com/dask/distributed.git@2023.9.2 git+https://github.com/rapidsai/[email protected]
python -m pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]

# echo to expand wildcard before adding `[extra]` requires for pip
python -m pip install $(echo ./dist/dask_cudf*.whl)[test]
Expand Down
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ dependencies:
- cupy>=12.0.0
- cxx-compiler
- cython>=3.0.0
- dask-core==2023.9.2
- dask-core>=2023.9.2
- dask-cuda==23.12.*
- dask==2023.9.2
- distributed==2023.9.2
- dask>=2023.9.2
- distributed>=2023.9.2
- dlpack>=0.5,<0.6.0a0
- doxygen=1.9.1
- fastavro>=0.22.9
Expand Down
6 changes: 3 additions & 3 deletions conda/environments/all_cuda-120_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ dependencies:
- cupy>=12.0.0
- cxx-compiler
- cython>=3.0.0
- dask-core==2023.9.2
- dask-core>=2023.9.2
- dask-cuda==23.12.*
- dask==2023.9.2
- distributed==2023.9.2
- dask>=2023.9.2
- distributed>=2023.9.2
- dlpack>=0.5,<0.6.0a0
- doxygen=1.9.1
- fastavro>=0.22.9
Expand Down
6 changes: 3 additions & 3 deletions conda/recipes/custreamz/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ requirements:
- streamz
- cudf ={{ version }}
- cudf_kafka ={{ version }}
- dask ==2023.9.2
- dask-core ==2023.9.2
- distributed ==2023.9.2
- dask >=2023.9.2
- dask-core >=2023.9.2
- distributed >=2023.9.2
- python-confluent-kafka >=1.9.0,<1.10.0a0
- {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}

Expand Down
12 changes: 6 additions & 6 deletions conda/recipes/dask-cudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ requirements:
host:
- python
- cudf ={{ version }}
- dask ==2023.9.2
- dask-core ==2023.9.2
- distributed ==2023.9.2
- dask >=2023.9.2
- dask-core >=2023.9.2
- distributed >=2023.9.2
- cuda-version ={{ cuda_version }}
run:
- python
- cudf ={{ version }}
- dask ==2023.9.2
- dask-core ==2023.9.2
- distributed ==2023.9.2
- dask >=2023.9.2
- dask-core >=2023.9.2
- distributed >=2023.9.2
- {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}

test:
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/dask-cudf/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ "${ARCH}" = "aarch64" ]; then
fi

# Dask & Distributed option to install main(nightly) or `conda-forge` packages.
export INSTALL_DASK_MAIN=0
export INSTALL_DASK_MAIN=1

# Dask version to install when `INSTALL_DASK_MAIN=0`
export DASK_STABLE_VERSION="2023.9.2"
Expand Down
6 changes: 3 additions & 3 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,12 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- dask==2023.9.2
- distributed==2023.9.2
- dask>=2023.9.2
- distributed>=2023.9.2
- output_types: conda
packages:
- cupy>=12.0.0
- dask-core==2023.9.2 # dask-core in conda is the actual package & dask is the meta package
- dask-core>=2023.9.2 # dask-core in conda is the actual package & dask is the meta package
- output_types: pyproject
packages:
- &cudf cudf==23.12.*
Expand Down
80 changes: 35 additions & 45 deletions python/dask_cudf/dask_cudf/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import dask.dataframe as dd
from dask import config
from dask.array.dispatch import percentile_lookup
from dask.dataframe.backends import (
DataFrameBackendEntrypoint,
PandasBackendEntrypoint,
Expand Down Expand Up @@ -320,56 +321,45 @@ def get_grouper_cudf(obj):
return cudf.core.groupby.Grouper


try:
try:
from dask.array.dispatch import percentile_lookup
except ImportError:
from dask.dataframe.dispatch import (
percentile_dispatch as percentile_lookup,
)

@percentile_lookup.register((cudf.Series, cp.ndarray, cudf.BaseIndex))
@_dask_cudf_nvtx_annotate
def percentile_cudf(a, q, interpolation="linear"):
# Cudf dispatch to the equivalent of `np.percentile`:
# https://numpy.org/doc/stable/reference/generated/numpy.percentile.html
a = cudf.Series(a)
# a is series.
n = len(a)
if not len(a):
return None, n
if isinstance(q, Iterator):
q = list(q)

if cudf.api.types.is_categorical_dtype(a.dtype):
result = cp.percentile(a.cat.codes, q, interpolation=interpolation)

return (
pd.Categorical.from_codes(
result, a.dtype.categories, a.dtype.ordered
),
n,
)
if np.issubdtype(a.dtype, np.datetime64):
result = a.quantile(
[i / 100.0 for i in q], interpolation=interpolation
)
@percentile_lookup.register((cudf.Series, cp.ndarray, cudf.BaseIndex))
@_dask_cudf_nvtx_annotate
def percentile_cudf(a, q, interpolation="linear"):
# Cudf dispatch to the equivalent of `np.percentile`:
# https://numpy.org/doc/stable/reference/generated/numpy.percentile.html
a = cudf.Series(a)
# a is series.
n = len(a)
if not len(a):
return None, n
if isinstance(q, Iterator):
q = list(q)

if cudf.api.types.is_categorical_dtype(a.dtype):
result = cp.percentile(a.cat.codes, q, interpolation=interpolation)

if q[0] == 0:
# https://github.com/dask/dask/issues/6864
result[0] = min(result[0], a.min())
return result.to_pandas(), n
if not np.issubdtype(a.dtype, np.number):
interpolation = "nearest"
return (
a.quantile(
[i / 100.0 for i in q], interpolation=interpolation
).to_pandas(),
pd.Categorical.from_codes(
result, a.dtype.categories, a.dtype.ordered
),
n,
)
if np.issubdtype(a.dtype, np.datetime64):
result = a.quantile(
[i / 100.0 for i in q], interpolation=interpolation
)

except ImportError:
pass
if q[0] == 0:
# https://github.com/dask/dask/issues/6864
result[0] = min(result[0], a.min())
return result.to_pandas(), n
if not np.issubdtype(a.dtype, np.number):
interpolation = "nearest"
return (
a.quantile(
[i / 100.0 for i in q], interpolation=interpolation
).to_pandas(),
n,
)


@pyarrow_schema_dispatch.register((cudf.DataFrame,))
Expand Down
4 changes: 2 additions & 2 deletions python/dask_cudf/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ requires-python = ">=3.9"
dependencies = [
"cudf==23.12.*",
"cupy-cuda11x>=12.0.0",
"dask==2023.9.2",
"distributed==2023.9.2",
"dask>=2023.9.2",
"distributed>=2023.9.2",
"fsspec>=0.6.0",
"numpy>=1.21,<1.25",
"pandas>=1.3,<1.6.0dev0",
Expand Down

0 comments on commit 2e85a3f

Please sign in to comment.