Skip to content

Commit

Permalink
Merge pull request #478 from ecmwf-ifs/naml-fix-field-offload
Browse files Browse the repository at this point in the history
FieldOffload: Allow and skip non-enriched calls in offload region
  • Loading branch information
reuterbal authored Jan 18, 2025
2 parents 2c0e8bf + 93961de commit 7dbdf4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions loki/transformations/data_offload/field_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
nodes as ir, FindNodes, FindVariables, Transformer,
SubstituteExpressions, pragma_regions_attached, is_loki_pragma
)
from loki.logging import warning, error
from loki.logging import warning
from loki.types import BasicType

from loki.transformations.field_api import FieldPointerMap
Expand Down Expand Up @@ -126,9 +126,9 @@ def find_offload_variables(driver, region, field_group_types):
# Do some sanity checking and warning for enclosed calls
for call in FindNodes(ir.CallStatement).visit(region):
if call.routine is BasicType.DEFERRED:
error(f'[Loki] Data offload: Routine {driver.name} has not been enriched ' +
warning(f'[Loki] Data offload: Routine {driver.name} has not been enriched ' +
f'in {str(call.name).lower()}')
raise RuntimeError
continue
for param, arg in call.arg_iter():
if not isinstance(param, Array):
continue
Expand Down
5 changes: 2 additions & 3 deletions loki/transformations/data_offload/tests/test_field_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@ def test_field_offload_unknown_kernel(caplog, frontend, state_module, tmp_path):
offload_index='i',
field_group_types=['state_type'])
caplog.clear()
with caplog.at_level(log_levels['ERROR']):
with pytest.raises(RuntimeError):
driver.apply(field_offload_trafo, role='driver', targets=['another_kernel'])
with caplog.at_level(log_levels['WARNING']):
driver.apply(field_offload_trafo, role='driver', targets=['another_kernel'])
assert len(caplog.records) == 1
assert ('[Loki] Data offload: Routine driver_routine has not been enriched '+
'in another_kernel') in caplog.records[0].message
Expand Down

0 comments on commit 7dbdf4c

Please sign in to comment.