Re:CuPy Accelerates NumPy on the GPU? Hold My Cider, Here's ...
by jsdavo on Friday April 10, 2020 @06:41AM
(#22831687)
Thanks for sharing! Why does CuPy switch to float64 in this case? Is it a bug?
[ Parent
| on HN ]
Re:CuPy Accelerates NumPy on the GPU? Hold My Cider, Here's ...
by akssri on Friday April 10, 2020 @07:00AM
(#22831771)
Numpy/Cupy do explicit coercing to float64. There is no documentation for why this is done, but since GEMM is used to compute the covariates (summation over data points), it makes sense to increase the precision.
You could get away using a double to only accumulate the sum, but it's a pain to write such mixed-precision (slow) function in C and then wrap it in Python, esp. for something like this.
(See, https://github.com/numpy/numpy/blob/v1.17.0/numpy/lib/functi...)
Re:CuPy Accelerates NumPy on the GPU? Hold My Cider, Here's ...
by fluffything on Friday April 10, 2020 @01:55PM
(#22835497)
CuPy is a drop in replacement for NumPy. Ask Numpy why they do that.