Tip for people who optimize their code

  • Thread starter Thread starter kroni
  • Start date Start date
  • Tags Tags
    Code
Click For Summary
SUMMARY

The discussion emphasizes the benefits of using the Intel Compiler and Intel Profiler for optimizing C++ code. The Intel Compiler offers inter-function optimization, powerful optimization techniques, and automatic partial parallelization, resulting in an average time gain of 30%. The Intel Profiler provides detailed, line-by-line performance analysis, including cache misses and prediction errors. The conversation also highlights the balance between time and memory usage in programming, advocating for the use of these tools to achieve significant performance improvements.

PREREQUISITES
  • Understanding of C++ programming language
  • Familiarity with optimization techniques in software development
  • Knowledge of compiler flags and their impact on performance
  • Basic concepts of profiling and performance analysis
NEXT STEPS
  • Explore Intel Compiler optimization flags and their effects on execution time
  • Learn how to use Intel Profiler for detailed performance analysis
  • Research inter-function optimization techniques in C++
  • Investigate the trade-offs between time and memory in algorithm design
USEFUL FOR

Software developers, performance engineers, and computer scientists focused on optimizing C++ applications and improving execution efficiency.

kroni
Messages
79
Reaction score
10
Hello everybody.

I am looking question for programming and computer science since 6 months and i see a lot of threat speaking about time consumption and optimization. I just want to say that INTEL COMPILER and INTEL PROFILER are available on intel website for FREE as a student license without trial time.

Intel compiler use inter function optimisation, powerfull optimisation, automatic partial parralélization. I see a mean of 30% time gain. (Don't forget to recompile the libs with it.)

Intel profiler give you a detailled (line by line) time description of your C++ file and give caches miss and if bad prédiction, and a lot of other interesting information.

When the algorithm and the program structure is optimized, you can reduce the time with this tool.
 
Technology news on Phys.org
Thank you for sharing this tip!

I think the optimization threads that you've seen probably have something to do with homework where students are learning the whys of writing a program a certain way. Optimization tools don't always catch all optimizations which look like valid programming.

In my experience there is a kind of time / memory curve that your program falls into. Making use less time means saving data in intermediate structures using more memory. Conversely saving memory may mean recalculating results again which takes more time. The experienced programmer will try to balance these two parameters while trying to keep the program understandable and extendable for the future.
 
I am agree, you have a memory / time curve but micro optimisation done by compiler as register optimisation, SIMD etc have no memory cost but are very effective.
For example this simple code :

double a = 32.0;
for (size_t i = 0; i<1000000; ++i)
{
a = (a+3.0)/2.0;
if (a<3.7 && a>2.1) std::count << "toto" << std::endl;
}

There is no really big optimisation that can be done. But if you compile it in -O0 in G++ and in -O3 (full optimisation) then you will divide the execution time by 100. It's the reason why Intel compiler give better execution time with no effort.
 

Similar threads

  • · Replies 40 ·
2
Replies
40
Views
5K
  • · Replies 49 ·
2
Replies
49
Views
12K
Replies
1
Views
3K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
20
Views
11K
  • · Replies 13 ·
Replies
13
Views
4K