#pragma Preprocessor Directives for Parallel Processing (C Only)

The #pragma directives on this page give you control over how the compiler handles parallel processing in your program. These pragmas fall into two groups; IBM C for AIX-specific directives, and directives conforming to the OpenMP Application Program Interface specification.

Use the -qsmp compiler option to specify how you want parallel processing handled in your program. You can also instruct the compiler to ignore all parallel processing-related #pragma directives by specifying the -qignprag=ibm:omp compiler option.

Directives apply only to the statement or statement block immediately following the directive.

IBM Pragma Directives Description
ibm critical Instructs the compiler that the statement or statement block immediately following this pragma is a critical section.
ibm independent_calls Asserts that specified function calls within the chosen loop have no loop-carried dependencies.
ibm independent_loop Asserts that iterations of the chosen loop are independent, and that the loop can therefore be parallelized.
ibm iterations Specifies the approximate number of loop iterations for the chosen loop.
ibm parallel_loop Explicitly instructs the compiler to parallelize the chosen loop.
ibm permutation Asserts that specified arrays in the chosen loop contain no repeated values.
ibm schedule Specifies scheduling algorithms for parallel loop execution.
ibm sequential_loop Explicitly instructs the compiler to execute the chosen loop sequentially.
OpenMP Pragma Directives Description
omp parallel Defines a parallel region to be run by multiple threads in parallel. With specific exceptions, all other OpenMP directives work within parallelized regions defined by this directive.
omp for Work-sharing construct identifying an iterative for-loop whose iterations should be run in parallel.
omp parallel for Shortcut combination of omp parallel and omp for pragma directives, used to define a parallel region containing a single for directive.
omp sections
omp section
Work-sharing construct identifying a non-iterative section of code containing one or more subsections of code that should be run in parallel.
omp parallel sections Shortcut combination of omp parallel and omp sections pragma directives, used to define a parallel region containing a single sections directive.
omp single Work-sharing construct identifying a section of code that must be run by a single available thread.
omp master Synchronization construct identifying a section of code that must be run only by the master thread.
omp critical Synchronization construct identifying a statement block that must be executed by a single thread at a time.
omp barrier Synchronizes all the threads in a parallel region.
omp flush Synchronization construct identifying a point at which the compiler ensures that all threads in a parallel region have the same view of specified objects in memory.


Program Parallelization


Control Parallel Processing with Pragmas


List of Preprocessor Directives
IBM Run-time Options for Parallel Processing
OpenMP Run-time Options for Parallel Processing
Built-in Functions Used for Parallel Processing
smp compiler option
OpenMP Specifications