numba-dpex
numba-dpex copied to clipboard
numba-dpex doesn't support zero-length array creation
If we look at dpnp and numpy, they support zero-length array creation (i.e. shape is 0)
>>> import numpy as np
>>> a = np.empty(0)
>>> a
array([], dtype=float64)
>>> import dpnp
>>> a = dpnp.empty(0)
>>> a
array([])
numba-dpex should do the same.
@dpjit
def foo():
x = dpnp.empty(0)
return x
a = foo()
print(a)
but it doesn't:
Traceback (most recent call last):
File "/localdisk/work/$USER/numba-dpex/my-driver.py", line 20, in <module>
a = bar()
MemoryError: USM allocation failed. Check the usm_type and queue.
This is applicable all other array creation functions, zeros(), ones(), etc.