-
Notifications
You must be signed in to change notification settings - Fork 9
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
Idea: a "FakeFloat" type to help counting ops in non-Julia code? #26
Comments
Maybe just comparing this idea to Sherlogs.jl which also creates some "FakeFloat"s (called Sherlog16,Sherlog32, Sherlogs64) to log the arithmetic results. So for Sherlogs the information whether it was an add/sub/mul etc is thrown away, but the result is logged (which includes a conversion to Float16, as 64/32-bit bitpattern histograms are just too large). I get fairly similar results julia> using GFlops, Sherlogs, ShallowWaters
julia> run_model(Float32,Ndays=5);
Starting ShallowWaters on Wed, 14 Apr 2021 11:27:21 without output.
60% Integration done in 0.05s.
julia> run_model(Sherlog32,Ndays=5);
Starting ShallowWaters on Wed, 14 Apr 2021 11:28:33 without output.
60% Integration done in 20.0s.
julia> lb = get_logbook();
julia> sum(lb)
219769755 So there are 219769755 flop done in Float32. Compared to julia> @count_ops run_model(Float32,Ndays=5)
Starting ShallowWaters on Wed, 14 Apr 2021 11:32:38 without output.
60% Integration done in 18.1s.
Flop Counter: 221073693 flop
┌────────┬──────────┬─────────┐
│ │ Float32 │ Float64 │
├────────┼──────────┼─────────┤
│ muladd │ 0 │ 333040 │
│ add │ 91734565 │ 72271 │
│ sub │ 22795413 │ 166263 │
│ mul │ 97629124 │ 244707 │
│ div │ 2580653 │ 81624 │
│ rem │ 0 │ 48 │
│ abs │ 0 │ 59320 │
│ neg │ 4990000 │ 48775 │
│ sqrt │ 0 │ 4850 │
└────────┴──────────┴─────────┘
julia> 91734565+22795413+97629124+2580653+4990000
219729755 There's somehow 40k operations missing here (not counting Float64 ops as they are part of the model set up and not counted in Sherlogs), but maybe more importantly note how the speeds are fairly comparable, while Sherlogs include a fairly costly conversion Float32->Float16. So just saying that I support the idea of having some |
Just wondering whether it would be worth implementing the idea prototyped in:
https://discourse.julialang.org/t/vector-matrix-vector-multiplication/57087/15?u=ffevotte
In any case, this issue is here to avoid forgetting about this topic...
The text was updated successfully, but these errors were encountered: