Purpose
The OpenMP task pragma
can be used to explicitly define a task.
Use the task pragma
when you want to identify a block of code to be executed in parallel with
the code outside the task region. The task pragma
can be useful for parallelizing irregular algorithms such as pointer chasing
or recursive algorithms for which other OpenMP workshare constructs are inadequate.
The task directive only takes effect if you specify
the -qsmp compiler option.
Syntax

.-,------.
V |
>>-#--pragma--omp task----clause-+-----------------------------><
Parameters
clause is any of the following:
- if (exp)
- When the if argument is specified, the program code executes
in parallel only if the scalar expression represented by exp evaluates
to a nonzero value at run time. Only one if clause can be
specified.
- private (list)
- Declares the scope of the data variables in list to be private
to each thread. Data variables in list are separated by commas.
- firstprivate (list)
- Declares the scope of the data variables in list to be private
to each thread. Each new private object is initialized with the value of the
original variable as if there was an implied declaration within the statement
block. Data variables in list are separated by commas.
- default
- untied
- When a task region is suspended, untied tasks can be resumed by any thread
in a team.
- shared (list)
- Declares the scope of the comma-separated data variables in list to
be shared across all threads.