Using IBM SMP directives (C only)

Note: The pragma directive #pragma ibm schedule has been deprecated and might be removed in a future release. You can use the corresponding OpenMP directives or clauses to obtain the same behavior.

For detailed information about how to replace the deprecated pragma directives with corresponding OpenMP directives, refer to Deprecated directives.

IBM SMP directives exploit shared memory parallelism through the parallelization of countable loops. A loop is considered to be countable if it has any of the forms described in Countable loops. The XL C compiler provides pragma directives that you can use to improve on automatic parallelization performed by the compiler. Pragmas fall into two general categories:

  1. Pragmas that give you explicit control over parallelization. Use these pragmas to force or suppress parallelization of a loop (#pragma ibm sequential_loop), apply specific parallelization algorithms to a loop (#pragma ibm schedule), and synchronize access to shared variables using critical sections.
  2. Pragmas that let you give the compiler information on the characteristics of a specific countable loop (#pragma ibm independent_calls, #pragma ibm independent_loop, #pragma ibm iterations, #pragma ibm permutation). The compiler uses this information to perform more efficient automatic parallelization of the loop.
Read syntax diagramSkip visual syntax diagram
IBM SMP directive syntax

>>-#pragma ibm--pragma_name_and_args--countable_loop-----------><

Pragma directives must appear immediately before the countable loop to which they apply. More than one parallel processing pragma directive can be applied to a countable loop. For example:
#pragma ibm independent_loop
#pragma ibm independent_calls
#pragma ibm schedule(static,5)
countable_loop

Some pragma directives are mutually exclusive of each other, such as, for example, the parallel_loop and sequential_loop directives. If mutually exclusive pragmas are specified for the same loop, the pragma last specified applies to the loop.

Other pragmas, if specified repeatedly for a given loop, have an additive effect. For example:
#pragma ibm permutation (a,b)
#pragma ibm permutation (c)
is equivalent to:
#pragma ibm permutation
(a,b,c)

For a pragma-by-pragma description of the IBM SMP directives, refer to Pragma directives for parallel processing in the XL C/C++ Compiler Reference.