Skip to content

Proposal: Header only mode #754

@schnellerhase

Description

@schnellerhase

Currently, ffcx generates both a header file (.h) and a translation unit file (.c) for a UFL input file. The proposal would be to support a header only mode, which would result in only one header file (.h) containing the definitions. This could be enabled by a flag passed to ffcx', such as --header-only.

This has several advantages

  1. Allows compile-time inlining of the kernel in C/C++ programs (this is especially useful for low-complexity/low-order kernels).
  2. C/C++ based testing: to run a test case that depends on a UFL form, it is currently necessary to 1) call ffcx, 2) compile out.c, 3) include out.h and 4) link each test that depends on it against out.c. Especially the linking part requires manual configuration and dependency maintenance. In a headers-only mode, steps 2) and 4) do not exist and the configuration can be done once (i.e. call ffcx on all forms to generate headers before compiling test cases, which then include the headers they depend on).
  3. The development process of ffcx becomes easier since only one file needs to be monitored and tracked to see effective changes.
  4. Opens the door to experimenting with other compile-time tricks in kernels in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions