Skip to content

Commit

Permalink
Creating new function + dbg
Browse files Browse the repository at this point in the history
  • Loading branch information
ecossevin committed Jan 7, 2025
1 parent 5643f47 commit 4122db2
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions transformations/transformations/parallel_routine_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ def change_routine_name(self, routine):
routine.name + "_PARALLEL"
)

def not_an_arg(self,arg):

if(
isinstance(arg, sym.LogicalOr)
or isinstance(arg, sym.LogicalAnd)
or isinstance(arg, sym.StringLiteral)
or isinstance(arg, sym.LogicLiteral)
or isinstance(arg, sym.IntLiteral)
or isinstance(arg, sym.FloatLiteral)
or isinstance(arg, sym.Product)
or isinstance(arg, sym.Sum)
):
return(True)
else:
return(False)
def init_map_routine(self, routine):
"""
Init map_routine dictionnary. This dictionnary contains information useful
Expand Down Expand Up @@ -831,8 +846,9 @@ def get_access_rw(self, region, map_routine, map_region):
map_intent_access["inout"] = "RDWR"
new_map_intent = {}
for var, value in map_intent.items():
if var.name in region_map_vars:
new_map_intent[region_map_vars[var.name][1].name] = map_intent_access[value]
if not self.not_an_arg(var):
if var.name in region_map_vars:
new_map_intent[region_map_vars[var.name][1].name] = map_intent_access[value]
#region_map_vars[var.name][1]: map_intent_access[intent] for var, value in map_intent.items()}

return(new_map_intent)
Expand All @@ -842,11 +858,11 @@ def analyse_intent(self, intent1, intent2):
Rules for updating the intent of a variable already
having an intent.
"""
if (intent1 or intent2) == "out":
if intent1 == "out" or intent2 == "out":
return "out"
elif (intent1 or intent2) == "inout":
elif intent1 == "inout" or intent2 == "inout":
return "inout"
elif (intent1 and intent2) == "in":
elif intent1 == "in" and intent2 == "in":
return "in"

def read_interface(self, call_name, map_call_interface):
Expand Down Expand Up @@ -1161,16 +1177,7 @@ def process_argument(
):
if arg not in vars_call:
vars_call.append(arg)
if not (
isinstance(arg, sym.LogicalOr)
or isinstance(arg, sym.LogicalAnd)
or isinstance(arg, sym.IntLiteral)
or isinstance(arg, sym.LogicLiteral)
or isinstance(arg, sym.Product)
or isinstance(arg, sym.Sum)
):
# or isinstance(arg, sym.StringLiteral)):

if not ( self.not_an_arg(arg)):
if arg.name in region_map_arrays:
return self.update_arg_dims(arg, region_map_arrays)
if arg.name in region_map_derived:
Expand Down Expand Up @@ -1501,13 +1508,7 @@ def process_not_region_call(self, routine, map_routine):

new_arguments = []
for arg in call.arguments:
if not (
isinstance(arg, sym.LogicalOr)
or isinstance(arg, sym.LogicalAnd)
or isinstance(arg, sym.StringLiteral)
or isinstance(arg, sym.LogicLiteral)
or isinstance(arg, sym.FloatLiteral)
):
if not ( self.not_an_arg(arg)):
if arg.name in map_region["map_arrays"]:
new_arguments += [map_region["map_arrays"][arg.name][0]]
elif arg.name in map_region["map_derived"]:
Expand Down

0 comments on commit 4122db2

Please sign in to comment.