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

Handle some zero-sized corner cases in dlpack interop #11449

Merged
merged 22 commits into from
Sep 6, 2022
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
305ca9b
Remove use of deprecated cupy.fromDlPack
wence- Aug 2, 2022
d71e561
dlpack: Handle corner case of size zero arrays
wence- Aug 1, 2022
1fb41f2
Remove unnecessary comment
wence- Aug 18, 2022
77ce0bb
dlpack: Report zero strides for empty 2D tensors
wence- Aug 18, 2022
e085b3a
DO NOT MERGE: allow cupy>=11
wence- Aug 18, 2022
bab34c8
DO NOT MERGE: test cupy 11 in build environment
wence- Aug 19, 2022
52a6106
Update meta.yaml
galipremsagar Aug 19, 2022
cbe1b48
Update setup.py
galipremsagar Aug 19, 2022
e63870a
Update setup.py
galipremsagar Aug 19, 2022
933548d
Update conda/environments/cudf_dev_cuda11.5.yml
galipremsagar Aug 19, 2022
6c51839
Update build.sh
galipremsagar Aug 19, 2022
8034704
Update build.sh
galipremsagar Aug 19, 2022
1648140
dlpack/test: Zero-sized tensors have strides = 0
wence- Aug 22, 2022
74a0b6a
Merge remote-tracking branch 'origin/branch-22.10' into wence/fix/dlp…
wence- Aug 22, 2022
2200b3a
Update buffer interop tests for cupy 11
wence- Aug 22, 2022
ec60ae9
xfail empty dataframe reduction on cupy 11.0
wence- Aug 23, 2022
5c0d698
update multiindex cupy docstring for cupy11
quasiben Aug 23, 2022
58152a5
Revert changes to CI build scripts
wence- Aug 25, 2022
4568162
Handle both cupy 10 and 11 in multiindex doctest
wence- Aug 26, 2022
0879cf2
Backwards-compat for cupy<10 in tests of dlpack interop
wence- Sep 1, 2022
48937ba
rename from_dlpack alias to cupy_from_dlpack
wence- Sep 1, 2022
e24dc97
Merge remote-tracking branch 'origin/branch-22.10' into wence/fix/dlp…
wence- Sep 1, 2022
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
18 changes: 13 additions & 5 deletions python/cudf/cudf/tests/test_dlpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import cupy
import numpy as np
import pytest
from packaging import version

import cudf
from cudf.testing._utils import assert_eq
Expand All @@ -19,6 +20,13 @@
params_2d = itertools.product(ncols, nelems, dtype, nulls)


if version.parse(cupy.__version__) < version.parse("10"):
# fromDlpack deprecated in cupy version 10, replaced by from_dlpack
from_dlpack = cupy.fromDlpack
wence- marked this conversation as resolved.
Show resolved Hide resolved
else:
from_dlpack = cupy.from_dlpack


def data_size_expectation_builder(data, nan_null_param=False):
if nan_null_param and np.isnan(data).any():
return pytest.raises((ValueError,))
Expand Down Expand Up @@ -107,7 +115,7 @@ def test_to_dlpack_cupy_1d(data_1d):
cudf_host_array = gs.to_numpy(na_value=np.nan)
dlt = gs.to_dlpack()

cupy_array = cupy.from_dlpack(dlt)
cupy_array = from_dlpack(dlt)
cupy_host_array = cupy_array.get()

assert_eq(cudf_host_array, cupy_host_array)
Expand All @@ -121,7 +129,7 @@ def test_to_dlpack_cupy_2d(data_2d):
cudf_host_array = np.array(gdf.to_pandas()).flatten()
dlt = gdf.to_dlpack()

cupy_array = cupy.from_dlpack(dlt)
cupy_array = from_dlpack(dlt)
cupy_host_array = cupy_array.get().flatten()

assert_eq(cudf_host_array, cupy_host_array)
Expand Down Expand Up @@ -157,7 +165,7 @@ def test_to_dlpack_cupy_2d_null(data_2d):
cudf_host_array = np.array(gdf.to_pandas()).flatten()
dlt = gdf.to_dlpack()

cupy_array = cupy.from_dlpack(dlt)
cupy_array = from_dlpack(dlt)
cupy_host_array = cupy_array.get().flatten()

assert_eq(cudf_host_array, cupy_host_array)
Expand All @@ -171,7 +179,7 @@ def test_to_dlpack_cupy_1d_null(data_1d):
cudf_host_array = gs.to_numpy(na_value=np.nan)
dlt = gs.to_dlpack()

cupy_array = cupy.from_dlpack(dlt)
cupy_array = from_dlpack(dlt)
cupy_host_array = cupy_array.get()

assert_eq(cudf_host_array, cupy_host_array)
Expand All @@ -183,7 +191,7 @@ def test_to_dlpack_mixed_dtypes():
cudf_host_array = df.to_numpy()
dlt = df.to_dlpack()

cupy_array = cupy.from_dlpack(dlt)
cupy_array = from_dlpack(dlt)
cupy_host_array = cupy_array.get()

assert_eq(cudf_host_array, cupy_host_array)
Expand Down