Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

FORALLs and /Qparalell

Greynolds__Alan
Beginner
1,039 Views
Does IVF parallelize all FORALL statements/blockswith the/Qparallel option? If not, shouldn't it be able to since by definition the iterations of a FORALL are independent and reference onlyPURE functions with no side-effects?

Al Greynolds
www.ruda-cardinal.com
0 Kudos
8 Replies
Steven_L_Intel1
Employee
1,039 Views
No - the semantics of FORALL end up making it very difficult to parallelize. This is why Fortran 2008 added DO CONCURRENT, which is "FORALL done right". I will note that FORALL is not a loop, so talking about iterations can be confusing. It is effectively an array assignment.
0 Kudos
Greynolds__Alan
Beginner
1,039 Views
Thanks for the tip Steve. I just read John Reid's discussion of FORALL versus DO CONCURRENT inftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1729.pdf Does this mean that IVF will parallelize all DO CONCURRENT blocks if I switch from FORALLs?
Al
0 Kudos
Steven_L_Intel1
Employee
1,039 Views
Intel Fortran 11.1 doesn't support DO CONCURRENT. Support will be added in a future release. The compiler will attempt to parallelize DO CONCURRENT constructs if you use /Qparallel - there's no guarantee of parallelization, but the odds are good.
0 Kudos
j_clausen
Beginner
1,039 Views
SoFORALL is pretty much obsolete, then?

j_clausen
0 Kudos
Steven_L_Intel1
Employee
1,039 Views
In my opinion, yes.
0 Kudos
j_clausen
Beginner
1,039 Views
No - the semantics of FORALL end up making it very difficult to parallelize. This is why Fortran 2008 added DO CONCURRENT, which is "FORALL done right". I will note that FORALL is not a loop, so talking about iterations can be confusing. It is effectively an array assignment.

Why must the "DO CONCURRENT" be invented? Couldn't Intel just change the way FORALL is implemented and make that the "FORALL done right"?

It maybe a dumb question with an obvious answer, but bear with me, a mere civil engineer and occasionalIVF user :-)

j_clausen

0 Kudos
TimP
Honored Contributor III
1,039 Views
The limited step which ifort has taken which may correspond with your suggestion is the facility to optimize FORALL in certain contexts with !DIR$ IVDEP. Changing the meaning of standard syntax, even under a compiler option, has continually proven unsatisfactory. No doubt, the standards committee wrestled with this question, and decided a new keyword would be the better solution.
0 Kudos
Steven_L_Intel1
Employee
1,039 Views
It's not a question of "implementation", but rather, as Tim says, of semantics. We can't change the meaning of a program that uses FORALL just because it doesn't parallelize well.
0 Kudos
Reply