Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
bf523ba
#1312: create initial ScalarArray example
mo-alistairp Jul 24, 2025
dc1ec4a
#1312: start adding code generation for ScalarArrays
mo-alistairp Aug 19, 2025
862f368
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Aug 19, 2025
1a07148
#1312: lint fix
mo-alistairp Aug 19, 2025
decf6c1
#1312: condense the scalar_array functionality into the scalar function
mo-alistairp Aug 19, 2025
6d74811
#1312L lint fix
mo-alistairp Aug 19, 2025
71c7d0c
#1312: fix the scalar type check logic
mo-alistairp Aug 19, 2025
fa6a7e6
#1312: remove the empty test file for now
mo-alistairp Aug 19, 2025
ae9ba03
#1312: fix the failing test
mo-alistairp Aug 19, 2025
4961046
#1312: actually fix the failing test
mo-alistairp Aug 19, 2025
bc8260f
#1312: lint fix
mo-alistairp Aug 19, 2025
8e2b3de
#1312: Add initial test implementation of ScalarArrays
mo-alistairp Aug 21, 2025
5b8c42d
#1312: fix tests to check that gh_scalar_array is being assigned prop…
mo-alistairp Aug 21, 2025
ea0e8f7
1312: add TODO to check whether is_scalar references need updating
mo-alistairp Aug 21, 2025
3b6ad7d
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Aug 21, 2025
33caeac
#1312: lint fix
mo-alistairp Aug 21, 2025
605d9ab
#1312: create a loose structure for acc access
mo-alistairp Aug 21, 2025
c9a5598
#1312: Code gen and stub gen for ScalarArrays
mo-alistairp Oct 21, 2025
bbb37b7
#1312: lint fix
mo-alistairp Oct 21, 2025
9f3cfb5
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Oct 21, 2025
8e311c2
#1312: lint fix
mo-alistairp Oct 21, 2025
ea6ae8d
#1312: lint fixes
mo-alistairp Oct 22, 2025
136d89e
#1312: move dimension array to lfric_scalar_args
mo-alistairp Oct 23, 2025
fd0d546
#1312: add declarations for ScalarArray
mo-alistairp Oct 24, 2025
50a2c09
#1312: Move ScalarArray declarations to its own file
mo-alistairp Nov 3, 2025
f4c685b
#1312: correct the type checking in declarations
mo-alistairp Nov 3, 2025
cc53390
#1312: return lfric_scalar_args to original state
mo-alistairp Nov 3, 2025
f3ee59e
#1312: fix if statement to exclude ScalarArray
mo-alistairp Nov 3, 2025
140b022
#1312: Add LFRicScalarArrayArga to paths
mo-alistairp Nov 4, 2025
8527d01
#1312: Alter ScalarArray declaration
mo-alistairp Nov 4, 2025
39f96fb
#1312: Lint fix
mo-alistairp Nov 4, 2025
3360be3
#1312: Lint fix
mo-alistairp Nov 4, 2025
02a42b2
#1312: Remove ScalarArrays from is_scalar
mo-alistairp Nov 4, 2025
6cf25bc
#1312: Fix is_scalar statement in lfric_loop
mo-alistairp Nov 5, 2025
a9dc367
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Nov 10, 2025
75692cc
#1312: reintroduce ScalarArray if statement in arg_ordering
mo-alistairp Nov 10, 2025
6edd5f3
#1312: add super scalar call to kern_stub_arg_list
mo-alistairp Nov 10, 2025
12b4a74
#1312: lint fix
mo-alistairp Nov 10, 2025
c455482
#1312: fix arg_ordering to include ScalarArrays in assertion
mo-alistairp Nov 10, 2025
184a624
#1312: Fix lfric_test to check ScalarArray rather than field
mo-alistairp Nov 10, 2025
20ecf84
#1312: change INTEGER_TYPE to LFRic equivalent
mo-alistairp Nov 10, 2025
35bc15a
#1312: add dims_array dimensions to ScalarArray declarations
mo-alistairp Nov 11, 2025
3a6ddc6
#1312: change find_or_create to lookup to fix code generation
mo-alistairp Nov 12, 2025
e92ca50
#1312: lint fix
mo-alistairp Nov 12, 2025
a21d57e
#1312: lint fix
mo-alistairp Nov 12, 2025
1d6b212
#1312: copy ScalarArray creation into the stub list
mo-alistairp Nov 13, 2025
1301f11
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Nov 13, 2025
a73d33b
#1312: Remove the temporary KernStubArgList code
mo-alistairp Nov 13, 2025
39b7cb9
#1312: Alter test cases to have 5 args in testkern to avoid error
mo-alistairp Nov 13, 2025
9556c2b
#1312: Try comment out changes to see if it fixes errors
mo-alistairp Nov 14, 2025
4052702
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Nov 14, 2025
86d3231
#1312: lint fix
mo-alistairp Nov 14, 2025
03c600a
#1312: add conditional to differentiate between code gen and stub gen
mo-alistairp Nov 14, 2025
b8c358f
#1312: Add partial stub generation code
mo-alistairp Nov 14, 2025
2216993
#1312: lint fix
mo-alistairp Nov 14, 2025
0d6874b
#1312: lint fix
mo-alistairp Nov 14, 2025
06fbf55
#1312: reinstate standard scalar behaviour in ArgOrdering
mo-alistairp Nov 17, 2025
aa7e39b
#1312: Fix the dimensions pf the ScalarArray stub gen
mo-alistairp Nov 21, 2025
0dcd904
#1312: add correct stub gen test
mo-alistairp Nov 21, 2025
13bcee0
#1312: Fix the stub gen to have the correct number of ScalarArray inputs
mo-alistairp Nov 21, 2025
0cc2463
#1312: lint fix
mo-alistairp Nov 21, 2025
531e181
#1312: Fix test in test to pass lint
mo-alistairp Nov 21, 2025
40aaf0e
#1312: remove code in KernCallArgList to fix the call in code generation
mo-alistairp Nov 24, 2025
18be0df
#1312: fix lint
mo-alistairp Nov 25, 2025
388d45e
#1312: remove print statement from stub_gen test
mo-alistairp Nov 25, 2025
f8d1a8a
#1312: lint fix
mo-alistairp Nov 25, 2025
502b618
#1312: tidy LFRicScalarArrayArgs
mo-alistairp Nov 25, 2025
da0a8d1
#1312: fix indentation in stub gen test
mo-alistairp Nov 25, 2025
013463c
#1312: Add error message to KernStubArgList because it no longer has …
mo-alistairp Nov 25, 2025
8249ade
#1312: Add stub declaration data type exception
mo-alistairp Nov 25, 2025
4d503fa
#1312: lint fix
mo-alistairp Nov 25, 2025
42ff5b7
#1312: Add test for ScalarArray intrinsic type
mo-alistairp Nov 26, 2025
662ac2e
#1312: remove print statements
mo-alistairp Nov 26, 2025
bfc3e47
#1312: Remove the KernCallAccArgList empty if statement to appease Co…
mo-alistairp Nov 26, 2025
463fcff
#1312: Test whether an exception is raised when a ScalarArray is call…
mo-alistairp Nov 26, 2025
9828122
#1312: remove todo
mo-alistairp Nov 26, 2025
05b2725
#1312: Tidy LFRicScalarArrayArgs
mo-alistairp Nov 26, 2025
abbed54
#1312: Add consideration for ScalarArrays in lfric.py
mo-alistairp Nov 26, 2025
ec15259
#1312: tidy scalar_array_invoke.f90
mo-alistairp Nov 26, 2025
f78a894
#1312: improve the multikernel_invokes_scalar_array_invalid description
mo-alistairp Nov 26, 2025
dc1bce9
#1312: Add authorship to relevant files
mo-alistairp Nov 26, 2025
5133a3c
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Nov 28, 2025
7338d2a
Merge branch 'master' into 1312_scalararray_code_gen
arporter Dec 1, 2025
6b265e2
#1312: Add NotImplementedError to KernCallACCArgList
mo-alistairp Dec 2, 2025
0d1b97a
#1312: Revert requested files
mo-alistairp Dec 2, 2025
01f507c
#1312: Create test to check for NotImplementedError for ScalarArrays …
mo-alistairp Dec 2, 2025
afaebb6
#1312: miscellaneous style changes
mo-alistairp Dec 2, 2025
cd61f83
#1312: lint fix
mo-alistairp Dec 2, 2025
eca5ad1
#1312: lint fix
mo-alistairp Dec 2, 2025
0566cce
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Dec 2, 2025
6269aab
#1312: revert typehints temporarily to try identify error
mo-alistairp Dec 3, 2025
5e48f74
#1312: lint fix
mo-alistairp Dec 3, 2025
53111a9
#1312: change imports to try find culprit
mo-alistairp Dec 3, 2025
279f882
This reverts commit 0d1b97ab94e8de67a46d57e883b5e03a1a2c8257.
mo-alistairp Dec 3, 2025
b4d2647
#1312: revert KernCallArgList and LFRicScalarArgs to original state
mo-alistairp Dec 3, 2025
7be0fa6
#1312: potentially fix LFRicScalarArrayArgs doc build error
mo-alistairp Dec 3, 2025
72b3026
#1312: add typehint to KernStubArgList
mo-alistairp Dec 4, 2025
699aeac
#1312: remove typehint from KernStubArgList
mo-alistairp Dec 4, 2025
d10b34f
#1312: potential fix for import build failure
mo-alistairp Dec 4, 2025
cee1d48
#1312: continuing the potential fix
mo-alistairp Dec 4, 2025
cc61781
#1312: continue trying to fix circular import
mo-alistairp Dec 5, 2025
c58d7cf
#1312: continue trying to fix circular import
mo-alistairp Dec 5, 2025
c2f572a
#1312: lint fix
mo-alistairp Dec 5, 2025
8bdf4d1
#1312: continue trying to fix circular import
mo-alistairp Dec 5, 2025
efca80b
#1312: continue trying to fix circular import
mo-alistairp Dec 5, 2025
553a610
#1312: continue trying to fix circular import
mo-alistairp Dec 5, 2025
8cd4dbb
#1312: revert the splitting of imports
mo-alistairp Dec 5, 2025
03ea2f8
#1312: Fix the typehinting in KernStubArgList
mo-alistairp Dec 5, 2025
d546841
#1312: test inverting the if statement
mo-alistairp Dec 5, 2025
8b46182
#1312: change typehinting in KernStubArgList to be a comment
mo-alistairp Dec 5, 2025
a1e5111
#1312: hopefully fix the typehinting
mo-alistairp Dec 5, 2025
5ccffee
#1312: correct the import
mo-alistairp Dec 5, 2025
bd82d29
#1312: Cut down LFRicScalarArrayArgs to do multiple types at once
mo-alistairp Dec 9, 2025
3b167fc
#1312: Use intrinsic_type rather than intent in LFRicScalarArrayArgs …
mo-alistairp Dec 9, 2025
889fefa
#1312: Condense argument dictionaries into one where possible
mo-alistairp Dec 9, 2025
58ba124
#1312: Improve comments to distinguish between scal and decl_scal
mo-alistairp Dec 9, 2025
e9c7b77
#1312: Include the dimensions array in the kernel call list
mo-alistairp Dec 10, 2025
3febeb7
#1312: remove old todo
mo-alistairp Dec 11, 2025
6af9a55
#1312: Change the _array_ndims to be >=1
mo-alistairp Dec 11, 2025
a7f3e98
#1312: Add comment to _array_ndims
mo-alistairp Dec 11, 2025
9c8499d
#1312: change the test codegen to use get_invoke
mo-alistairp Dec 18, 2025
49d89e5
#1312: add field related parameters to the testkern
mo-alistairp Dec 18, 2025
5d92498
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Dec 18, 2025
2741a4b
#1312: Swap the order of dims_array and ScalarArray declarations
mo-alistairp Jan 15, 2026
444d99a
#1312: Update ScalarArray tests to match declaration order
mo-alistairp Jan 15, 2026
b2d4553
#1312: Add GH_SCALAR_ARRAY as an LFRic argument
mo-alistairp Jan 16, 2026
adcdb37
#1312: lint fix
mo-alistairp Jan 16, 2026
d2a7ef9
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Jan 16, 2026
f187466
Merge branch 'master' into 1312_scalararray_code_gen
arporter Jan 19, 2026
dd53db7
#1312: remove TODO and add raise to dcumentation
mo-alistairp Jan 20, 2026
d5315ae
#1312: Add dist_mem and condense generated code
mo-alistairp Jan 20, 2026
9fd41fb
#1312: refactor stub_declarations and tidy code
mo-alistairp Jan 20, 2026
172466d
#1312: fix metadata test to match change in lfric_scalar_array_args
mo-alistairp Jan 21, 2026
c4a4cde
#1312: remove unnecessary variables for lint fix
mo-alistairp Jan 21, 2026
1abb0fd
#1312: Lookup dims_array with tag
mo-alistairp Jan 21, 2026
a3d7efd
#1312: lint fix
mo-alistairp Jan 22, 2026
584c76b
#1312: Change to lookup by tag for added safety
mo-alistairp Jan 22, 2026
5cfe7a6
#1312: Increase complexity of test algorithm and match subsequent tes…
mo-alistairp Jan 22, 2026
ca641f9
Merge branch 'master' into 1312_scalararray_code_gen
mo-alistairp Jan 22, 2026
830f80a
#1312: add description of node argument back in
mo-alistairp Jan 22, 2026
48f63df
#1312: Fix the mdata test to account for multiple kernels in invoke
mo-alistairp Jan 22, 2026
3384868
Merge branch 'master' into 1312_scalararray_code_gen
arporter Jan 23, 2026
ba29572
#1312: remove unnecessary >=1 check on ndims
mo-alistairp Jan 23, 2026
e12861a
#1312: fix typo
mo-alistairp Jan 23, 2026
6228c3e
#1312: split assert expected_calls into two
mo-alistairp Jan 23, 2026
d8271f8
#1312: Add another assert to increase code coverage
mo-alistairp Jan 23, 2026
bca6096
#3101 update to new lfric_apps hash
arporter Jan 23, 2026
fcf9478
#1312: Tidy arg_ordering_test
mo-alistairp Jan 26, 2026
5eb5fde
Change LFRIC_APPS_HASH in workflow configuration
arporter Jan 26, 2026
9422096
#1312 update changelog
arporter Jan 26, 2026
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
2 changes: 1 addition & 1 deletion src/psyclone/domain/lfric/kern_call_acc_arg_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def scalar(self, scalar_arg, var_accesses=None):
:py:class:`psyclone.core.VariablesAccessMap`]

:raises NotImplementedError: OpenACC data regions are not currently
supported for arrays os scalars.
supported for arrays of scalars.

'''
if scalar_arg.is_scalar_array:
Expand Down
110 changes: 54 additions & 56 deletions src/psyclone/domain/lfric/lfric_scalar_array_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,32 +169,31 @@ def stub_declarations(self):
# Create declarations
for intent in FORTRAN_INTENT_NAMES:
for arg in self._scalar_array_args[intent]:
if arg._array_ndims >= 1:
# Create the dimensions array symbol
dims_array_symbol = self.symtab.find_or_create_tag(
tag="dims_" + arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
LFRicTypes("LFRicIntegerScalarDataType")(),
[arg._array_ndims]))
dims_array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(dims_array_symbol)
# Create list of dims_array references
sym_list = [ArrayReference.create(
dims_array_symbol,
[Literal(str(idx), INTEGER_TYPE)])
for idx in range(1, arg._array_ndims + 1)]
# Create the symbol
array_symbol = self.symtab.find_or_create_tag(
tag=arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
type_map[arg.intrinsic_type],
sym_list))
array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(array_symbol)
# Create the dimensions array symbol
dims_array_symbol = self.symtab.find_or_create_tag(
tag="dims_" + arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
LFRicTypes("LFRicIntegerScalarDataType")(),
[arg._array_ndims]))
dims_array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(dims_array_symbol)
# Create list of dims_array references
sym_list = [ArrayReference.create(
dims_array_symbol,
[Literal(str(idx), INTEGER_TYPE)])
for idx in range(1, arg._array_ndims + 1)]
# Create the symbol
array_symbol = self.symtab.find_or_create_tag(
tag=arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
type_map[arg.intrinsic_type],
sym_list))
array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(array_symbol)

def _create_declarations(self):
'''
Expand All @@ -208,36 +207,35 @@ def _create_declarations(self):
# ScalarArray arguments
for intent in FORTRAN_INTENT_NAMES:
for arg in self._scalar_array_args[intent]:
if arg._array_ndims >= 1:
# Create the dimensions array symbol
dims_array_symbol = self.symtab.find_or_create_tag(
tag="dims_" + arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
LFRicTypes("LFRicIntegerScalarDataType")(),
[arg._array_ndims]))
dims_array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(dims_array_symbol)
# Create list of dims_array references
sym_list = [ArrayReference.create(
dims_array_symbol,
[Literal(str(idx), INTEGER_TYPE)])
for idx in range(1, arg._array_ndims + 1)]
# Find the ScalarArray tag and convert it to an ArrayType
array_symbol = self.symtab.lookup_with_tag(
"AlgArgs_" + arg.name)
array_symbol.datatype = ArrayType(
type_map[arg.intrinsic_type],
sym_list)
# Replace the symbol with itself to ensure
# the ScalarArray is generated after the
# dimensions array to avoid compilation errors
# TODO: #2202 may allow this to be removed
self.symtab.swap(array_symbol, array_symbol)
array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(array_symbol)
# Create the dimensions array symbol
dims_array_symbol = self.symtab.find_or_create_tag(
tag="dims_" + arg.name,
symbol_type=DataSymbol,
datatype=ArrayType(
LFRicTypes("LFRicIntegerScalarDataType")(),
[arg._array_ndims]))
dims_array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(dims_array_symbol)
# Create list of dims_array references
sym_list = [ArrayReference.create(
dims_array_symbol,
[Literal(str(idx), INTEGER_TYPE)])
for idx in range(1, arg._array_ndims + 1)]
# Find the ScalarArray tag and convert it to an ArrayType
array_symbol = self.symtab.lookup_with_tag(
"AlgArgs_" + arg.name)
array_symbol.datatype = ArrayType(
type_map[arg.intrinsic_type],
sym_list)
# Replace the symbol with itself to ensure
# the ScalarArray is generated after the
# dimensions array to avoid compilation errors
# TODO: #2202 may allow this to be removed
self.symtab.swap(array_symbol, array_symbol)
array_symbol.interface = ArgumentInterface(
INTENT_MAPPING[intent])
self.symtab.append_argument(array_symbol)


# ---------- Documentation utils -------------------------------------------- #
Expand Down
8 changes: 8 additions & 0 deletions src/psyclone/tests/domain/lfric/arg_ordering_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ def test_kernel_stub_invalid_scalar_argument():
assert (f"Expected argument type to be one of "
Comment thread
arporter marked this conversation as resolved.
f"{const.VALID_SCALAR_NAMES + const.VALID_ARRAY_NAMES} "
f"but got 'invalid'" in str(excinfo.value))
# Now call KernCallArgList to raise an exception
create_arg_list = KernCallArgList(kernel)
with pytest.raises(InternalError) as excinfo:
create_arg_list.scalar(arg)
const = LFRicConstants()
Comment thread
arporter marked this conversation as resolved.
Outdated
assert (f"Expected argument type to be one of "
f"{const.VALID_SCALAR_NAMES + const.VALID_ARRAY_NAMES} "
f"but got 'invalid'" in str(excinfo.value))


def test_arg_ordering_generate_domain_kernel(dist_mem, fortran_writer):
Expand Down
3 changes: 2 additions & 1 deletion src/psyclone/tests/domain/lfric/lfric_scalar_codegen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,5 +659,6 @@ def test_scalar_array(tmpdir, dist_mem):
)
assert expected_subroutine in generated_code
assert expected_declarations in generated_code
assert expected_calls[0], expected_calls[1] in generated_code
assert expected_calls[0] in generated_code
assert expected_calls[1] in generated_code
assert LFRicBuild(tmpdir).code_compiles(psy)
Loading