[Note] Python calculation acceleration (maybe) module "Numba" related summary

I want to run a Python program at high speed!

** "If you can calculate 10 times faster, you can make 10 times more mistakes" ** If you think so, everyone should think that it would be nice to be able to perform fast calculations.

The title is Numba, which is a module that can speed up calculations on Python using a JIT (just-in-time) compiler. This article is a memorandum of past excellent articles about Numba. Below is a brief description of Numba.

In Python, the for statement is a cause of delay and can be speeded up by inclusion notation. However, there may be situations where you must ** use the for statement (especially multiple times) **. Numba is a ** maybe ** tool that can speed up for statements with just two statements, ʻimport numbaand@ numba.jit`.

Here is a list of functions supported by Numba. Numpy Support in numba

If you look closely, you can see the four arithmetic operations such as ʻadd subtract and simple functions such as ʻexp`` log10 sqrt. Trigonometric functions such as sin`` cos tan are supported.

However, the current situation is that many calculations such as fft cannot be handled (or is it impossible in principle?). (* It doesn't mean that you can't calculate just because it doesn't get faster) Numba cannot calculate comprehensions and empty lists that can be calculated quickly. In that area, it seems that the defined function will be finely divided and used where numba can be used.

So ・ Perform simple calculations many times ・ Turn multiple for statements In such a case, it may be speeded up? That is Numba.

It can be said that it is necessary to deal well with the for statement in order to take advantage of Numpy, which can be calculated at high speed.

** Below is a summary of articles dealing with content related to Numba. ** **

Write a program one million times faster http://qiita.com/Akai_Banana/items/48a35d2a40d1804d3b32

Python: Acceleration with Numba http://dr-kayai.hatenablog.com/entry/2014/10/09/175456

I thought it would be slow to use a for statement in NumPy, but that wasn't the case. http://qiita.com/termoshtt/items/d6cf43e777946b3c1d93

A note on speeding up Python code with Numba http://qiita.com/toyolab/items/b5d95bd38b3c7c66b510

How to dramatically speed up Python code with the JIT compiler library Numba http://myenigma.hatenablog.com/entry/2017/03/02/155433

What I did when I wanted to make python faster -Numba edition- http://qiita.com/open_cans/items/b6cde6c28f8eacba0ca1

How to make Python faster for beginners [numpy] http://qiita.com/yukkyo1222/items/df4487bbc2767c630247

I installed and used Numba with Python3.5 http://qiita.com/fujibo/items/9a776e671170137d7ade

Accelerate Python code (first Numba) http://fjkei.hatenadiary.jp/entry/2015/06/21/121251o

Accelerate reaction-diffusion simulation with Python with JIT https://qiita.com/kaityo256/items/3c07252ab63591256835


Recommended Posts

[Note] Python calculation acceleration (maybe) module "Numba" related summary
python related summary
Python iteration related summary
"Python Machine Learning Programming" Summary Note (Jupyter)
Python Summary
Python summary
Note: Python
Python note
I / O related summary of python and fortran