Software Archive
Read-only legacy content
17061 Discussions

Does my code need to be already multithreaded to be eligable for optimization?

rmbarnett
Beginner
302 Views
I have watched some of the introductory videos around Composer and it seems like a great technology. The chief takeaway I have from the videos so far is that I can take an existing C/C++ application and recompile it with the Intel compiler to achieve better performance thanks to more aggressive code optimization for multicore platforms.

However, what if my existing application is single threaded? Will my application be eligible for the performance boosts derived from the multicore optimizations? Is the Intel compiler smart enough to safely multithread my program and then apply the multicore optimizations?

Thanks
0 Kudos
1 Reply
KitturGanesh
Employee
302 Views

Hi,
/Qparallel, theauto parallelizer optionof the compiler when used during compilation should generate multi-threaded code for loops that can be safely executed in parallel. Also, just using the compiler along with available opimization switches including vectorization (default enabled) when compiling your applicationshouldhelp increase performance. You can also use the processor specific options so the compiler can generate optimized code specialized for the processor the application is run on. For example,the /QxHost option can generate instructions for the highest SSE instruction set available on thesystem.This can only go sofar.....

The fact that your existing application is single threaded itself makes it a good candidate to use Parallel Studio to find out if there are any further opportunities for parallelism to increase performance for multicore. You can use the Parallel Studio components to do the following step-by-step:

1. Analyze to find opportunities for parallelismby focusing mainly on hotspots in your application that is taking the most time.

2. Identify if these hotspots are good candidates for parallel code. and consider the parallelism/threading model that works best for the type of application (Like, OpenMP, Intel Threading Building Blocks, and so on)

3.Implement the chosen threading model (meaning implement parallelism, thus making optimizations to hotspots...)

4. Debug for correctness (locate deadlocks, races and so on....)

5. Tune for Performance (find and fix scalability issues...)

The parallel studio/component specific documentation goes over in detail on the above steps and should help you get started on parallelizing your application to take full advantage of multicore processor.

-regards,
Kittur
0 Kudos
Reply