next up previous contents
Next: INDEPENDENT NEW Loops Up: Data Parallel Execution Previous: Visualisation of Independent Loop

 

Independent Example 2

Consider,

    !HPF$ INDEPENDENT
    DO i = 1, n
     a(i) = b(i-1) + b(i) + b(i+1)
    END DO

Can perform all iterations in parallel. Also,

    !HPF$ INDEPENDENT
    FORALL (i=1:n) & 
     a(i) = b(i-1) + b(i) + b(i+1)

don't have to calculate whole RHS before assignment.

Can also use with vector subscripts,

    !HPF$ INDEPENDENT
    DO i = 1, n 
     a(index(i)) =  b(i-1) + b(i) + b(i+1) 
    END DO

Says each element of index(1:n) is unique.

For more information, click here gif

Now try this question gif

Now try this question gif


next up previous contents
Next: INDEPENDENT NEW Loops Up: Data Parallel Execution Previous: Visualisation of Independent Loop

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