ecmwf-ifs / loki

Freely programmable source-to-source translation for Fortran
https://sites.ecmwf.int/docs/loki/
Apache License 2.0
29 stars 12 forks source link

Marked region removal and general code removal transformation #276

Closed mlange05 closed 5 months ago

mlange05 commented 6 months ago

This PR combines two closely related features:

The new pragma-based region removal will pretty much do as it says: Upon encountering a region marked with !$loki remove / !$loki end remove it will simply remove the entire code region.

The new loki.transfom.transform_remove_code basically includes the previous dead code elimination (renamed), and combines it with the new region removal and a re-write of the RemoveCallsTransformation. The latter is now a as a single Transformer with a wrapper routine that allows it to be applied to Subroutine objects. All three utilities are then provided as a single RemoveCodeTransformation for use with the Scheduler and batch-processing engine.

Since the wrapper routines for these utilities would otherwise create name clashes with the respective flags of the overarching Transformation, we adopt the do_remove_xxx naming convention, as discussed offline.

In some more detail:

github-actions[bot] commented 6 months ago

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/276/index.html

mlange05 commented 6 months ago

Clean with EC-physics regression.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 97.81022% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 92.89%. Comparing base (a594b44) to head (da9cf28).

Files Patch % Lines
loki/transform/transform_remove_code.py 96.80% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #276 +/- ## ======================================= Coverage 92.88% 92.89% ======================================= Files 102 102 Lines 18253 18291 +38 ======================================= + Hits 16954 16991 +37 - Misses 1299 1300 +1 ``` | [Flag](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/276/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | Coverage Δ | | |---|---|---| | [lint_rules](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/276/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `96.39% <ø> (ø)` | | | [loki](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/276/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `92.87% <96.96%> (+0.02%)` | :arrow_up: | | [transformations](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/276/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `92.10% <100.00%> (-0.13%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mlange05 commented 5 months ago

Hi @reuterbal just a quick heads-up: there was some cross-fire between PR #271 and this one, causing a test failure for scheduler / pipeline configs. I've rebased over latest main and adjusted accordingly. Only the top two commits should be new. Hope this works now.

reuterbal commented 5 months ago

Many thanks for catching the rebase fall-out! As discussed offline, I've done a little touch-up on the docstrings, otherwise this should be good to go!