JIT Compilation#

Base Infrastructure#

KernelWrapper

Wrapper around a compiled and executable pystencils kernel.

JitBase

Base class for just-in-time compilation interfaces implemented in pystencils.

NoJit

Not a JIT compiler: Used to explicitly disable JIT compilation on an AST.

pystencils.jit.no_jit = <pystencils.jit.jit.NoJit object>#

Disables just-in-time compilation for a kernel.

CPU Just-In-Time Compiler#

The CPU JIT compiler

  • embeds a kernel’s code into a prepared C++ frame, which includes routines that map NumPy arrays and Python scalars to kernel arguments, and perform shape and type checks on these arguments;

  • invokes a host C++ compiler to compile and link the generated code as a Python extension module;

  • dynamically loads that module and exposes the compiled kernel to the user.

CpuJit

Just-in-time compiler for CPU kernels.

Compiler Infos#

The properties of the host compiler are defined in a CompilerInfo object. To select a custom host compiler and customize its options, set up and pass a custom compiler info object to CpuJit.

CompilerInfo

Base class for compiler infos.

GccInfo

Compiler info for the GNU Compiler Collection C++ compiler (g++).

ClangInfo

Compiler info for the LLVM C++ compiler (clang).

AppleClangInfo

Compiler info for the Apple Clang compiler.

Implementation Details#

CuPy-based GPU JIT#