Re: Parallel programming with FORALL?

On Jan 12, 12:18 am, Dick Hendrickson <dick.hendrick...@xxxxxxx>
Yes, that's the way it works.  One statement is completely processed
before the next one is started.  (Of course, the compiler can optimize
around this if things are safe.)  This is different from DO loops.  If
your FORALLs were naively replaced with DO loops you'd get a completely
different answer.

Yeah. I wrote it intentionally like that (mixing indices) because I
wanted to see that feature in action. It's interesting that you can do
things like that. Like, you could implement a transpose with:

forall (i = 1:N, j=1:N) B(i,j) = B(j,i) end forall

I think it's an interesting feature.

The F2008 DO CONCURRENT is sort of a replacement for FORALL.  The
programmer guarantees that there is complete iteration-to-iteration
order independence in the loop.  The compiler can freely spread the
execution across many CPUs.  The loss is that DO CONCURRENT wouldn't
work for your example.

Sounds interesting. Too bad it's not implemented in GFortran.