Skip to content

dpnp.cov() doesn't work on Iris XE #1379

Closed
@antonwolfy

Description

@antonwolfy

dpnp.cov function doesn't work on GPU device without double precision support:

In [1]: import dpnp as np

In [2]: x = np.array([[0, 2], [1, 1], [2, 0]]).T

In [3]: np.cov(x)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[3], line 1
----> 1 np.cov(x)

File ~/code/dpnp/dpnp/dpnp_iface_statistics.py:295, in cov(x1, y, rowvar, bias, ddof, fweights, aweights)
    293     else:
    294         if x1_desc.dtype != dpnp.float64:
--> 295             x1_desc = dpnp.get_dpnp_descriptor(dpnp.astype(x1, dpnp.float64), copy_when_nondefault_queue=False)
    297         return dpnp_cov(x1_desc).get_pyobj()
    299 return call_origin(numpy.cov, x1, y, rowvar, bias, ddof, fweights, aweights)

File ~/code/dpnp/dpnp/dpnp_iface.py:160, in astype(x1, dtype, order, casting, subok, copy)
    158 """Copy the array with data type casting."""
    159 if isinstance(x1, dpnp_array):
--> 160     return x1.astype(dtype, order=order, casting=casting, copy=copy)
    162 if isinstance(x1, dpt.usm_ndarray):
    163     return dpt.astype(x1, dtype, order=order, casting=casting, copy=copy)

File ~/code/dpnp/dpnp/dpnp_array.py:576, in dpnp_array.astype(self, dtype, order, casting, subok, copy)
    554 """Copy the array with data type casting.
    555
    556 Args:
   (...)
    572
    573 """
    575 new_array = self.__new__(dpnp_array)
--> 576 new_array._array_obj = dpt.astype(self._array_obj, dtype, order=order, casting=casting, copy=copy)
    577 return new_array

File ~/miniconda3/envs/dpnp_dev/lib/python3.9/site-packages/dpctl/tensor/_copy_utils.py:426, in astype(usm_ary, newdtype, order, casting, copy)
    421 else:
    422     raise ValueError(
    423         "Unrecognized value of the order keyword. "
    424         "Recognized values are 'A', 'C', 'F', or 'K'"
    425     )
--> 426 R = dpt.usm_ndarray(
    427     usm_ary.shape,
    428     dtype=target_dtype,
    429     buffer=usm_ary.usm_type,
    430     order=copy_order,
    431     buffer_ctor_kwargs={"queue": usm_ary.sycl_queue},
    432 )
    433 if order == "K" and (not c_contig and not f_contig):
    434     original_strides = usm_ary.strides

File dpctl/tensor/_usmarray.pyx:326, in dpctl.tensor._usmarray.usm_ndarray.__cinit__()

ValueError: Device Intel(R) Graphics [0x9a49] does not support float64 natively.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions