Skip to content

Commit

Permalink
Tools: Removing unused generate_identity utility
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Apr 15, 2024
1 parent b5f3343 commit 739c8c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
30 changes: 1 addition & 29 deletions loki/build/jit.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from loki.tools import as_tuple, gettempdir, filehash


__all__ = ['jit_compile', 'jit_compile_lib', 'generate_identity' ,'clean_test']
__all__ = ['jit_compile', 'jit_compile_lib', 'clean_test']


_f90wrap_kind_map = Path(__file__).parent.parent/'tests/kind_map'
Expand Down Expand Up @@ -105,34 +105,6 @@ def jit_compile_lib(sources, path, name, wrap=None, builder=None):
return lib.wrap(modname=name, sources=wrap, builder=builder, kind_map=_f90wrap_kind_map)


def generate_identity(refpath, routinename, modulename=None, frontend=OFP):
"""
Generate the "identity" of a single subroutine with a frontend-specific suffix.
"""
testname = refpath.parent/(f'{refpath.stem}_{routinename}_{frontend}.f90')
source = Sourcefile.from_file(refpath, frontend=frontend)

if modulename:
module = [m for m in source.modules if m.name == modulename][0]
module.name += f'_{routinename}_{frontend}'
for routine in source.all_subroutines:
routine.name += f'_{frontend}'
for call in FindNodes(CallStatement).visit(routine.body): # pylint: disable=no-member
call.name += f'_{frontend}'
source.write(path=testname, source=fgen(module))
else:
routine = [r for r in source.subroutines if r.name == routinename][0]
routine.name += f'_{frontend}'
source.write(path=testname, source=fgen(routine))

pymod = compile_and_load(testname, cwd=str(refpath.parent), use_f90wrap=True, f90wrap_kind_map=_f90wrap_kind_map)

if modulename:
# modname = '_'.join(s.capitalize() for s in refpath.stem.split('_'))
return getattr(pymod, testname.stem)
return pymod


def clean_test(filepath):
"""
Clean test directory based on JIT'ed source file.
Expand Down
2 changes: 1 addition & 1 deletion loki/tests/test_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_cmake_plan(srcdir, config, cmake_project, loki_install, ecbuild, silent
assert cmake_project.exists()

for loki_root in loki_install:
with clean_builddir('test_cmake_plan') as builddir:
with clean_builddir('test_cmake_plan') as builddir:
execute(
[f'{ecbuild}/bin/ecbuild', str(srcdir), f'-Dloki_ROOT={loki_root}'],
cwd=builddir, silent=silent
Expand Down

0 comments on commit 739c8c4

Please sign in to comment.