transonic.justintime

Cached JIT compilation

User API

transonic.justintime.jit(func=None, backend: str | None = None, native=False, xsimd=False, openmp=False)[source]

Decorator to record that the function has to be jit compiled

transonic.justintime.set_compile_jit(value)[source]

Internal API

class transonic.justintime.ModuleJIT(backend_name: str, frame=None)[source]

Bases: object

Representation of a module using jit

transonic.justintime._get_module_jit(backend_name: str | None = None, depth_frame: int = 2, frame=None)[source]

Get the ModuleJIT instance corresponding to the calling module

Parameters:
depth_frameint

Depth of the frame to be selected

class transonic.justintime.JIT(frame, backend: str, native=False, xsimd=False, openmp=False)[source]

Bases: object

Decorator used internally by the public jit decorator

Notes

Serge talked about @jit (see https://gist.github.com/serge-sans-paille/28c86d2b33cd561ba5e50081716b2cf4)

It’s indeed a good idea!

  • At import time, we create one .py file per jit function.

  • At run time, we create (and complete when needed) a corresponding .pythran file with signature(s).

    The jit decorator:

    • at the first call, get the types, create the .pythran file and call Pythran.

    • then, try to call the pythran function and if it fails with a Pythran TypeError, correct the .pythran file and recompile.

Note: During the compilation (the “warmup” of the JIT), the Python function is used.

Functions

jit([func, backend, native, xsimd, openmp])

Decorator to record that the function has to be jit compiled

set_compile_jit(value)

Classes

JIT(frame, backend[, native, xsimd, openmp])

Decorator used internally by the public jit decorator

ModuleJIT(backend_name[, frame])

Representation of a module using jit