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

Performance annotation docs shows SIMD slows down code by 10x #18231

Closed
ggggggggg opened this issue Aug 24, 2016 · 5 comments
Closed

Performance annotation docs shows SIMD slows down code by 10x #18231

ggggggggg opened this issue Aug 24, 2016 · 5 comments
Labels
docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia help wanted Indicates that a maintainer wants help on an issue or pull request
Milestone

Comments

@ggggggggg
Copy link
Contributor

At http://docs.julialang.org/en/latest/manual/performance-tips/#performance-annotations the docs talk about performance annotations. This section has a few confusing bits, which I'll list in order of decreasing importance.

The timings from the @simd example show @simd slowing down the code by almost 10x.

GFlop        = 1.9467069505224963
GFlop (SIMD) = 17.578554163920018

That seems like a poor result for something intended to speed up code.

The following example also confused me a few times, despite clearly showing @fastmath speeding up code

$ julia wave.jl
elapsed time: 1.207814709 seconds (0 bytes allocated)
4.443986180758243

$ julia --math-mode=ieee wave.jl
elapsed time: 4.487083643 seconds (0 bytes allocated)
4.443986180758243

While scanning the documentation to re-read sections my eye was drawn the the results 4.44... rather than the timings. This caused me to think that @fastmath had no effect on the timing, until I slowed down to read it more carefully. I think it would be worth changing the example somewhat so that the result and the slower time don't both start with the same number.

@vtjnash
Copy link
Member

vtjnash commented Aug 24, 2016

flops are 1/time, so that's a 10x speedup, not slowdown

@eschnett
Copy link
Contributor

The unit should probably be GFlop/sec instead of just GFlop, for clarity.

@eschnett
Copy link
Contributor

Regarding @fastmath: We should probably just add a semicolon ; to the command, which discards the output of the (here uninteresting) result.

@StefanKarpinski StefanKarpinski added the docs This change adds or pertains to documentation label Aug 25, 2016
@StefanKarpinski StefanKarpinski added this to the 0.5.x milestone Aug 25, 2016
@StefanKarpinski
Copy link
Member

So the fixes here seem to be:

  • change "GFlop" to "GFlop/sec"
  • note that larger is better for "GFlop/sec"
  • don't print return value for the wave.jl example

@StefanKarpinski StefanKarpinski added help wanted Indicates that a maintainer wants help on an issue or pull request good first issue Indicates a good issue for first-time contributors to Julia labels Aug 25, 2016
@ggggggggg
Copy link
Contributor Author

I see that misinterpreted the GFlop statement, hopefully my revealed ignorance will aid future readers.

eschnett added a commit that referenced this issue Aug 25, 2016
StefanKarpinski pushed a commit that referenced this issue Aug 26, 2016
tkelman pushed a commit that referenced this issue Aug 29, 2016
Closes #18231.
(cherry picked from commit 2961c4d)
mfasi pushed a commit to mfasi/julia that referenced this issue Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

4 participants