User Guide

Contents

Parallelize Data - OpenMP Counted Loops

When tasks are loop iterations, and the iterations are over a range of values that are known before the loop starts, the loop is easily expressed in OpenMP.
Consider the following annotated serial C/C++ loop:
    ANNOTATE_SITE_BEGIN(sitename);         for (int i = lo; i < hi; ++i) {             ANNOTATE_ITERATION_TASK(taskname);                 statement;         }     ANNOTATE_SITE_END();
OpenMP makes it easy to introduce parallelism into loops. With C or C++ programs, add the
omp parallel for
pragma immediately before the C/C++
for
statement:
...   #pragma omp parallel for for (int i = lo; i < hi; ++i) {       statement;   }
Consider the following annotated Fortran serial loop:
 call annotate_site_begin("sitename") do i = 1, N     call annotate_iteration_task("taskname")           statement end do call annotate_site_end
With Fortran programs, add the
!$omp parallel do
directive immediately before the Fortran
do
statement:
...    !$omp parallel do do i = 1, N         statement end do    !$omp end parallel do
The OpenMP compiler support encapsulates the parallel construct. The rules for capturing the locals can be defaulted or specified as part of the pragma or directive. The loop control variable defaults to being private so each iteration sees its allotted value.

Product and Performance Information

1

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