omp parallel sections

Specifies a parallel construct that contains a single sections construct.

Syntax

#pragma omp parallel sections [clause, clause, ...]

{

#pragma omp section

structured-block

#pragma omp section

structured-block

...

Arguments

clause

Any clause accepted by the sections or parallel constructs.

Description

This pragma is a shortcut for a parallel construct that contains a single sections construct.

Example: Calculation in X, Y, and Z directions in parallel

#include <omp.h>
#pragma omp parallel sections {
  #pragma omp section
  Xdirection();
  #pragma omp section
  Ydirection();
  #pragma omp section
  Zdirection();
}

For more complete information about compiler optimizations, see our Optimization Notice.