Intel® Advisor Help
Intel Advisor tools are designed to collect data and analyze serial programs. Before you use the Intel Advisor Suitability and Dependencies tools to examine a partially parallel program, modify your program so it runs as a serial program with a single thread within each parallel site.
To run the current version of your program as a serial program, you need to limit the number of threads to 1. To run your program with a single thread:
With Intel® TBB, in the main thread create a tbb::task_scheduler_init init(1); object for the lifetime of the program and run the executable again. For example:
int main() { tbb::task_scheduler_init init(1); // ...rest of program... return 0; }
The effect of task_scheduler_init applies separately to each user-created thread. So if the program creates threads elsewhere, you need to create a tbb::task_scheduler_init init(1); for that thread's lifetime as well. Use of certain Intel TBB features can prevent the program from running serially. For more information, see the Intel TBB documentation.
With Intel® Cilk™ Plus, you can do one of the following:
Set the environment variable CILK_NWORKERS to 1 and run the executable again.
When using the Intel® C++ Compiler, set the compiler option -cilk-serialize (Linux* OS) or /Qcilk-serialize (Windows* OS) when building the target executable.
Before your program's first call to a function that performs a spawn (cilk_spawn or cilk_for), execute the cilkrts_set_param() function and specify nworkers as 1. For example:
if (0!= cilkrts_set_param("nworkers","1")) { printf("Failed to set worker count\n"); return 1; }
Using cilkrts_set_param() overrides the value (if any) set by the CILK_NWORKERS environment variable. For more information, see the Intel Cilk Plus help.
With OpenMP*, do one of the following:
Set the OpenMP* environment variable OMP_NUM_THREADS to 1 before you run the program.
Omit the compiler option that enables recognition of OpenMP pragmas and directives. On Windows* OS, omit /Qopenmp, and on Linux* OS omit -openmp.
For more information, see your compiler documentation.
If you cannot remove the parallelism, you should add annotations to mark the parallel code regions and learn how parallel code will impact Intel Advisor tool reports, as described in Using Partially Parallel Programs with Intel Advisor Tools.