Next: Intrinsic Functions Up: Fortran 90D/HPF Language Previous: Distribution directives

Data Parallelism in Fortran 90D/HPF

Parallelism can be explicitly expressed in Fortran 90/HPF using several language features: Fortran 90 array assignments, masked array assignments using statements, constructs, statements, constructs and intrinsic functions.

The forall statement [2] is an elemental array assignment statement used to specify an array assignment in terms of array elements or array sections. The element array may be masked with a scalar logical expression. The forall statement effectively describes a collection of assignments to be executed elementally. Some examples of forall statements are:


FORALL( I = 1:N, J=1:N ) H(I,J) = 1.0 / REAL(I + J -1)
FORALL( I = 1:N, J=1:N, A(I,J) .NE. 0.0 ) B(I,J) = 1.0 / A(I,J)

The semantics of a FORALL statement are an assignment to each of these elements or sections (one for every possible combination of subscript values for which the mask expression is true) with all right-hand sides being evaluated before any left-hand sides are assigned.

The statement and construct are new language features expressing data parallelism, that is, providing a convenient syntax for simultaneous assignments to large groups of array elements. The functionality these statements provide is similar to that provided by the array assignments and the constructs in Fortran 90. All Fortran 90 array assignments, including , can be expressed using statements. However, Fortran 90 places several restrictions on array assignments. In particular, it requires that operands of the right side expressions be conformable with the left hand side array. These restrictions are relaxed in statements. In addition, a may call user-defined functions, simulating Fortran 90 elemental function invocation. Functions that may be called in a loop must not produce any side effects.

The statement essentially preserves the semantics of Fortran 90 array assignments and the construct is semantically equivalent to a sequence of statements. The array elements may be assigned in an arbitrary order, in particular, concurrently. To preserve determinism of the result, it is required that each array element only be assigned once. The execution of the assignment may require an intra-statement synchronization: the evaluation of the left hand side expression of the assignment must be completed for all array elements before the actual assignment is made. Then, the processors must be synchronized again, before the next array assignment is processed.



Next: Intrinsic Functions Up: Fortran 90D/HPF Language Previous: Distribution directives


zbozkus@
Thu Jul 6 21:09:19 EDT 1995