NEK for computational fluid dynamics moving to C++?

Protected attribute is already in for 202X - https://j3-fortran.org/doc/year/21/21-168.txt and https://j3-fortran.org/doc/year/21/21-169r2.txt For default optional arguments, this was discussed but for now, conditional expressions (and arguments) are the way to do this: https://j3-fortran.org/doc/year/21/21-162r1.txt

Yes, the GitHub repository is intended as a place to collect and incubate ideas for future revisions. But we have no shortage of ideas - what we are short of is people willing to sit down and write papers that form the basis of adding a feature to the language. Even during J3 meetings, when most of these papers are written, only a few members regularly write the specifications, syntax and edits papers.

Absolutely, though I’ll note that this was also done for 202X, with a widely publicized survey and frequent discussions in multiple venues. I have written and spoken about future features in my Doctor Fortran blog and in presentations. As I’ve said before, though, the “community” is much larger than any of us can address and certainly larger than the audience for this site and your GitHub site.

I don’t really see the lack of community support to be a gating factor here. What would be great is if the proposals in the GitHub moved past “how about this idea?” and into at least making a start at figuring out how such a thing would be integrated into the standard.

2 Likes

I agree, and I promise to help as well. :slight_smile:

2 Likes

I don’t think ERROR STOP can be repurposed for this. It already causes all images to initiate error termination.

ok, great. I’m familiar with git and will try my best to bring our patches into the main branch. How should we proceed?

While I can’t pay you, I can also offer to help you with learning git. I also switched from svn, and despite the steep learning curve and sometimes unlogical syntax, I did not regret this switch for a second.

Regarding certified code: Compilers might have regressions, hardware might behave differently than expected. So switching to a new version of gfortran, changing hardware, etc. would need to trigger the expensive review request if the review process is really meant to detect bugs. Probably these ‘certifications’ just serve as an alibi for legal reasons. Unit tests are standard in 2021. Having a code for nuclear energy without a test suite that can cope with a small syntax change is just careless. If no one dares to touch a code even for a minor change, I would consider it broken.

3 Likes

Thanks @sblionel. It looks like you agree. You already have at least two other people who offered help (Milan and I), but I am sure there will be more.

Are you ok with us starting an effort to publicly discuss a draft of a list of features that should go into 202Y? If you give us a green light, we will first come up with a plan how to do that, then discuss with you, get you on board with the plan and then do it. It looks like there is enough time to get solid back and forth discussion with the community in the “large” sense and to get consensus in the large sense. The WG5 can then take it as a starting point (not binding, but hopefully influential). Obviously, if we fail to get community consensus, then WG5 will do their “best judgement”. But I would like to try.

4 Likes

If you want to put together a list of features that have been suggested, to encourage discussion, fine. Please do not represent this as “should go into 202Y” or as something representing WG5/J3.

WG5 will draw on many sources of feature suggestions - the more early discussion, the better.

1 Like

Thank you. Yes, this would not represent WG5. The actual final list would be voted upon by WG5 members, so if somebody wants to influence it, they would have to join WG5.

However, the list would be about what the community would like to go into 202Y, that is the whole point. Can you elaborate a little more why we cannot discuss that?

1 Like

Sometimes “should” is used to make a prediction, for example when one says “It should be sunny tomorrow.” The phrase “X should go into 202Y” could be interpreted by outsiders as “it is likely that X will be in 202Y”. So proposals can be discussed here, but I think @sblionel wants it to be clear to the Fortran community that any consensus reached here would still not be binding on J3.

3 Likes

I see. Yes, that is fine with me. I didn’t realize “should” could imply that WG5 is bound by this. As I said above, WG5 is not bound by this, but I simply want the community to help create a plan for 202Y, to be involved from the beginning. WG5 does not have to follow it, but since multiple people from WG5 will be involved, hopefully including the chair of WG5 :slight_smile:, then I am hoping WG5 will be “inspired” by the list.

2 Likes

I totally agrree. Unfortunately, this is pretty much the norm in nuclear industry and academia. I’ve made it my mission to find these codes and convince their owners it would be cheaper for them to pay me to fix them than to continue on with the costly “review” process they currently have, because there is no such thing as software that doesn’t ever need to be changed.

I’ve seen dozens of examples of codes that went through the following progression.

  1. An engineer (or researcher, etc.) needs to do similar calculations on a regular basis. They just learned this new Fortran programming thing, so they write a program to help them do it faster.
  2. They overhear a colleague lament that they wish there a quicker way to do the calculation, and hand them their new program. This continues to happen several times. Tweaks and new features get added along the way, often without a real understanding, and never reconsidering the original design
  3. Eventually (often long after the original developer is gone) a manager catches wind of this program and assigns someone to “own” it
  4. Quality Assurance finally hears about it, and puts a stop work order on all these calculations until someone can perform an official review of the program. This ends up being very costly due to
    a. The stop work order preventing billable work from getting done
    b. What ends up being an arduous, manual, black-box testing effort
  5. This becomes the defacto “specification” for what the code is supposed to do. No one dare investigate further, learn how the code actually works, or heaven forbid make changes to the code, lest they have to repeat step 4.
  6. Throw money money at compiler vendors to make sure we can continue to compile our already broken code, lest we have to admit we don’t actually know how our code works.

If you ever want a chance at breaking backwards compatibility in Fortran, these are the people you’ll have to convince. I’m getting pretty good at fixing these codes, but I can always use help finding them and convincing people the effort is worth it.

4 Likes

A Hacker News thread has become a discussion of Fortran’s backward compatibility. I think the following comment from BlackFly puts it well (although I don’t support deleting old features from the standard)

People will joke about the primitiveness of Fortran as long as they are required to preface every module and program with implicit none. Also, every time they pick up lapack and need to specify the “leading dimension of A” they will recall how Fortran had it’s roots in a language without dynamic memory allocation and how they’re still living with that legacy. Fortran’s legacy leaks all over the place: you rapidly get a feel that it is something which is old and creaky, even if it is actually old and rock solid. The ergonomics are very much not modern, though, but as with all discussions of ergonomics, that is going to depend on how you like to hold your tool.

Not[e] that other languages which have widespread support also have similar historical mistake leakage. Null vs Optional in Java comes to mind. The python 2 → 3 debacle was a similar sort of “historical mistake correction” but the breakage of backwards compatibility lead to quite some polarization. Actually, in python 2 → 3, the python core developers tried to fix a historical defect that fortran still has: print as a keyword vs a function.

The purpose of print is not to return a value, so I don’t agree that it should be a function. Maybe a subroutine, if one were starting from scratch.

3 Likes

Impressive.

P.S. My record is 45 minutes to submit a merge request from a bug report here: "Parsing error: syntax error" in print format which should not be there (#491) · Issues · lfortran / lfortran · GitLab, I happened to be at a computer, so I just fixed it.

3 Likes

The part I take exception to is your use of “the community”. What you mean here is the small set of motivated users who are proposing features in the Fortran Features GitHub. This is not representative of the Fortran user community as a whole or even a large part of it.

I absolutely encourage attempts to get more Fortran users involved in suggesting and discussing possible features. What I don’t want is any implication that these are leading contenders for inclusion. You could say, “Here is a selection of the ideas some of us have come up with - what do you think of them? Do you have ideas of your own?” I’ll note that there are lots of features from the 2017 survey that didn’t make the cut for 202X and many of them would be considered for 202Y.

5 Likes

Yes, something like that.

Yes, I agree that the community here is not big enough to be representative. But it is not small. The @fortranlang Twitter account has over 1500 followers. That’s not a bad start, I would not call that small. But our (my) goal is to grow this community to be comparable, say, to @rustlang, which has 80,000 followers, or JuliaLanguage which has 20,000 followers. (Yes I know Twitter is not everything.)

5 Likes

I know the conversation has drifted away from NEK specifically, but I for one am extremely excited by the announcement of Neko! Thanks to @pcosta for posting the ArXiv link, and if anyone has any more information about Neko (release date, etc), I’d love to hear it.

With regard to NekRS specifically, I think a significant factor in the switch to C++ was just the fact that Tim Warburton’s group (the ones behind the OCCA kernel language) aren’t really Fortran users. The main goal of NekRS, as I understand it, was to be able to target certain current and upcoming DOE computers that are accelerator based, hence the interest in OCCA.

4 Likes

I can confirm that @hsnyder is 100% correct.

The NekRS code includes code from my team’s libParanumal library. We wrote that code in C/C++ and developed performance portable OCCA based implementations to perform offload computing tasks.

fwiw OCCA also has a F90 interface ( example code )contributed by a community member after the libParanumal project was well under way. However, the OCCA compute kernel language is still C-like. Some years ago we also had a limited fortran-like kernel language, but there was no interest in using it so it was deprecated.

The Neko project is very interesting, and also uses some kernels derived from those we built for libParanumal, but appears to be in active development and has not been released yet.

It was not my intent to “replace” Nek5000 fortran code with C/C++/OCCA. However, the code we developed within my team has been adapted by some in the Nek community as a platform to build NekRS to explore performance at scale on emerging architectures. The Nek5000 and NekRS codes are interoperable and each coexist with somewhat different use cases and capabilities. The contributors to those projects can better explain their plans than I can.

5 Likes

@paranumal thanks for the explanation with links to your codes and welcome to the forum!

5 Likes

I would just like to say, Fortran being my 5th language or so and me now choosing to write my programs in it (that I want to go fast anyways; python otherwise), this is one of the biggest reasons why I’ve moved to it. Modern Fortran is simple, but [mostly] elegant and fast. I’ve done a couple Modern Fortran tutorials in my community, and people are impressed with how nice to read Modern Fortran is compared to what they think of as Fortran. The problems I encounter nowadays are mainly ecosystem (which fpm seems to be working to fix), and history - if I have an error to look up, or functionality to look up, I often encounter old F77/F90 material/solutions which are incomplete or inelegant or both.

7 Likes