stfc / PSyclone

Domain-specific compiler and code transformation system for Finite Difference/Volume/Element Earth-system models in Fortran
BSD 3-Clause "New" or "Revised" License
103 stars 24 forks source link

LFRic changed name of field_r*types #2623

Open hiker opened 3 weeks ago

hiker commented 3 weeks ago

At around r50490 lfric replaced the existing field_{r32,r64}_mod and integer_field with a template, and the build system includes a templaterator. As a result, the name of these files has changed. This does not really affect much of PSyclone, it relies on field_mod.F90:

 #if (RDEF_PRECISION == 32)
 use field_real32_mod, only: field_type         => field_real32_type, &
                              field_proxy_type   => field_real32_proxy_type, &
                              field_pointer_type => field_real32_pointer_type

But a lot of psydata libraries use the original name (to be able to work with 32- and 64-bit fields), they need to be changed. And all PSycl, seeone tests, examples, and tutorials(?) need to be changed.

If/when we agree to go ahead with this, we should move the infrastructure files to externals (so that in the future when lfric_core is on git, we can use a submodule), and also take care of pre-processing (in case of case-insensitive file systems), see #2239.

The templaterator itself seems to be a small-ish python script using jinja2, so we might be able to use our own script to create the source files from the template, without having to add the templaterator(?)

arporter commented 3 weeks ago

That all sounds OK to me. I was thinking about suggesting we bite the bullet and bring in the infrastructure wholesale (with permission from the Met Office) but that might just complicate things further?

hiker commented 3 weeks ago

Yes, the license issue might be the biggest problem. @TeranIvy , any idea if we can add the infrastructure folder (I believe this is all we need, likely even only a subset, since it also contains build tools)? We try to be on current LFRic, so I kind of need to fix the psydata stuff (for kernel extraction). Easy enough to do it with a search&replace, but then I have these changes in my tree, which is annoying :)

stevemullerworth commented 2 weeks ago

The license is not a problem, and the Met Office doesn't have a problem. I have approval for LFRic to go public, so taking a mirror now should be fine. Hoping to do a port to a public GitHub repo in 2025 - possibly with a mirror copy earlier than that.

hiker commented 2 weeks ago

Great, then I can have a look! Thanks a lot!

arporter commented 2 weeks ago

One thing we need to be careful of is not to shoot ourselves in the foot when it comes to our ability to test with other compilers, especially nvidia.

hiker commented 2 weeks ago

Besides the name change (and I can't see this being a problem with any compiler ;) ), the templaterator is a pre-processing step, i.e. nothing is different from what PSyclone of fparser will see.

Are you thinking of any specific issues?

arporter commented 2 weeks ago

I thought you were talking about bringing in the whole infrastructure. If you're not then it's all fine :-)

hiker commented 2 weeks ago

I don't think we should include the whole lfric_core directory (though I kind of said it this way). There is a lot of unnecessary stuff in there (applications, mesh tools, rose_stem components, unit-tests) - Seems to be around 100 MB, only 2.2 MB with actual source files that we would need for compiling lfric (well, plus whatever we need to actually compile this, but I will likely just use a standard Makefile and some jinja?? Well, I'll check).