Skip to content

Commit

Permalink
Merge pull request #469 from ecmwf-ifs/naml-remove-ofp
Browse files Browse the repository at this point in the history
Frontend: Final removal of OFP frontend
  • Loading branch information
reuterbal authored Jan 10, 2025
2 parents 4ed8534 + 730399b commit 7668989
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 2,324 deletions.
5 changes: 0 additions & 5 deletions loki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
config.register('frontend-strict-mode', False, env_variable='LOKI_FRONTEND_STRICT_MODE',
preprocess=lambda i: bool(i) if isinstance(i, int) else i)

# Disk-caching, which causes OFP ASTs to be cached on disk for
# fast re-parsing of unchanged source files
config.register('disk-cache', False, env_variable='LOKI_DISK_CACHE',
preprocess=lambda i: bool(i) if isinstance(i, int) else i)

# Force symbol comparison and object equality to be case sensitive
config.register('case-sensitive', False, env_variable='LOKI_CASE_SENSITIVE',
preprocess=lambda i: bool(i) if isinstance(i, int) else i)
Expand Down
4 changes: 2 additions & 2 deletions loki/batch/tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
ProcedureBindingItem, ExternalItem, InterfaceItem, SGraph,
SchedulerConfig, ItemFactory
)
from loki.frontend import HAVE_FP, HAVE_OFP, REGEX, RegexParserClass
from loki.frontend import HAVE_FP, REGEX, RegexParserClass
from loki.ir import nodes as ir


pytestmark = pytest.mark.skipif(not HAVE_FP and not HAVE_OFP, reason='Fparser and OFP not available')
pytestmark = pytest.mark.skipif(not HAVE_FP, reason='Fparser not available')


@pytest.fixture(scope='module', name='here')
Expand Down
39 changes: 1 addition & 38 deletions loki/expression/tests/test_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from loki.build import jit_compile, clean_test
from loki.expression import symbols as sym, parse_expr, AttachScopesMapper
from loki.frontend import (
available_frontends, OMNI, FP, HAVE_FP, parse_fparser_expression
available_frontends, OMNI, HAVE_FP, parse_fparser_expression
)
from loki.ir import (
nodes as ir, FindNodes, FindVariables, FindExpressions,
Expand Down Expand Up @@ -924,43 +924,6 @@ def test_masked_statements_nested(tmp_path, frontend):
clean_test(filepath)


@pytest.mark.parametrize('frontend', available_frontends(xfail=[
(OMNI, 'Not implemented'), (FP, 'Not implemented')
]))
def test_data_declaration(tmp_path, frontend):
"""
Variable initialization with DATA statements
"""
fcode = """
subroutine data_declaration(data_out)
implicit none
integer, dimension(5, 4), intent(out) :: data_out
integer, dimension(5, 4) :: data1, data2
integer, dimension(3) :: data3
integer :: i, j
data data1 /20*5/
data ((data2(i,j), i=1,5), j=1,4) /20*3/
data data3(1), data3(3), data3(2) /1, 2, 3/
data_out(:,:) = data1(:,:) + data2(:,:)
data_out(1:3,1) = data3
end subroutine data_declaration
"""
filepath = tmp_path/(f'expression_data_declaration_{frontend}.f90')
routine = Subroutine.from_source(fcode, frontend=frontend)
function = jit_compile(routine, filepath=filepath, objname='data_declaration')

expected = np.ones(shape=(5, 4), dtype=np.int32, order='F') * 8
expected[[0, 1, 2], 0] = [1, 3, 2]
result = np.zeros(shape=(5, 4), dtype=np.int32, order='F')
function(result)
assert np.all(result == expected)
clean_test(filepath)


@pytest.mark.parametrize('frontend', available_frontends())
def test_pointer_nullify(tmp_path, frontend):
"""
Expand Down
1 change: 0 additions & 1 deletion loki/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from loki.frontend.preprocessing import * # noqa
from loki.frontend.source import * # noqa
from loki.frontend.ofp import * # noqa
from loki.frontend.omni import * # noqa
from loki.frontend.fparser import * # noqa
from loki.frontend.util import * # noqa
Expand Down
Loading

0 comments on commit 7668989

Please sign in to comment.