dolfinx.jit

Just-in-time (JIT) compilation using FFCx.

Functions

ffcx_jit(ufl_object[, …])

Compile UFL object with FFCx and CFFI.

get_parameters([priority_parameters])

Return (a copy of) the merged JIT parameter values for DOLFINx.

mpi_jit_decorator(local_jit, *args, **kwargs)

A decorator for jit compilation.

dolfinx.jit.ffcx_jit(ufl_object, form_compiler_parameters={}, jit_parameters={})[source]

Compile UFL object with FFCx and CFFI.

Parameters
  • ufl_object – Object to compile, e.g. ufl.Form

  • form_compiler_parameters – Parameters used in FFCx compilation of this form. Run ffcx –help at the commandline to see all available options. Takes priority over all other parameter values, except for scalar_type which is determined by DOLFINx.

  • jit_parameters – Parameters used in CFFI JIT compilation of C code generated by FFCx. See python/dolfinx/jit.py for all available parameters. Takes priority over all other parameter values.

Notes

Priority ordering of parameters controlling DOLFINx JIT compilation from highest to lowest is:

  • jit_parameters (API)

  • $(pwd)/dolfinx_jit_parameters.json (local parameters)

  • ~/.config/dolfinx/dolfinx_jit_parameters.json (user parameters)

  • DOLFINX_DEFAULT_JIT_PARAMETERS in dolfinx.jit

Priority ordering of parameters controlling FFCx from highest to lowest is:

  • scalar_type of DOLFINx

  • form_compiler_parameters (API)

  • $(pwd)/ffcx_parameters.json (local parameters)

  • ~/.config/ffcx/ffcx_parameters.json (user parameters)

  • FFCX_DEFAULT_PARAMETERS in ffcx.parameters

The contents of the dolfinx_parameters.json files are cached on the first call. Subsequent calls to this function use this cache.

Example dolfinx_jit_parameters.json file:

{ “cffi_extra_compile_args”: [“-O2”, “-march=native” ], “cffi_verbose”: True }

dolfinx.jit.get_parameters(priority_parameters: Optional[dict] = None)dict[source]

Return (a copy of) the merged JIT parameter values for DOLFINx.

Parameters

priority_parameters – take priority over all other parameter values (see notes)

Returns

dict

Return type

merged parameter values

Notes

See ffcx_jit for user facing documentation.