loki.transformations.transpile.fortran_c

Classes

DeReferenceTrafo(vars2dereference)

Transformation to apply/insert Dereference = * and Reference/address-of = & operators.

FortranCTransformation([inline_elementals, ...])

Fortran-to-C transformation that translates the given routine into C.

class FortranCTransformation(inline_elementals=True, language='c')

Bases: Transformation

Fortran-to-C transformation that translates the given routine into C.

Parameters:
  • inline_elementals (bool, optional) – Inline known elemental function via expression substitution. Default is True.

  • language (str) – C-style language to generate; should be one of ['c', 'cpp', 'cuda'].

file_suffix()
transform_subroutine(routine, **kwargs)

Defines the transformation to apply to Subroutine items.

For transformations that modify Subroutine objects, this method should be implemented. It gets called via the dispatch method apply().

Parameters:
  • routine (Subroutine) – The subroutine to be transformed.

  • **kwargs (optional) – Keyword arguments for the transformation.

convert_kwargs_to_args(routine, targets)
interface_to_import(routine, targets)

Convert interface to import.

static apply_de_reference(routine)

Utility method to apply/insert Dereference = * and Reference/address-of = & operators.

generate_c_kernel(routine, targets, **kwargs)

Re-generate the C kernel and insert wrapper-specific peculiarities, such as the explicit getter calls for imported module-level variables.

convert_call_names(routine, targets)
generate_c_kernel_launch(kernel_launch, kernel, **kwargs)