A typical Fortran 77 implementation passes arguments by reference, usually by passing the base address of the location of the first data element, and such arguments may also be assumed to be sequence associated. These facts make it most practical for the default method of passing a distributed data structure from HPF to an F77_LOCAL procedure by passing the base address of that section of local memory that has been allocated to it. To allow for sequence association of actual and dummy arguments, data should also be reordered or compressed or both, if necessary, on all processors. This is the safest method of passing distributed data to an EXTRINSIC(F77_LOCAL) procedure, and hence it should be the default one. However, it tends to have the greatest performance costs.
A second argument passing option is to pass distributed array data ``as is'' from a global HPF procedure to the local F77 ones, not guaranteeing sequence association of the dummy arguments in order to avoid unwanted local data motion that might be required to compress or reorder the elements of an array local to a processor. In other words, it should be possible to do no more data motion than if the same argument were being passed to another HPF procedure. The guarantee of a sequence associated dummy argument is sacrificed for the possible gains in performance available because the local components of the actual argument are not reordered or compressed. The local programmer must be able to use the implementation-dependent ordering created by the global HPF program.
A third option that can be useful to permit HPF_LOCAL-style local programming from an EXTRINSIC(F77_LOCAL) procedure call is to pass an array via a descriptor or handle, as is typically done in HPF implementations or for Fortran 90 assumed shape arrays. The local procedure may not access elements of this dummy argument directly but may only pass it on to special utility routines, perhaps to obtain local or global distribution information.
The following attributes suffice to support the above three alternate form of passing data to an EXTRINSIC(F77_LOCAL)x procedure:
For example, many compilers add border elements for ``stencil'' optimizations or pad array allocations on particular processors so that all processors allocate equal amounts of memory for each array. Local reordering eliminates such padding and provides FORTRAN 77 sequence association for actual data values.
Any local reordering is in addition to any global remapping that may be dictated by DISTRIBUTION or ALIGN directives in the INTERFACE block.
If no LAYOUT attribute is specified, then LAYOUT("0DF77_ARRAY"0D) is assumed.
This option is desirable when the programmer decides that the overhead of local reordering should be eliminated or that certain characteristics of the global HPF compiler's ordering (border cells, equal-size allocations among processors, etc.) should be preserved at the local level. It forces the local programmer to access the local data in whatever implementation-dependent style the global HPF compiler employs.
Furthermore, each argument in the INTERFACE block can also have its PASS_BY attribute specified to indicate whether the data is passed by reference, for Fortran 77-style access, or via a special handle, perhaps a descriptor used for HPF variable passing, that permits the global HPF caller to pass special mapping information for use within the local Fortran 77 procedure.
Thus, the default dummy argument attributes are LAYOUT("0DF77_ARRAY"0D), a guarantee of sequence association, and PASS_BY("0D*"0D), an indication that data is being passed via a pointer to its location.
(End of advice to implementors.)