Procedures can contain declarations of the same classes of HPF objects that occur in a main program. A procedure can declare a processor grid or a template, can align arrays relative to each other or to a template and can specify distribution methods. Here, we are only concerned with two different styles of declarations in procedures: prescriptive and descriptive. Prescriptive directives look exactly the same as main program directives; descriptive directives are actually assertions about the global state of the program and look slightly different to the directives that have already been met.
Although not compulsory, explicit interfaces should be given for all external procedures. In any case, HPF programs should always use assumed-shape arrays which means that the supplication of interfaces will be mandatory. Explicit-shape arrays could also be used but these are not as flexible and are therefore not recommended. Assumed-size arrays (FORTRAN 77 style dummy array arguments that rely on sequence association) should also be avoided.
Interfaces should also contain mapping information, this will aid compiler optimisations.
In general, it is not a good idea to remap data on entry to (or on exit from) a procedure. Data remapping is extremely time-consuming and will become a real bottleneck if it allowed. Data will be remapped if, for example, an actual argument is mapped with BLOCK distribution but the corresponding dummy is given CYCLIC distribution. Every processor will have to scatter all its elements to other processors and receive all its new elements from the processors that previously owned them.
When a procedure is exited, any dummy arguments which were remapped on entry must be remapped back again to their original mapping, in other words, a procedure call involving remapping does not permanently alter the mapping of an object, it just modifies it for the duration of the procedure.
Return to corresponding overview page