nv-legate / cupynumeric

An Aspiring Drop-In Replacement for NumPy at Scale
https://docs.nvidia.com/cupynumeric
Apache License 2.0
623 stars 71 forks source link

[BUG] unique does not support axis argument #1146

Open suranap opened 3 months ago

suranap commented 3 months ago

Software versions

Python : 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] Platform : Linux-5.4.0-169-generic-x86_64-with-glibc2.31 Legion : legion-24.03.0 Legate : 24.01.00.dev+38.g90944d7.dirty Cunumeric : 24.01.00.dev+32.g364e95dc.dirty Numpy : 1.26.4 Scipy : 1.13.1 Numba : 0.59.1 CTK package : cuda-version-11.7-h67201e3_3 (conda-forge) GPU driver : 535.54.03 GPU devices : GPU 0: Tesla P100-SXM2-16GB GPU 1: Tesla P100-SXM2-16GB GPU 2: Tesla P100-SXM2-16GB GPU 3: Tesla P100-SXM2-16GB

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

>>> import numpy as np
>>> tmp = list(range(20))
>>> np.unique(np.array(tmp).reshape(10,2), axis=0)
array([[ 0,  1],
       [ 2,  3],
       [ 4,  5],
       [ 6,  7],
       [ 8,  9],
       [10, 11],
       [12, 13],
       [14, 15],
       [16, 17],
       [18, 19]])

Observed behavior

>>> import cunumeric as cnp
>>> cnp.unique(np.array(tmp).reshape(10,2), axis=0)
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19])

Furthermore, I ran numpy's tests against cunumeric. PyTest reports the following errors for TestUnique:

FAILED test_arraysetops.py::TestUnique::test_unique_1d - NotImplementedError: cuNumeric does not support dtype=float128
FAILED test_arraysetops.py::TestUnique::test_unique_axis_errors - NotImplementedError: cuNumeric does not support dtype=object
FAILED test_arraysetops.py::TestUnique::test_unique_axis_list - AssertionError:
FAILED test_arraysetops.py::TestUnique::test_unique_axis - AssertionError:
FAILED test_arraysetops.py::TestUnique::test_unique_axis_zeros - AssertionError:
FAILED test_arraysetops.py::TestUnique::test_unique_masked - NotImplementedError: Keyword arguments for `unique` are not yet supported
FAILED test_arraysetops.py::TestUnique::test_unique_sort_order_with_axis - AssertionError:
FAILED test_arraysetops.py::TestUnique::test_unique_nanequals - TypeError: unique() got an unexpected keyword argument 'equal_nan'

In fact, you could port all the tests from numpy to check how you're doing on compatibility.

Example code or instructions

see above

Stack traceback or browser console output

No response