Tip for people who optimize their code

  • Thread starter Thread starter kroni
  • Start date Start date
  • Tags Tags
    Code
Click For Summary
The discussion highlights the availability of the Intel Compiler and Intel Profiler for students, emphasizing their benefits in programming and optimization. The Intel Compiler offers advanced features like inter-function optimization and automatic partial parallelization, potentially improving execution time by around 30%. The Intel Profiler provides detailed performance insights, including line-by-line execution time and cache miss statistics, which can help optimize algorithms and program structure. The conversation also touches on the balance between time and memory usage in programming, noting that while optimizations can reduce execution time, they may require additional memory. It is pointed out that compiler optimizations, such as register optimization and SIMD, can enhance performance without increasing memory costs. An example demonstrates how significant execution time reductions can be achieved through proper compiler optimization settings.
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::cout << "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.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

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