-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coroutines #60
Comments
From what one can see at J3 websites, coroutines have been proposed, see a recent paper. This item is not on the Fortran 202X work-list though. So interested parties can use the long waiting period until Fortran 202Y to develop the idea and perhaps try prototype implementations e.g., in LFortran? |
My, the paper has worked out a complete specification - far better than my half(*)-thought-through idea ;). (*) Well, "half" is exaggerating it a bit, a more accurate estimate is "one-eighth". I merely thought, let's throw up this concept, so that it will not be forgotten. |
@FortranFan let's work towards fixing the "long waiting period", as proposed in #36. With enough support in the large community, as well as enough members on the committee, it can happen. |
Coroutines are one of possible concurrent models. The bottom-line question is whether Fortran needs concurrency (I am not convinced). Although it's possible to write concurrent (not parallel) programs with coarrays, they were not designed to do that. This perhaps also puts the cart before the horse. Let's discuss whether Fortran needs concurrency (perhaps in #59), and if yes, then it's useful to evaluate different concurrency models. |
@milancurcic wrote:
i don't think there is any doubt or question here. Not only does the Fortran standard in no way seek not to support concurrency, but with the importance given to DO CONCURRENT construct in the language starting Fortran 2008 and the considerable flexibility granted to processors in terms of their concurrency approaches and as well as other design considerations in the standard (e.g. REDUCE intrinsics) as well as other actions by the committee such as actively liasing with OpenMP, Fortran appears to fully affirm broad support toward this aspect. Besides the value of coroutines can come into play when a program is executed in different ways e.g., by means other than a Fortran processor. So it appears to me this feature has several valid use cases. |
|
Let's discuss the "do concurrent" problem in #62. |
@FortranFan do you remember the committee's feedback on the 19-169 paper that you mentioned above? Let's document the feedback here. |
@certik wrote:
@certik, one or more attendees from the meeting last August 2019 in Tokyo, Japan will be better positioned to provide feedback. I was unable to attend that meeting. "Officially" the documentation from that meeting minutes is paper 19-169 (and many others) were "out-of-order" and "no action" was taken: https://j3-fortran.org/doc/year/19/minutes219.txt:
|
There are more uses for coroutines than concurrency. One of my codes solves a bunch of related problems of different sizes. Numerous arrays depend on the problem size. Profiling showed the code was spending a lot of time in the storage allocator. So I made the arrays automatic, depending upon the maximum size. Iteration over the different problems moved into that procedure. Procedures it needed, that need arrays depending upon the problem size, became internal procedures. The module became a monster. As coroutines, instead of being internal, each could be in its own module, and invoked with the maximum size, immediately suspending, then resumed with each different size, without re-creating the activation record. And, of course, iterators are useful independently of concurrency. They're just the function analogue of coroutines. |
Coroutines represent a method to let two parts of a program cooperate with each other. The Wikipedia page on corotuines explains the concept. In the context of Fortran programming paradigms, think of the way reverse communication is implemented. Coroutines would make this much easier.
The text was updated successfully, but these errors were encountered: