next up previous contents
Next: MIMD Example Up: Data Parallel Execution Previous: Pure Function Example

 

Pure Subroutine Example

    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

Note:

Example of use,

    CALL G(x,y,res)

For more information, click here gif

Now try this question gif


next up previous contents
Next: MIMD Example Up: Data Parallel Execution Previous: Pure Function Example

©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997
Not for commercial use.