FDVM2 (1158347), страница 10
Текст из файла (страница 10)
| align-with-clause | is WITH align-spec |
| align-spec | is align-target [ ( align-subscript-list ) ] |
| align-target | is array-name |
| or template-name | |
| or pointer-name |
| align-subscript | is int-expr |
| or align-subscript-use | |
| or * |
| align-subscript-use | is [ primary-expr * ] align‑dummy [ add-op primary-expr ] |
| primary-expr | is int-constant |
| or int-variable | |
| or ( int-expr ) | |
| add-op | is + |
| or - |
Constraints:
-
A length of the list align-source-list must be equal to the rank of aligned array.
-
A length of the list align-subscript-list must be equal to the rank of base array align-target.
-
Each align-dummy may appear at most once in an align-subscript-list.
-
An align-subscript-use expression may contain at most one occurrence of an align-dummy.
-
REALIGN directive may be applied only to the arrays specified in ALIGN and DYNAMIC directives.
-
NEW_VALUE clause is not permitted in ALIGN directive.
-
align-directive-stuff can be omitted only in ALIGN directive. In such a case the distributed array can be used only after execution of REALIGN directive.
4.3.2. TEMPLATE Directive
| template-directive | is TEMPLATE template-decl-list |
| template-decl | is template-name [ ( explicit-shape-spec-list ) ] |
5.2.2. Distribution of Loop Iterations. PARALLEL Directive
| parallel-directive | is PARALLEL ( do-variable-list ) ON iteration-align-spec [ , new-clause ] [ , reduction-clause] [ , shadow-renew-clause] [ , remote-access-clause ] [ , across-clause ] |
| iteration-align-spec | is align-target ( iteration-align-subscript-list ) |
| iteration-align-subscript | is int-expr |
| or do-variable-use | |
| or * | |
| do-variable-use | is [ primary-expr * ] do-variable [ add-op primary-expr ] |
5.2.3. Private Variables. NEW Clause
| new-clause | is NEW ( new-variable-list ) |
| new-variable | is array-name |
| or scalar-variable-name |
Constraint:
-
The distributed arrays cannot be used as NEW-variables.
5.2.4. Reduction Operations and Variables. REDUCTION Clause
| reduction-clause | is REDUCTION ( reduction-op-list ) |
| reduction-op | is reduction-op-name ( reduction-variable ) |
| or reduction-loc-name ( reduction-variable , int-variable-list) |
| reduction-variable | is array-name |
| or scalar-variable-name |
| reduction-op-name | is SUM |
| or PRODUCT | |
| or MAX | |
| or MIN | |
| or AND | |
| or OR | |
| or EQV | |
| or NEQV |
| reduction-loc-name | is MAXLOC |
| or MINLOC |
Constraints:
-
Distributed arrays cannot be used as reduction variables.
-
Reduction variables are calculated and used only inside the loop in statements of a certain type: the reduction statements.
5.2.5. Distribution of the Loop with Regular Data Dependence. ACROSS Clause
| across-clause | is ACROSS ( dependent-array-list ) |
| dependent-array | is dist-array-name ( dependence-list ) |
| dependence | is flow-dep-length : anti-dep-length |
| flow-dep-length | is int-constant |
| anti-dep-length | is int-constant |
5.4. Non-distributed (Replicated) Computations
| own-directive | is OWN |
6.1.1. Shadow Edges Group. SHADOW_RENEW Clause
| shadow-directive | is SHADOW shadow-array-list |
| shadow-array | is array-name ( shadow-edge-list ) |
| shadow-edge | is width |
| or low-width : high-width |
| width | is int-expr |
| low-width | is int-expr |
| high-width | is int-expr |
Constraints:
-
The int-expr representing a width, low-width, or high-width must be a constant specification expression with value greater than or equal to 0.
-
A shadow-edge specification of width is equivalent to a shadow-edge of width : width.
-
By default distributed array has a shadow width of 1 on both sides of each distributed dimension.
| shadow-renew-clause | is SHADOW_RENEW ( renewee‑list ) |
| or shadow-start-directive | |
| or shadow-wait-directive |
| renewee | is dist-array-name [ ( shadow-edge-list ) ] [ (CORNER) ] |
Constraints:
-
Width of the shadow edges filled by values must not exceed the maximal width specified initially in the SHADOW directive.
-
If shadow edge widths is not specified, then the maximal widths are used.
6.1.2. Group of Regular Remote References. REMOTE_ACCESS Directive
| remote-access-directive | is REMOTE_ACCESS ( [ remote-group-name : ] regular-reference-list) |
| regular-reference | is dist-array-name [( regular-subscript-list )] |
| regular-subscript | is int-expr |
| or do-variable-use | |
| or : | |
| remote-access-clause | is remote-access-directive |
| remote-group-directive | is REMOTE_GROUP remote-group-name-list |
Constraint:
-
The identifier, specified in the directive, can be used only in REMOTE_ACCESS, PREFETCH and RESET directives.
| prefetch-directive | is PREFETCH group-name |
| reset-directive | is RESET group-name |
| group-name | is remote-group-name |
| or indirect-group-name |
Constraints.
-
Repeated usage of PREFETCH directive is correct, if the remote reference group characteristics (the loop parameters, distribution of arrays and the values of index expressions in remote references) are not updated.
-
PREFETCH directive can be executed for the several loops (several REMOTE_ACCESS directives), if there are no data dependencies between the loops for distributed arrays specified in the REMOTE_ACCESS directives.
6.2. Group of Non-regular Remote References. INDIRECT_ACCESS Directive
| indirect-group-directive | is INDIRECT_GROUP indirect-group-name-list |
Constraint:
-
The identifier, defined in the directive, can be used in INDIRECT_ACCESS , PREFETCH, STORE and RESET directives only.
| indirect-access-directive | is INDIRECT_ACCESS ( [ indirect-group-name : ] indirect-reference-list) |
| indirect-reference | is dist-array-name [( indirect-subscript-list )] |
| indirect-subscript | is int-expr |
| or array-name( do-variable, int-expr) | |
| indirect-access-clause | is indirect-access-directive |
6.3.1. Asynchronous Updating of Shadow Edges
| shadow-group-directive | is SHADOW_GROUP shadow-group-name ( renewee-list ) |
| shadow-start-directive | is SHADOW_START shadow-group-name |
| shadow-wait-directive | is SHADOW_WAIT shadow-group-name |
Constraints:
-
SHADOW_START directive must be executed after SHADOW_GROUP one.
-
SHADOW_WAITT directive must be executed after SHADOW_START one.
-
Updated values of the shadow edges may be used only after SHADOW_WAIT directive.
-
These directives may not be used within a distributed loop.
6.3.2. Asynchronous Group Reduction
| reduction-group-directive | is REDUCTION_GROUP reduction-group-name ( reduction-op-list ) |
| reduction-start-directive | is REDUCTION_START reduction-group-name |
| reduction-wait-directive | is REDUCTION_WAIT reduction-group-name |
Constraints.
-
REDUCTION_GROUP directive must be executed after assigning initial values to all reduction variables of the group and before executing a loop (loops) where reduction variable values are calculated.
-
After executing REDUCTION_GROUP directive, and before executing REDUCTION_START directive, the reduction variables of the group may be used in reduction statements of distributed loops only.
-
REDUCTION_START and REDUCTION_WAIT directives must be executed after the completion of the loop (loops) where the values of the reduction variables are calculated. The only statements allowed between these directives are those that are not using the values of the reduction variables.
-
REDUCTION_WAIT directive deletes the group of the reduction operations.
7.1. Description of Task Array
| task-directive | is TASK task-list |
| task | is task-name ( max-task ) |
7.2. Mapping Tasks on Processors. MAP Directive
| map-directive | is MAP task-name ( task-index ) |
| ONTO processors-name( section-subscript-list)) |
Constraint.
-
The tasks of the same array must be mapped on disjoined sections of processor arrangement.
7.4. Distribution of Computations. TASK_REGION Directive
| block-task-region | is task-region-directive | |
| on-block | ||
| [ on-block ]... | ||
| end-task-region-directive | ||
| task-region-directive | is TASK_REGION task-name | |
| end-task-region-directive | END TASK_REGION | |
| on-block | is on-directive | |
| block | ||
| end-on-directive | ||
| on-directive | is ON task-name ( task-index ) [ , new-clause ] | |
| end-on-directive | is END ON | |
| loop-task-region | is task-region-directive | |
| parallel-task-loop | ||
| end-task-region-directive | ||
| parallel-task-loop | is parallel-task-loop-directive | |
| do-loop | ||
| parallel-task-loop-directive | is PARALLEL ( do-variable ) ON task-name ( do-variable ) [ , new-clause ] | |
9. Procedures
| inherit-directive | is INHERIT dummy-array-name-list |
Annex2. Code Examples
Six small scientific programs are presented to illustrate Fortran DVM language features. They are intended for solving a system of linear equations:















