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

ParallelRoutineDispatchTransformation #299

Open
wants to merge 74 commits into
base: nabr-parallel-loop-driver-trafo
Choose a base branch
from

Conversation

ecossevin
Copy link

No description provided.

@FussyDuck
Copy link

FussyDuck commented Apr 25, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ecossevin
❌ COSSEVIN Erwan


COSSEVIN Erwan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (nabr-parallel-loop-driver-trafo@f7b87ff). Learn more about missing BASE report.

Additional details and impacted files
@@                        Coverage Diff                         @@
##             nabr-parallel-loop-driver-trafo     #299   +/-   ##
==================================================================
  Coverage                                   ?   95.12%           
==================================================================
  Files                                      ?      136           
  Lines                                      ?    29787           
  Branches                                   ?        0           
==================================================================
  Hits                                       ?    28336           
  Misses                                     ?     1451           
  Partials                                   ?        0           
Flag Coverage Δ
loki 95.12% <ø> (?)

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.

@ecossevin ecossevin force-pushed the nabr-parallel-loop-driver-trafo branch 2 times, most recently from d1ece0e to 348e1bb Compare April 26, 2024 11:19
Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

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

This looks very promising! A few comments just about things I noticed. More offline now...

@@ -34,20 +61,32 @@ def process_parallel_region(self, routine, region):
return

dr_hook_calls = self.create_dr_hook_calls(
routine, pragma_attrs['name'],
routine, routine.name+":"+pragma_attrs['name'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a small remark for a more pythonic string composition:

Suggested change
routine, routine.name+":"+pragma_attrs['name'],
routine, f'{routine.name}:{pragma_attrs["name"]}',

"KPROMA", "YDDIM%NPROMA", "NPROMA"
]
#TODO : do smthg for opening field_index.pkl
with open(os.getcwd()+"/transformations/transformations/field_index.pkl", 'rb') as fp:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just as a remark for later: this map should be loaded/compiled/supplied in the head script, and then handed to the Transformation as an argument.

Comment on lines 36 to 52
self.new_calls = []
# IF (ASSOCIATED (YL_ZA)) CALL FIELD_DELETE (YL_ZA)
self.delete_calls = []
# map[name] = [field_ptr, ptr]
# where :
# field_ptr : pointer on field api object
# ptr : pointer to the data
self.routine_map_temp = {}
self.routine_map_derived = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again a remark for later, and I know that this doesn't apply in your use case but would be a requirement for integration into the main branch. So, I'm pointing this out here:
Transformations are intended to be written in a way that allows to instantiate them once and then apply them to an arbitrary number of subroutines. This information is local to one routine but currently it lives on the transformation object. Later, we should consider making these local variables in the transform_subroutine and, where necessary, have methods update or return them.

Comment on lines 238 to 244
ptr_var=()
for value in self.routine_map_derived.values():
dcl = ir.VariableDeclaration(
symbols=(value[1],)
)
ptr_var += (dcl,)
routine.spec.append(ptr_var)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would recommend using the following pattern to add the relevant declarations:
routine.variables += tuple(v[1] for v in self.routine_map_derived.values())

raise NotImplementedError("This type isn't implemented yet")

# Creating the pointer on the field api object : YL%FA, YL%F_A...
if routine.variable_map[var.name_parts[0]].type.dtype.name=="MF_PHYS_SURF_TYPE":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just as a remark: Using routine.variable_map repeatedly can be costly, because it compiles the map everytime from the variable declarations. In a routine like this, it's recommended to cache this at the top of the routine as variable_map = routine.variable_map and then use that local copy.

@ecossevin ecossevin force-pushed the nabr-parallel-loop-driver-trafo branch 2 times, most recently from d1cf092 to 04c3e75 Compare April 29, 2024 08:14
@ecossevin ecossevin force-pushed the nabr-parallel-loop-driver-trafo branch from 04c3e75 to 180695a Compare April 29, 2024 16:20
@ecossevin ecossevin force-pushed the nabr-parallel-loop-driver-trafo branch from 58c95f4 to e77e88d Compare May 2, 2024 13:25
@reuterbal reuterbal force-pushed the nabr-parallel-loop-driver-trafo branch from 8cbccfe to f7b87ff Compare May 3, 2024 08:49
@reuterbal reuterbal changed the title Nabr parallel loop driver trafo ParallelRoutineDispatchTransformation May 3, 2024
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.

3 participants