User Guide


Parallelize Functions - OpenMP Tasks

You can enable multiple function calls to run in parallel as two or more tasks. This is useful for functions in library code for which the source is not available. The statements to run in parallel are not limited to function calls (see the help topic Data and Task Parallelism).
When the outermost statements in the annotation site have been placed into tasks, as shown in the following serial example, it is easy to execute them in parallel.
Consider the C/C++ annotated code:
    ANNOTATE_SITE_BEGIN(sitename);         ANNOTATE_TASK_BEGIN(task1);             statement-1;         ANNOTATE_TASK_END();         ANNOTATE_TASK_BEGIN(task2);             statement-2;         ANNOTATE_TASK_END();        ANNOTATE_TASK_BEGIN(task3);             statement-3;         ANNOTATE_TASK_END();     ANNOTATE_SITE_END();
For the C/C++ parallel code, OpenMP provides explicit support using
#pragma omp parallel sections
and related pragmas within a parallel code region:
#pragma omp parallel sections { #pragma omp section { statement-1; } #pragma omp section { statement-2; } . . . }
Consider the annotated Fortran code:
call annotate_site_begin("sitename") call annotate_task_begin("task_1") call subroutine_1 call annotate_task_end call annotate_task_begin("task_2") call subroutine_2 call annotate_task_end call annotate_site_end ...
For the parallelized Fortran code, OpenMP provides the
!$omp sections
and related directives that can often replace the corresponding annotations within a parallel code region:
!$omp parallel !$omp sections !$omp section call subroutine_1 !$omp section call subroutine_2 !$omp end sections !$omp end parallel ...

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804