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

Fix SccAnnotate when existing acc pragmas declare a copy category more than once #409

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

reuterbal
Copy link
Collaborator

PR #389 introduced a regression in ecphys. There we have an ACC statement like this:

!$acc data copyin(var_a, var_b) &
!$acc &    copyin(var_c) create(var_d)

Now, the ACC statements are checked for existing offload directives. For that, get_pragma_parameters is used to extract offload "categories". However, for situations where a key exists more than once, the values are provided as a list, i.e., for the above we obtain

{'copyin': ['var_a, var_b', 'var_c'], 'create': 'var_d'}

Where previously a simple str.split(',') was used to build a list of variables of each category, we need to be careful to accomodate for the above situation where not a simple string constitutes the value. This PR expands the test to include the above case and fixes the transformation accordingly.

Copy link

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

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.02%. Comparing base (2bbe704) to head (7f7337e).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
+ Coverage   95.57%   96.02%   +0.44%     
==========================================
  Files         201      197       -4     
  Lines       39833    38986     -847     
==========================================
- Hits        38071    37435     -636     
+ Misses       1762     1551     -211     
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 96.01% <100.00%> (+0.45%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@reuterbal
Copy link
Collaborator Author

Build appears to be clean, so this is ready for a look. I haven't run ecphys, yet, though.

@reuterbal reuterbal marked this pull request as ready for review October 16, 2024 21:51
Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

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

Looks sensible. GTG from me.

assert driver_loops[0].pragma[0].content == 'parallel loop gang private(other_var) vector_length(nlon)'
assert driver_loops[0].pragma[0].content in (
'parallel loop gang private(other_var, more_var) vector_length(nlon)',
'parallel loop gang private(more_var, other_var) vector_length(nlon)'
Copy link
Collaborator

Choose a reason for hiding this comment

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

[no action] Curious, why would the ordering go off here? Should this not be deterministic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well spotted! 🦅 - 👁️
I was wondering the same and I suspect it is here:

private_arrays = ', '.join(set(v.name for v in arrays if not v.name_parts[0].lower() in acc_vars))

We could replace this by

 private_arrays = ', '.join(dict.from_keys(v.name for v in arrays if not v.name_parts[0].lower() in acc_vars))

to have a stable sort but unique list. But didn't want to piggy-back this in this hotfix PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahhh yes. I think I've fixed this in one of my dev branches. Not urgent now, this will happen one way or another, I think.

@mlange05 mlange05 added the ready for merge This PR has been approved and is ready to be merged label Oct 17, 2024
@reuterbal reuterbal merged commit 623de59 into main Oct 17, 2024
13 checks passed
@reuterbal reuterbal deleted the nabr-fix-annotate branch October 17, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge This PR has been approved and is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants