Open SultanOrazbayev opened 5 years ago
Two questions:
import sparse
import numba
import numpy as np
numba.__version__, sparse.__version__
>('0.44.0', '0.7.0')
x=sparse.COO(np.random.rand(5*10**2, 5*10**2)).astype(np.float16)
y = sparse.dot(x,x)
z = sparse.dot(y,y)
np.float32
, np.float_
, np.int_
... Actually, it seems that the only dtype the code doesn't work for is np.float16
.Okay. Then let me give you a bit of background: float16
is a bit of an oddball. It doesn’t exist in the C language (and neither in most others) and CPUs don’t have hardware instructions for it (GPUs do). CPUs just cast to float32
, do the operations, and convert back.
I’ll try to get a reproducer for this and report it to the Numba team (who are responsible for this bug) but I suspect it will be a low priority.
In the meantime, I suggest you don’t worry too much about memory footprint: The coordinates are stored as intp
and you’re unlikely to get much savings because of that.
Thanks!
xref numba/numba#4402
Hello, I am trying to reduce the memory footprint of the matrices containing small integers, and want to set the
dtype
tonp.int8
ornp.float16
.This is the error I get: