next up previous contents
Next: Mapping to Processor Subsets Up: Approved Extensions for Data Mapping Previous: The DYNAMIC Directive

Remapping and Subprogram Interfaces

 

If the dummy argument of any subprogram has the DYNAMIC attribute, then an explicit interface is required for the subprogram (see subsection 8.14). The rules on the interaction of the REALIGN and REDISTRIBUTE directives with a subprogram argument interface are:

  1. A dummy argument may be declared DYNAMIC. However, it is subject to the general restrictions concerning the use of the name of an array to stand for its associated template.

    The effect of any redistribution of the dummy after the procedure returns to the caller is dependent on the attribute of the actual argument. If the actual argument associated with the dummy has also been declared DYNAMIC, then any explicit remapping of the dummy is visible in the caller after the procedure returns. If a range directive (see Section 8.11) has been used to restrict the set of distribution formats allowed for the actual argument, then the new mapping must match one of the formats specified in the range directive.

    A dummy argument whose associated actual argument has the DYNAMIC attribute may be used in REALIGN and REDISTRIBUTE as an alignee or distributee if and only if the associated actual argument is a whole array, not an array section.

    If the actual argument associated with the dummy has not been declared DYNAMIC then the original mapping of the actual has to be restored on return. When the subprogram returns and the caller resumes execution, all objects accessible to the caller after the call that are not declared DYNAMIC are mapped exactly as they were before the call.

  2. If an array or any section thereof is accessible by two or more paths, it is not HPF-conforming to remap it through any of those paths. For example, if an array is passed as an actual argument, it is forbidden to realign that array, or to redistribute an array or template to which it was aligned at the time of the call, until the subprogram has returned from the call. This prevents nasty aliasing problems. An example:
          MODULE FOO
          REAL A(10,10)
    !HPF$ DYNAMIC ::  A
          END
    
          PROGRAM MAIN
          USE FOO
          CALL SUB(A(1:5,3:9))
          END
    
          SUBROUTINE SUB(B)
          USE FOO
          REAL B(:,:)
    !HPF$ DYNAMIC ::  B
          ...
    !HPF$ REDISTRIBUTE A            !Nonconforming
          ...
          END
    

    Situations such as this are forbidden, for the same reasons that an assignment to A at the statement marked ``Nonconforming'' would also be forbidden. In general, in any situation where assignment to a variable would be nonconforming by reason of aliasing, remapping of that variable by an explicit REALIGN or REDISTRIBUTE directive is also forbidden.

    Note that it is permitted to remap a host-associated or use-associated variable in a subprogram if it has been declared DYNAMIC and is accessible only through a single path. Such remappings stay in effect even after the subprogram has returned to its caller.


next up previous contents
Next: Mapping to Processor Subsets Up: Approved Extensions for Data Mapping Previous: The DYNAMIC Directive