Next: MIMD Example
Up: Pure Procedures
Previous: Pure Function Example
Consider,
PURE SUBROUTINE G(x,y,z)
IMPLICIT NONE
REAL, INTENT(OUT), DIMENSION(:) :: z
REAL, INTENT(IN), DIMENSION(:) :: x, y
INTEGER i
INTERFACE
REAL FUNCTION F(x,y)
REAL, INTENT(IN) :: x, y
END FUNCTION F
END INTERFACE
! ...
FORALL(i=1:SIZE(z)) z(i) = F(x(i),y(i))
END SUBROUTINE G
Here,
- the subroutine invokes a PURE function F,
- the argument intents are given in an interface for F,
- each processor can
happily execute its copy of G in parallel with each other
processor.
Example of use,
CALL G(x,y,res)
It is very good form to give an interface.
Now try this question
Return to corresponding overview page
Next: MIMD Example
Up: Pure Procedures
Previous: Pure Function Example
©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997Not for commercial use.