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

(related to #2244) LFRic tiled colouring #2750

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#2244 Fix some issues with colour tilies after rebasing to master
  • Loading branch information
sergisiso committed Nov 23, 2023
commit 7cdba44430f75c6270e3b91e33ca33f1d81cf05a
13 changes: 6 additions & 7 deletions src/psyclone/dynamo0p3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3729,6 +3729,7 @@ def _colourmap_init(self):

for call in [call for call in self._schedule.coded_kernels() if
call.is_coloured()]:
self._add_mesh_symbols(["mesh"])
# Keep a record of whether or not any kernels (loops) in this
# invoke have been coloured and, if so, whether the associated loop
# goes into the halo.
Expand Down Expand Up @@ -3778,9 +3779,6 @@ def _colourmap_init(self):

if non_intergrid_kern and (self._needs_colourmap or
self._needs_colourmap_halo):
# There aren't any inter-grid kernels but we do need colourmap
# information and that means we'll need a mesh object
self._add_mesh_symbols(["mesh"])
# This creates the colourmap information for this invoke if we
# don't already have one.
colour_map = non_intergrid_kern.colourmap
Expand Down Expand Up @@ -3889,7 +3887,7 @@ def declarations(self, parent):
DeclGen(parent, datatype="integer", allocatable=True,
kind=api_config.default_kind["integer"],
entity_decls=[decln]))
if kern.colourtilemap_symbol:
if kern.tilecolourmap_symbol:
parent.add(
DeclGen(parent, datatype="integer",
kind=api_config.default_kind["integer"],
Expand Down Expand Up @@ -7266,6 +7264,8 @@ def stop_expr(self):
colour_var = loop.ancestor(Loop).variable

mesh_sym = sym_table.lookup_with_tag("mesh")
# Create a different array_reference accessor depending on the
# loop type
if self._loop_type == "colour":
asym = self.kernel.last_cell_all_colours_symbol
if not asym:
Expand Down Expand Up @@ -7295,7 +7295,8 @@ def stop_expr(self):

# If it has halos, add an extra argument with the halo depth
const = LFRicConstants()
if self.upper_bound_name in LFRicConstants.HALO_ACCESS_LOOP_BOUNDS:
h_needed = self.upper_bound_name in const.HALO_ACCESS_LOOP_BOUNDS
if Config.get().distributed_memory and h_needed:
if self._upper_bound_halo_depth:
# TODO: #696 Add kind (precision) once the
# DynInvokeSchedule constructor has been extended to
Expand All @@ -7312,8 +7313,6 @@ def stop_expr(self):
halo_depth = Reference(depth_sym)

aref.addchild(halo_depth)
if sref is not None:
return sref
return aref

# This isn't a 'colour' loop so we have already set-up a
Expand Down
8 changes: 4 additions & 4 deletions src/psyclone/psyir/nodes/array_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def create(symbol, indices):
raise GenerationError(
f"expecting the symbol '{symbol.name}' to be an array, but"
f" found '{symbol.datatype}'.")
elif len(symbol.shape) != len(indices):
elif len(symbol.shape) < len(indices):
raise GenerationError(
f"the symbol '{symbol.name}' should have the same number of "
f"dimensions as indices (provided in the 'indices' argument). "
f"Expecting '{len(indices)}' but found '{len(symbol.shape)}'.")
f"the indices argument has '{len(indices)}' elements, but must"
f"have equal or less dimensions than the '{symbol.name}' shape,"
f" which has '{len(symbol.shape)}'.")

array = ArrayReference(symbol)
for ind, child in enumerate(indices):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def test_colour_continuous_writer_intergrid(tmpdir, dist_mem):
assert ("integer(kind=i_def), allocatable :: "
"last_edge_cell_all_colours_field1(:)" in result)
# Initialisation.
print(result)
assert ("last_edge_cell_all_colours_field1 = mesh_field1%"
"get_last_edge_cell_all_colours()" in result)
# Usage. Since there is no need to loop into the halo, the upper loop
Expand Down