-
Notifications
You must be signed in to change notification settings - Fork 15
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
f2c transpile via convert #208
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/208/index.html |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
+ Coverage 92.30% 92.31% +0.01%
==========================================
Files 95 95
Lines 17368 17368
==========================================
+ Hits 16032 16034 +2
+ Misses 1336 1334 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks, very much looking forward to bringing this in!
However, I think we should use this opportunity to go a little further:
-
Remove the
transpile
entry point fromloki_transform.py
. Going forward, we don't want to use this anymore so better get rid of it right away. The only place that uses this is CLOUDSC. To avoid breaking the regression tests, I would convert theloki_transform_transpile
CMake wrapper to a compatibility layer that reshuffles the provided options, prints a big deprecation warning, and then callsloki_transform
, similar to whatloki_transform_convert
does. -
Make the Fortran2CTransformation compliant with the Transformation manifests. I'm not sure what would be the minimal invasive way (we can have an offline discussion to talk through the different options), but one possibility would be to remove all the explicit recursion from the transformation, and change the invocation for the headers such that it is invoked for every module in those.
I would, however, not include anything beyond that in this PR to not expand the scope too much. For example, a subsequent PR should split the F2C Transformation to generate derived type accessors ("the header transformation") in a separate Transformation class.
f2c_transformation = FortranCTransformation(path=build) | ||
scheduler.process(f2c_transformation) | ||
for h in definitions: | ||
f2c_transformation.apply(h, role='header') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, here it is applied directly to a file, but the F2C Transformation is not marked as recursing to internal scopes - instead it does this internally. I think we should take this opportunity to make the Transformation compliant with the manifest parameterisation. I'll explain in the overall review comment what I mean.
Secondly, I'm not too thrilled by the fact that we provide files as headers (which, to me, implies a "read-only for enrichment" meaning) and then apply transformations to them. Since the purpose here is to deal with derived types, which we cannot capture in the dependency graph in the current Scheduler implementation, we may have to live with this for now, but that will be different with #213. To avoid that others copy this pattern, would you mind including a comment here that explains that this is temporary?
Longer term, this transformation step to generate accessor methods for derived types should become a separate Transformation that is applied to ModuleItem
only.
Unfortunately it was not possible to "re-route" the CMake Depends on CLOUDSC PR 69. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, very happy with this now! This is a great base for the further developments.
Once @mlange05 has had a look, I suggest the following (as acted out before) as a merge strategy:
- Remove the commit that points to the custom CLOUDSC branch
- Merge the PR with regression tests failing
- Tests on CLOUDSC PR should be successful now
- Merge the CLOUDSC PR
- Run regression tests on Loki main again, should now be successful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a quick rebase, but otherwise GTG I think. Merge strategy sounds good too @reuterbal .
scripts/loki_transform.py
Outdated
@@ -199,7 +201,7 @@ def convert( | |||
|
|||
# Now we instantiate our transformation pipeline and apply the main changes | |||
transformation = None | |||
if mode in ['idem', 'idem-stack']: | |||
if mode in ['idem', 'idem-stack', "c"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the F2C transformation require an "idem" pass?
adb8798
to
b7a9007
Compare
C transpilation via
convert()
transpile()
?