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