next up previous contents
Next: Passing Array Sections Up: HPF and Procedures Previous: Argument Remapping

 

Explicit Intent

A general procedure call can generate two remappings per argument:

The previous example was modified slightly to include the argument intents:

  INTEGER, DIMENSION(512,512), INTENT(IN)  :: iarg1
  INTEGER, DIMENSION(512,512), INTENT(OUT) :: iarg2

The version which involves remapping is now able to execute in just over half of the time, the reason for this is that only one remapping per argument is required instead of two.

arg1, which has INTENT(IN) is only remapped on procedure entry. The compiler is able to make this optimisation by creating a copy of the actual argument, remapping this copy (leaving the original in-place) and then simply discarding this copy (which has not been modified) at the end of the procedure. If the intent is not specified then the compiler has to `play-it-safe' and cannot make this optimisation.

The purpose of this slide is to highlight just how important it is to specify the argument intent.

Return to corresponding overview page gif


next up previous contents
Next: Passing Array Sections Up: HPF and Procedures Previous: Argument Remapping

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.