News for hackers. Stuff that matters.
Re:Fortran by kergonath on Monday August 28, 2023 @06:56AM (#37292233)
This is an allusion to coarrays, which is a feature from Fortran 2008. It is actually very neat and very nice to program for. There is a C thing that took inspiration from it: https://en.m.wikipedia.org/wiki/Unified_Parallel_C .
Re:Fortran by marshallward on Monday August 28, 2023 @08:48AM (#37293152)
Do concurrent loops can also be parallelized.
Re:Fortran by kergonath on Monday August 28, 2023 @10:55AM (#37295058)
Yes, a lot of things can be parallelised with OpenMP or MPI, just like in C/C++. These extensions and libraries are not core language features, though.
Re:Fortran by marshallward on Thursday August 31, 2023 @07:15AM (#37335425)
Very true, and it opens the door to new optimizations which are not possible when going through a library (at least in the case of MPI).
Re:Fortran by pklausler on Monday August 28, 2023 @12:41PM (#37296866)
DO CONCURRENT is not a parallel construct. It is a serial loop with arbitrary ordering of iterations, and limitations on data accesses that were intended to ease parallelization but turned out to be incorrect.
Re:Fortran by marshallward on Wednesday August 30, 2023 @09:03PM (#37331239)
I agree that it is not a parallel construct. But it can nonetheless be parallelized if certain criteria are met.
Re:Fortran by pklausler on Thursday August 31, 2023 @04:57PM (#37343581)
Unfortunately, the necessary restrictions on data accesses to enable parallel execution are not required to hold true in the body of a DO CONCURRENT loop by its botched specification, and neither can they be verified at compilation time. And the committee has known about these problems for many years and has refused to fix them; Fortran 2023 still has them and the topic is not going to be brought up again for Fortran 2028.

So it is possible for a conforming program to be non-parallelizable, due to holes in the default data localization rules, despite the name of the construct and the obvious intent of the long list of restrictions imposed on code in the construct.

I summarized the two specific problems in https://github.com/llvm/llvm-project/blob/main/flang/docs/Do....

Re:Fortran by marshallward on Thursday August 31, 2023 @06:24PM (#37344414)
It's an excellent essay, and the Fortran community owes you a major gratitude for promoting these issues. But surely there loops can be safely parallelized if the iterations do not interact, e.g. per-element array arithmetic, and a compiler ought to safely identify such arithmetic.

Also, isn't your employer promoting do concurrent as a method of GPU parallelization? Has this been controversial within Nvidia?