SpeedyWeather / SpeedyWeather.jl

Play atmospheric modelling like it's LEGO.
https://speedyweather.github.io/SpeedyWeather.jl/dev
MIT License
425 stars 26 forks source link

`@simd` in Legendre Transform? #162

Closed milankl closed 1 year ago

milankl commented 1 year ago

We currently have a @simd annotation in the Legendre Transform. However, following a suggestion from @hottad I've just checked whether this actually makes a difference given that we already use muladd. Using julia 1.8.2, Float32

julia> @btime SpeedyWeather.spectral!($alms,$map,$S);
  43.376 μs (107 allocations: 5.55 KiB)

with @simd and without:

julia> @btime SpeedyWeather.spectral!($alms,$map,$S);
  36.357 μs (107 allocations: 5.55 KiB)

Similar for Float64. So at the moment @simd makes things somewhat slower. I remember having introduced that as I got slower performance with Float32 compared to Float64 which reduced the problem. But maybe in the mean time some of these compiler issues got addressed.

milankl commented 1 year ago

f41681f experimentally removes the @simd from the Legendre transform. I believe this shouldn't actually change anything as we still use muladd anyway