atlas icon indicating copy to clipboard operation
atlas copied to clipboard

NAG fixes for fypp issue.

Open DJDavies2 opened this issue 9 months ago • 1 comments

Resovles #192.

The problem is that when the pre-processor expands the macros the result contains lines of longer than 132 characters due to the length of the file paths. This just adds some NAG specific code to circumvent the NAG compile issues described in #192. It isn't a very good solution but I can't obviously see anything better.

DJDavies2 avatar May 08 '24 10:05 DJDavies2

CLA assistant check
All committers have signed the CLA.

FussyDuck avatar May 08 '24 10:05 FussyDuck

I was just reading this here, which may solve this problem and be also a more desired output of handling _FILE_ anyway https://fypp.readthedocs.io/en/stable/fypp.html#rendering-file-names-as-relative-paths I can have a look on adding this flag --file-var-root to fypp generation stage.

wdeconinck avatar Jun 05 '24 10:06 wdeconinck

It doesn't seem to be so straightforward to apply a general approach with '--file-var-root'. However I verified the generated file <atlas-build-dir>/src/atlas_f/field/atlas_Field_module.F90 and I don't get the line-length going over 132, and fypp has split the line in 2, e.g.:

  call fckit_exception%abort( "Rank mismatch", "/Users/willem/work/atlas-bundle/source/atlas/src/atlas_f/field/atlas_Field_module.f&
# 172 "/Users/willem/work/atlas-bundle/source/atlas/src/atlas_f/field/atlas_Field_module.fypp"
      &ypp", 172 )

Could you show me from the generated file as well an example of offending line?

wdeconinck avatar Jun 06 '24 14:06 wdeconinck

It doesn't seem to be so straightforward to apply a general approach with '--file-var-root'. However I verified the generated file <atlas-build-dir>/src/atlas_f/field/atlas_Field_module.F90 and I don't get the line-length going over 132, and fypp has split the line in 2, e.g.:

  call fckit_exception%abort( "Rank mismatch", "/Users/willem/work/atlas-bundle/source/atlas/src/atlas_f/field/atlas_Field_module.f&
# 172 "/Users/willem/work/atlas-bundle/source/atlas/src/atlas_f/field/atlas_Field_module.fypp"
      &ypp", 172 )

Could you show me from the generated file as well an example of offending line?

This is basically what I am seeing as well. I think my description of the issue in the first comment isn't quite correct, the line is being chopped at 132 characters but the problem is the insertion of the # 172 ... line in the middle of the string line break. It looks like NAG doesn't handle this syntax (it isn't standard).

DJDavies2 avatar Jun 07 '24 23:06 DJDavies2

Thanks for that clarification @DJDavies2 . Perhaps you can try to add FYPP_ARGS --line-numbering-mode=nocontlines within this statement ? -> https://github.com/ecmwf/atlas/blob/develop/src/atlas_f/CMakeLists.txt#L279 And verify the continuation line "line markers" are gone? If that is the case I can add this argument within the fypp macro within fckit for NAG compiler so that it would just work in any fypp file, not just Atlas.

wdeconinck avatar Jun 10 '24 08:06 wdeconinck

FYPP_ARGS --line-numbering-mode=nocontlines does seem to work for the atlas_f subdirectory. However there is also the file src/tests/runtime/fctest_trace.fypp and it isn't clear where I should make the change, can you point me to what I need to do?

DJDavies2 avatar Jun 10 '24 14:06 DJDavies2

Thanks for confirming it works. No need to change anything anymore. I will make the change in the fypp cmake macro exported by fckit. That should then automatically fix atlas and other packages using fypp with NAG compiler.

wdeconinck avatar Jun 10 '24 14:06 wdeconinck

That commit message in https://github.com/ecmwf/fckit/commit/613d53ef5257db641ab103aefb93322f4456eb57 auto-closed this PR. Interesting.... Please verify this works for you :)

wdeconinck avatar Jun 10 '24 15:06 wdeconinck

Yes, that changed worked for me, thanks.

DJDavies2 avatar Jun 10 '24 15:06 DJDavies2

This is now released in fckit 0.13.0

wdeconinck avatar Jun 10 '24 15:06 wdeconinck