Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fortran Serialisation Framework #175

Merged
merged 23 commits into from
May 25, 2023
Merged

Conversation

samkellerhals
Copy link
Contributor

@samkellerhals samkellerhals commented Mar 22, 2023

Description

Provide a flexible framework for serializing Fortran execution to improve testing and performance optimizations.

Currently we foresee two use cases:

  • at the granule level (defined as standalone-usable Fortran components of ICON), which have a well-defined interface, but no serialization directives.
  • at the level where GT4Py stencils are integrated into ICON (via Liskov).

See https://hackmd.io/tPnjCjfjTjy2XJfHtffv3w?both

This PR introduces

  • f2ser: A Fortran Granule Interface Parser, which parses a given granule and generates ppser serialisation statements for each variable in the init and run subroutines.

  • Additions to to liskov, enabling the generation of ppser serialisation statements using the --ppser option.

Build Integration

The changes in this PR https://github.com/C2SM/icon-exclaim/pull/159 are necessary for the liskov serialisation code to compile and run.

@samkellerhals samkellerhals marked this pull request as draft March 22, 2023 10:16
samkellerhals and others added 8 commits March 27, 2023 12:59
* Parse granule using f2py

* Revert icon4pygen rename

* Parse derived types (collect type info in dependencies)

* Fully parse variables and inject line numbers

* Improve parsing tests
* Add basic deserialisation

* Add deserialiser and tests

* Add basic savepoints

* Move f90 sources to testutils

* Create maximum two savepoints per subroutine
* Add basic structure

* Fix tests

* Add codegen templates

* Add more codegen

* Generate code in correct location

* Cleanup and add docstrings

* Remove todo

* Update fortran granule
* CLI created

* Input parameter renaming, dependencies made optional

* Update cli.py

---------

Co-authored-by: Samuel <[email protected]>
Introduces fixes to the f2ser code generation template.
* Remove superflous methods

* cleanup
@samkellerhals samkellerhals requested review from muellch and halungge May 11, 2023 12:09
@samkellerhals samkellerhals marked this pull request as ready for review May 11, 2023 12:14
@samkellerhals samkellerhals mentioned this pull request May 17, 2023
Copy link
Contributor

@halungge halungge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes, also many things are open for discussion of course, since I am not sure my remarks make sense everywhere.

pyutils/src/icon4py/f2ser/cli.py Show resolved Hide resolved
pyutils/src/icon4py/f2ser/deserialise.py Outdated Show resolved Hide resolved
pyutils/src/icon4py/f2ser/deserialise.py Show resolved Hide resolved
liskov/src/icon4py/liskov/codegen/shared/generator.py Outdated Show resolved Hide resolved
liskov/src/icon4py/liskov/codegen/shared/deserialiser.py Outdated Show resolved Hide resolved
liskov/README.md Outdated Show resolved Hide resolved
@samkellerhals samkellerhals requested a review from halungge May 22, 2023 11:36
Copy link
Contributor

@muellch muellch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should put CI/CD in place for the Liskov serialization mode, so we do not break it when we change the dycore integration in ICON.

@muellch muellch self-requested a review May 23, 2023 13:28
Copy link
Contributor

@muellch muellch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally re-opened review.

@muellch
Copy link
Contributor

muellch commented May 24, 2023

Alright, looks good!

@samkellerhals samkellerhals merged commit 4d354a9 into main May 25, 2023
@samkellerhals samkellerhals deleted the fortran-serialisation branch May 25, 2023 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants