Basic HTML version of Foils prepared August 7 98

Foil 6 An Example of FORALL

From DoD HPF Training -- 3. Parallel Constructs in HPF DoD Training and Others -- 1995-98. by Chuck Koelbel -- Rice University


Initially,
  • a = [0, 1, 2, 3, 4]
  • b = [0, 10, 20, 30, 40]
  • c = [-1, -1, -1, -1, -1]
FORALL ( i = 2:4 )
  • a(i) = a(i-1) + a(i+1)
  • c(i) = b(i) * a(i+1)
END FORALL
Afterwards,
  • a = [0, 2, 4, 6, 4]
  • b = [0, 10, 20, 30, 40]
  • c = [-1, 40, 120, 120, -1]



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Aug 9 1998