Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number format-flexibility #137

Closed
milankl opened this issue Sep 2, 2022 · 2 comments
Closed

Number format-flexibility #137

milankl opened this issue Sep 2, 2022 · 2 comments
Labels
low precision 🚂 Low precision arithmetics, rounding, 32 or 16-bit. transform ⬅️ ➡️ Our spherical harmonic transform, grid to spectral, spectral to grid
Milestone

Comments

@milankl
Copy link
Member

milankl commented Sep 2, 2022

As raised in #31 and #77, v0.3 is still not fully number format flexible. Main bottleneck is the Fourier Transform as FFTW.jl only supports Float32/64. For other formats we'd need to fall back to GenericFFT.jl. #136 addresses that, but there's more that needs to be done. This issue is to collect efforts to remove remaining type instabilities

julia> using SoftPosit

julia> run_speedy(Posit16)
ERROR: promotion of types Float64 and Posit16 failed to change any arguments
Stacktrace:
  [1] error(::String, ::String, ::String)
    @ Base ./error.jl:44
  [2] sametype_error(input::Tuple{Float64, Posit16})
    @ Base ./promotion.jl:383
  [3] not_sametype(x::Tuple{Float64, Posit16}, y::Tuple{Float64, Posit16})
    @ Base ./promotion.jl:377
  [4] promote
    @ ./promotion.jl:360 [inlined]
  [5] -(x::Float64, y::Posit16)
    @ Base ./promotion.jl:390
  [6] broadcasted(#unused#::Base.Broadcast.DefaultArrayStyle{1}, #unused#::typeof(-), r::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, x::Posit16)
    @ Base.Broadcast ./broadcast.jl:1110
  [7] broadcasted
    @ ./broadcast.jl:1304 [inlined]
  [8] generalised_logistic(x::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, coefs::Main.SpeedyWeather.GenLogisticCoefs{Posit16})
    @ Main.SpeedyWeather ~/git/SpeedyWeather.jl/src/geometry.jl:195
  [9] vertical_coordinates(P::Parameters)
    @ Main.SpeedyWeather ~/git/SpeedyWeather.jl/src/geometry.jl:184
@milankl milankl added low precision 🚂 Low precision arithmetics, rounding, 32 or 16-bit. transform ⬅️ ➡️ Our spherical harmonic transform, grid to spectral, spectral to grid labels Sep 2, 2022
@milankl milankl added this to the v0.4 milestone Sep 2, 2022
@milankl milankl modified the milestones: v0.4, v0.5 Oct 13, 2022
@milankl milankl modified the milestones: v0.5, v0.6 May 13, 2023
@milankl milankl modified the milestones: v0.6, v0.7 Aug 30, 2023
@milankl
Copy link
Member Author

milankl commented Sep 1, 2023

While this still blows up it doesn't actually throw any errors

image

So it does sound that the number format flexibility is actually solved, it's "just" precision-range issues with low-precision formats that don't work.

@milankl milankl mentioned this issue Sep 7, 2023
@milankl
Copy link
Member Author

milankl commented Nov 7, 2023

#407 has an example of a T21 run with BFloat16, hence closing this rather general issue in favour for future more specific issues on low precision simulations.

@milankl milankl closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low precision 🚂 Low precision arithmetics, rounding, 32 or 16-bit. transform ⬅️ ➡️ Our spherical harmonic transform, grid to spectral, spectral to grid
Projects
None yet
Development

No branches or pull requests

1 participant