I am extraordinarily pleased to announce a new release of my refactoring source-to-source compiler for FORTRAN 77! So happy!

github.com/wimvanderbauwhede/R
#coding
#compiler

@wim_v12e Thank you so much! I saw that you played around with the Nek test case we discussed earlier this year. I should try it out :)

@ashwinvis

Hi Ashwin, the compiler can now handle Nek but not completely, because the Nek-code is not type safe.
The problematic bits are in mpi_dummy.f90, where an integer is passed to a double, and the compiler throws an error.

I could fix this by casting but usually when people do this kind of thing it is a mistake. So maybe I will add some "ALLOW_UNSAFE_CAST" option, when I have time again.

Also, you'll need the new -I option to inline all includes.

@ashwinvis It depends a bit what your goal is. Because of Nek's structure, it is impossible to turn all include files into modules. So I have to inline them. But then you lose modularity. So a better way would be to change the Nek code so that includes can become modules.
For the MPI part, the easiest way os to just keep that code as F77, unsafe casts and all.

@wim_v12e The problem is the use of nested includes isn't? If so I have an updated user code which has implicit none and single level includes. Shall I make a pull request on that?

@ashwinvis No, not the nesting, I handle that. It is that some includes depend on values or declarations defined outside of them. Typically in the lines before the include statement.

@ashwinvis For example, in SIZE, the include SIZE.inc is at the end of the file and depends on parameters in SIZE. It is not possible to convert this into a module.
The solution would be quite simple: include SIZE at the top of SIZE.inc instead.

Another example is TOTAL which is included usually as

include SIZE
...
include TOTAL

and the declarations in TOTAL depend on those in SIZE.

Again, that could be solved by including SIZE at the top of total instead.

Follow

@wim_v12e I see your point. Includes at the end of a code is a weird way of structuring declarations.

@ashwinvis It makes sense for a purely textual inclusion, but it is not modular.

Sign in to participate in the conversation
Mastodon @ SUNET

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!