Intel® Fortran Compiler 16.0 User and Reference Guide
OpenMP* Fortran Compiler Directive: Divides the work of executing a block of statements or constructs into separate units. It also distributes the work of executing the units to threads of the team so each unit is only executed once.
!$OMP WORKSHARE
block
!$OMP END WORKSHARE [NOWAIT]
block |
Is a structured block (section) of statements or constructs. No branching into or out of the block of code is allowed. The block is executed so that each statement is completed before the next statement is started and the evaluation of the right hand side of an assignment is completed before the effects of assigning to the left hand side occur. The following are additional rules for block:
|
The binding thread set for a WORKSHARE construct is the current team. A workshare region binds to the innermost enclosing parallel region.
If you do not specify the NOWAIT keyword, synchronization is implied following the code.
Multithreaded code is not always generated for the statements inside the block of an OMP WORKSHARE construct. Some statements parallelize; others do not parallelize and instead execute sequentially inside an OMP SINGLE construct to preserve the correct semantics of WORKSHARE. Some specific details follow:
Simple array assignments such as A = B + C parallelize.
Simple array assignments with overlap such as A = A + B + C parallelize.
Array assignments with user-defined function calls parallelize such as A = A + F (B). F must be ELEMENTAL.
Array assignments with array slices on the right hand side of the assignment such as A = A + B(1:4) + C(1:4) parallelize. If the lower bound of the left hand side or the array slice lower bound or the array slice stride on the right hand side is not 1, then the statement does not parallelize.
Assigning into array slices does not parallelize.
Scalar assignments do not parallelize – there is no work that needs to be done in parallel.
FORALL and WHERE constructs do not parallelize.