New GitHub repo Open Catalog of Best Practices for Modernization and Performance

Dear Fortran programmers and enthusiasts, we have been working on collecting, documenting and curating examples of rules related to Fortran best practices and we have recently moved the Open Catalog of Best Practices for Performance to GitHub, releasing the contents under an Apache license.

We are actively following the discussions in this forum in order to identify new rules that might be added to the open catalog. We will keep you posted and we would appreciate any contributions to grow the set of rules related to Fortran modernization and optimization, including performance.

We hope you find it useful and we look forward to hearing your opinion about it in order to align it better with this Fortran community!

11 Likes

Congratulations! Nice work. I have read some of your benchmarks and I would like to point out that not only do your suggestions belong to “best performance” practice but also “best practices” in general. This applies specially well to the OpenMP examples.

Nice work!!

I have a couple of remarks:

  • The xs in the table show for which language the respective PW applies, right? if so, I already see that PW002 and PW003 have Fortran examples, but in the table Fortran is not x-ed. Haven’t check the full table.
  • In PW004, I see the following declaration: integer :: i, factor = 42. I would say that defining a parameter in this way is not a good practice. Generally speaking it would be better to either do:
integer, parameter :: factor = 42
integer :: i

which would give you something similar to a const in C/C++, or

integer :: i, factor
factor = 42
  • I randomly went to PWR044: avoiding floating point conversions when affecting constants is also an issue that is often discussed. The example there in could be translated almost exactly for Fortran except that, given that most compilers in default mode will default real to single precision 2.2 would be a single precision constant, and if the operation involves double precision one would also have kind conversions. Here Fortran Best Practices/Floating point Numbers one can find a good overview of the recommended practice to avoid the same problem.
1 Like

Thank you for sharing your thoughts. Indeed as we add more PWRs we are considering widening the scope of the best practices to modernization and optimization, the latter including performance as well.

We will give it a thought!

1 Like

Thank you for taking the time to do a review, this is definitely really helpful :slight_smile:

We will double check what you have pointed out!

1 Like

I love the idea of this and will have to take a look in depth a bit later. I’m particularly interested in the functions marked pure optimizations, since I have never seen that produce a measurable benefit.