Ahhh, I think it is issue #15276 again (I don’t understand why @simd
was triggering it thought)! I thought that was presumably fixed in:
https://github.com/JuliaLang/julia/pull/24688
This fixes it:
function fillat!(a)
Threads.@thread for i2 in 1:size(a,2)
let i2=i2
@simd for i1 in 1:size(a,1)
@inbounds a[i1,i2]=i1/i2
end
end
end
end
[(n=10^i;a1=rand(n,n);a2=rand(n,n);t1=@elapsed filla!(a1);t2=@elapsed fillat!(a2);(t1,t2/t1,vecnorm(a2-a1))) for i=1:4]
(7.24e-7, 4.593922651933702, 0.0)
(3.2617e-5, 1.0026366618634455, 0.0)
(0.003374422, 0.984838885000157, 0.0)
(0.336461036, 0.9935467089270926, 0.0)
In case this proves useful to anyone