dolfinx.jit
Just-in-time (JIT) compilation using FFCx
Functions
|
Compile UFL object with FFCx and CFFI. |
|
Return a copy of the merged JIT option values for DOLFINx. |
|
A decorator for jit compilation. |
- dolfinx.jit.ffcx_jit(ufl_object, form_compiler_options: dict | None = None, jit_options: dict | None = None)[source]
Compile UFL object with FFCx and CFFI.
- Parameters:
ufl_object – Object to compile, e.g.
ufl.Form
.form_compiler_options – Options used in FFCx compilation of this form. Execute
print(ffcx.options.FFCX_DEFAULT_OPTIONS)
to see all available options. Takes priority over all other option values.jit_options – Options used in CFFI JIT compilation of C code generated by FFCx. Execute
print(dolfinx.jit.DOLFINX_DEFAULT_JIT_OPTIONS)
to see all available options. Takes priority over all other option values.
- Returns:
A tuple containing the compiled object, module and a tuple containing the header and implementation code.
Priority ordering of options controlling DOLFINx JIT compilation from highest to lowest is:
jit_options
(API, recommended),$PWD/dolfinx_jit_options.json
(local options),$XDG_CONFIG_HOME/dolfinx/dolfinx_jit_options.json
(user options),default
DOLFINX_DEFAULT_JIT_OPTIONS
dictionary indolfinx.jit
.
Priority ordering of options controlling FFCx from highest to lowest is:
form_compiler_options
(API, recommended),$PWD/ffcx_options.json
(local options),$XDG_CONFIG_HOME/ffcx/ffcx_options.json
(user options),FFCX_DEFAULT_OPTIONS
inffcx.options
.
$XDG_CONFIG_HOME
is~/.config/
if the environment variable is not set.The contents of the
dolfinx_options.json
files are cached on the first call. Subsequent calls to this function use this cache.For example,
dolfinx_jit_options.json
could contain:Example:
{ "cffi_extra_compile_args": ["-O2", "-march=native" ], "cffi_verbose": True }
- dolfinx.jit.get_options(priority_options: dict | None = None) dict [source]
Return a copy of the merged JIT option values for DOLFINx.
- Parameters:
priority_options – Take priority over all other option values (see notes).
- Returns:
Merged option values.
- Return type:
dict
Note
See
ffcx_jit()
for user facing documentation.
- dolfinx.jit.mpi_jit_decorator(local_jit, *args, **kwargs)[source]
A decorator for jit compilation.
Use this function as a decorator to any jit compiler function. In a parallel run, this function will first call the jit compilation function on the first process. When this is done, and the module is in the cache, it will call the jit compiler on the remaining processes, which will then use the cached module.