Intel® Fortran Compiler 17.0 Developer Guide and Reference
Parallel Directive Clause: Specifies a conditional expression. If the expression evaluates to .FALSE., the construct is not executed.
IF ([directive-name-modifier:] scalar-logical-expression)
directive-name-modifier |
Names the associated construct that the IF clause applies to. Currently, you can specify one of the following associated constructs: PARALLEL, TARGET DATA, TARGET, TARGET UPDATE, TARGET ENTER DATA, TARGET EXIT DATA, TASK, or TASKLOOP. |
scalar-logical-expression |
Must be a scalar logical expression that evaluates to .TRUE. or .FALSE.. |
At most one IF clause can appear in a non-combined directive. In combined directives, IF clauses with different directive-name-modifiers can occur, at most one for each constituent directive making up the combined directive where IF is allowed.
The effect of the IF clause depends on the construct to which it is applied:
For combined or composite constructs, the IF clause only applies to the semantics of the construct named in the directive-name-modifier if one is specified.
If no directive-name-modifier is specified for a combined or composite construct then the IF clause applies to all constructs to which an IF clause can apply.
The following are additional rules that apply to specific OpenMP Fortran directives:
For the CANCEL OpenMP* Fortran directive, if scalar-logical-expression evaluates to false, the construct does not request cancellation. Note that directive-name-modifier cannot specify CANCEL.
For the PARALLEL OpenMP Fortran directive:
The enclosed code section is executed in parallel only if scalar-logical-expression evaluates to .TRUE.. Otherwise, the parallel region is serialized. If this clause is not used, the region is executed as if an IF(.TRUE.) clause were specified.
This clause is evaluated by the master thread before any data scope attributes take effect.
For the TARGET OpenMP Fortran directive, if scalar-logical-expression evaluates to .FALSE., the target region is not executed by the device. It is executed by the encountering task.
For the TARGET DATA OpenMP Fortran directive, if scalar-logical-expression evaluates to .FALSE., the new device data environment is not created.
For the TARGET UPDATE OpenMP Fortran directive, if scalar-logical-expression evaluates to .FALSE., the TARGET UPDATE directive is ignored.
For the TASK OpenMP Fortran directive:
The enclosed code section is to be executed in parallel only if scalar-logical-expression evaluates to .TRUE.. If this clause is not used, the region is executed as if an IF(.TRUE.) clause was specified.
If scalar-logical-expression evaluates to .FALSE., the encountering thread must suspend the current task region and begin execution of the generated task immediately. The suspended task region will not be resumed until the generated task is completed.
This clause is evaluated by the master thread before any data scope attributes take effect.