next up previous contents
Next: The INDEPENDENT Directive Up: Pure Procedures Previous: Pure Subroutine Example

 

MIMD Example

MIMD stands for Multiple Instructions Multiple Data. The following example merely illustrates that if a PURE procedure contains an IF block then each processor could be performing a different task at the same time.

    REAL FUNCTION F(x,i) ! PURE
     IMPLICIT NONE
     REAL, INTENT(IN) :: x    ! element
     INTEGER, INTENT(IN) :: i ! index
      IF (x > 0.0) THEN
       F = x*x
      ELSEIF (i==1 .OR. i==n) THEN
       F = 0.0
      ELSE
       F = x
      END IF
    END FUNCTION F

If desired this approach could be used as alternative to WHERE or FORALL.

Return to corresponding overview page gif


next up previous contents
Next: The INDEPENDENT Directive Up: Pure Procedures Previous: Pure Subroutine Example

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