Fix rounding problems in _mean function#453
Fix rounding problems in _mean function#453gabrielpreviato wants to merge 1 commit intoJuliaGPU:masterfrom
Conversation
|
Note that I can't reproduce this, I get What #443 was trying to avoid is allocating two arrays for the output. I think it will also be more prone to overflow, as here: JuliaGPU/CUDA.jl#1773 (comment) |
|
Without fully understanding what the actual cause is we shouldn't just revert the change from #443. |
That we can do by using |
Indeed. Maybe #443 was concerned about making more kernel launches? Never very sure what's going to be fast or not in GPU land.
Thinking more... acting on |
As stated in JuliaGPU/CUDA.jl#1773, with the current _mean function, for bigger arrays you get some rounding problems.
This PR changes the order of the multiplication operation, once multiplying them before summing can cause some loss of precision with smaller numbers.
Performance wise I can't say the difference it may cause (I'm not an expert on Julia operation performance). If anyone has ideas how to test it, I'm open to learn and try.