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

Transpile: Split C-kernel generation from ISO-C wrapper generation #464

Merged
merged 14 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions loki/transformations/tests/test_array_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
LowerConstantArrayIndices, remove_explicit_array_dimensions,
add_explicit_array_dimensions
)
from loki.transformations.transpile import FortranCTransformation
from loki.transformations.transpile import (
FortranCTransformation, FortranISOCWrapperTransformation
)


@pytest.fixture(scope='function', name='builder')
Expand Down Expand Up @@ -546,8 +548,13 @@ def validate_routine(routine):
f2c_routine = Subroutine.from_source(fcode, frontend=frontend)
f2c = FortranCTransformation()
f2c.apply(source=f2c_routine, path=tmp_path)
f2cwrap = FortranISOCWrapperTransformation()
f2cwrap.apply(source=f2c_routine, path=tmp_path)
libname = f'fc_{f2c_routine.name}_{start_index}_{frontend}'
c_kernel = jit_compile_lib([f2c.wrapperpath, f2c.c_path], path=tmp_path, name=libname, builder=builder)
c_kernel = jit_compile_lib(
[tmp_path/f'{f2c_routine.name}_fc.F90', tmp_path/f'{f2c_routine.name}_c.c'],
path=tmp_path, name=libname, builder=builder
)
fc_function = c_kernel.transf_flatten_arr_fc_mod.transf_flatten_arr_fc
f2c_x1, f2c_x2, f2c_x3, f2c_x4 = init_arguments(l1, l2, l3, l4, flattened=True)
fc_function(f2c_x1, f2c_x2, f2c_x3, f2c_x4, l1, l2, l3, l4)
Expand Down
1 change: 1 addition & 0 deletions loki/transformations/transpile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
# nor does it submit to any jurisdiction.

from loki.transformations.transpile.fortran_c import * # noqa
from loki.transformations.transpile.fortran_iso_c_wrapper import * # noqa
from loki.transformations.transpile.fortran_python import * # noqa
389 changes: 24 additions & 365 deletions loki/transformations/transpile/fortran_c.py

Large diffs are not rendered by default.

Loading
Loading