Just-In-Time Compilation of NumPy Vector Operations

Johannes Lund ., Mads R. B. Kristensen ., Simon A. F. Lund ., Brian Vinter .

Abstract


In this paper, we introduce JIT compilation for the
high-productivity framework Python/NumPy in order to boost the
performance significantly. The JIT compilation of Python/NumPy
is completely transparent to the user – the runtime system will
automatically JIT compile and execute the NumPy instructions
encountered in a Python application. In other words, we introduce
a framework that provides the high-productivity from Python
while maintaining the high-performance of a low-level, compiled
language.
We transforms NumPy vector instruction into an Abstract
Syntax Tree representation that creates the basis for further
optimizations. From the AST we auto-generate C code which
we compile into computational kernels and execute. These incorporate
temporary array removal and loop-fusion which are main
benefactors in the achieved speedups. In order to amortize the
overhead of creation, we also implement a cache for the compiled
kernels.
We evaluate the JIT compilation by executing several scientific
computing benchmarks on an AMD. Compared to NumPy, we
achieve speedups of a factor 4.72 for a N-Body application and
7.51 for a Jacobi Stencil application executing on a single CPU
core.


Full Text:

PDF

Refbacks

  • There are currently no refbacks.