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

Add Float16 support? #30

Closed
milankl opened this issue Apr 14, 2021 · 2 comments
Closed

Add Float16 support? #30

milankl opened this issue Apr 14, 2021 · 2 comments

Comments

@milankl
Copy link
Contributor

milankl commented Apr 14, 2021

Running the following on an A64FX with native Float16 support yields

julia> @count_ops run_model(Float32,Ndays=5)
Starting ShallowWaters on Wed, 14 Apr 2021 05:36:36 without output.
60% Integration done in 1min, 22s.
Flop Counter: 221063593 flop
┌────────┬──────────┬─────────┐
│        │  Float32 │ Float64 │
├────────┼──────────┼─────────┤
│ muladd │        0333040 │
│    add │ 9173456572271 │
│    sub │ 22795413166263 │
│    mul │ 97619024244707 │
│    div │  258065381624 │
│    rem │        048 │
│    abs │        059320 │
│    neg │  499000048775 │
│   sqrt │        04850 │
└────────┴──────────┴─────────┘

julia> @count_ops run_model(Float16,Ndays=5)
Starting ShallowWaters on Wed, 14 Apr 2021 05:50:17 without output.
60% Integration done in 1min, 23s.
Flop Counter: 6919066 flop
┌────────┬─────────┬─────────┐
│        │ Float32 │ Float64 │
├────────┼─────────┼─────────┤
│ muladd │       0333040 │
│    add │       072271 │
│    sub │       0166263 │
│    mul │ 5575128244707 │
│    div │       081624 │
│    rem │       048 │
│    abs │       059320 │
│    neg │       048775 │
│   sqrt │       04850 │
└────────┴─────────┴─────────┘

The second executes every Float32 in Float16, but there are not counted. I'd be happy to test this on A64FX if there's interest to include Float16 support.

@milankl
Copy link
Contributor Author

milankl commented Apr 14, 2021

Would it be enough to add (Float16, :16) here?

GFlops.jl/src/overdub.jl

Lines 26 to 29 in 03f2429

const typs = (
(Float32, :32),
(Float64, :64),
)

@milankl
Copy link
Contributor Author

milankl commented Apr 14, 2021

That seems to work on A64FX (UPDATE: x86 via LLVM's half yields identical results)

julia> @count_ops run_model(Float16,Ndays=5,scale=64)
Starting ShallowWaters on Wed, 14 Apr 2021 06:57:44 without output.
60% Integration done in 1min, 24s.
Flop Counter: 221063563 flop
┌────────┬──────────┬─────────┬─────────┐
│        │  Float16 │ Float32 │ Float64 │
├────────┼──────────┼─────────┼─────────┤
│ muladd │        00333040 │
│    add │ 91734565072271 │
│    sub │ 227953830166263 │
│    mul │ 920438965575128244707 │
│    div │  2580653081624 │
│    rem │        0048 │
│    abs │        0059320 │
│    neg │  4990000048775 │
│   sqrt │        004850 │
└────────┴──────────┴─────────┴─────────┘

PR coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant