Numba gives you the power to speed up your applications with high performance functions written directly in Python. With a few annotations, array-oriented and math-heavy Python code can be just-in-time compiled to native machine instructions, similar in performance to C, C++ and Fortran, without having to switch languages or Python interpreters.
Numba works by generating optimized machine code using the LLVM compiler infrastructure at import time, runtime, or statically (using the included pycc tool). Numba supports compilation of Python to run on either CPU or GPU hardware, and is designed to integrate with the Python scientific software stack.
from numba import jit from numpy import arange # jit decorator tells Numba to compile this function. # The argument types will be inferred by Numba when function is called. @jit def sum2d(arr): M, N = arr.shape result = 0.0 for i in range(M): for j in range(N): result += arr[i,j] return result a = arange(9).reshape(3,3) print(sum2d(a))
More examples: examples.
Source and Downloads¶
- Github: https://github.com/numba/numba
$ git clone git://github.com/numba/numba.git
For tarballs see:
The easiest way to install numba and get updates is by using the Anaconda Distribution: http://continuum.io/downloads.html
If you have Anaconda installed already:
$ conda install numba
$ conda update numba
For custom python environments see the README on Github.
Join the numba mailing list firstname.lastname@example.org :
Some old archives are at:
See if our sponsor can help you (which can help this project):