TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What every scientific programmer should know about compiler optimizations?

94 pointsby blopeuralmost 5 years ago

8 comments

chrisaycockalmost 5 years ago
The paper covers inefficiencies in compiler-generated binaries, either from missed optimization opportunities or from the compiler&#x27;s own poor code generation.<p>The paper shows that some of these perceived inefficiencies can be resolved by manual changes on a few lines of code, such as eliminating redundancies. However, the paper then demonstrates that such manual changes can sometimes make the results <i>worse</i> because a particular compiler might not be able to perform inlining or vectorization.<p>The paper concludes the optimization study by stating, &quot;no compiler is better or worse than another production compiler in all cases.&quot; (The study was on GCC, LLVM, and ICC.)
评论 #23683381 未加载
ISLalmost 5 years ago
A lesson I learned as an undergraduate: Sometimes changing optimization settings can yield different answers.<p>It&#x27;s been ~17 years since then, so I can&#x27;t recall the options used, but seeing different results emerge when I used a higher optimization option caused an unanticipated puff of smoke from my little brain.<p>A possible moral of the story -- test every little change.
评论 #23680743 未加载
评论 #23684284 未加载
gnufxalmost 5 years ago
I&#x27;ve skimmed the paper, and I&#x27;m not sure what to make of it. Definitely you need tools, but even basic profiling is a good start and quite rare. Suggesting changing source code because of the behaviour of a particular compiler version&#x27;s optimizer is a bad idea generally, especially without checking the optimization reports and investigating tuning the available parameters, like cost models. Optimizers can be quite unstable for good reasons.<p>The paper isn&#x27;t concentrating on what are probably the two most important performance governors these days, vectorization and fitting the memory hierarchy, which can make a factor of several difference. (&quot;Your mileage may vary&quot;, of course.) Then it isn&#x27;t obvious whether comparing different generations of compilers was even sufficiently controlled; their default tuning may be for different micro-architectures which were considered the most relevant at the time. GCC performance regressions are monitored by maintainers, but I wonder what real optimization bugs uncovered in a maintained version have been reported as such from this sort of work.<p>In large scale scientific code, such compiler optimizations may be relatively unimportant anyway compared with time spent in libraries of various sorts: numerical (like BLAS, FFT), MPI communication, and filesystem i&#x2F;o. Or not: you must measure and understand the measurements, which is what users need to be told over and over.
blopeuralmost 5 years ago
Video : <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YbHzM6bNTXk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YbHzM6bNTXk</a><p>CCTLib - Framework for fine-grained monitoring and execution-wide call path collection. : <a href="https:&#x2F;&#x2F;github.com&#x2F;CCTLib" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CCTLib</a>
fortran77almost 5 years ago
Why does this title have a question mark at the end? (The ACM did it -- it was copied accurately here?)
neonatealmost 5 years ago
Pdf: <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3392717.3392754" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3392717.3392754</a>
zoomablemindalmost 5 years ago
How does this pan out for major sci libraries, like NAG, IMSL&#x2F;MKL, GSL, BLAS, LAPACK etc.? Do distributions control the optimization levels used with a particular compiler, or just make sure it simply passes the tests?
ketanhwralmost 5 years ago
I&#x27;m seeing these kind of titles (what every X programmer should know about Y) quite frequently which seems like the trend of adding &quot;for humans&quot; in front of library names.
评论 #23682024 未加载
评论 #23680663 未加载
评论 #23681080 未加载
评论 #23682798 未加载
评论 #23682194 未加载