Numba, an open-source JIT compiler, accelerates Python code by translating subsets, particularly numerical functions, into optimized machine code using LLVM
- Heavy Numerical Computations
- Performance Boost
- Ease of Use
- CPU and GPU programming.
Numba: A High Performance Python Compiler
@njit( parallel=True) def simulator(out): # iterate loop in parallel for i in prange(out.shape[0]): out[i] = run_sim() Numba can automatically execute NumPy array expressions on multiple CPU cores and makes it easy to write parallel loops. LBB0_8: vmovups (%rax,%rdx,4), %ymm0 vmovups (%rcx,%rdx,4), %ymm1 vsubps %ymm1, %ymm0, %ymm2 vaddps %ymm2, %ymm2, %ymm2 Numba can automatically translate some loops into vector instructions for 2-4x speed improvements.
https://numba.pydata.org/

numba - 성능 업!
파이썬을 사용하는 목적에 성능은 포함되어 있지 않다고 엄청 강조한다. 그렇지만 가끔은 성능이 좋아졌으면 하고 바랄 때가 있다. 결과를 보기 위해 몇 시간을 구동해야 한다면 말이다. "High Performance Python(고성능 파이썬)"을 읽다 보니 책 제목답게 성능과 관련한 내용이 많았다. 당연히 나에게는 중요하지 않았다. 그런데, 파이썬 코드를 컴파일하는 챕터에서 거저 먹을 수 있는 몇 가지 방법을 알려주고 있었다.
https://pythonkim.tistory.com/95
numba를 이용한 Single-CPU, Multi-CPU, GPU-CUDA 의 box blur 속도 비교
얼마전 성능 및 코드 간결성 비교 numba.vectorize vs numba.jit 에서 O(n) 복잡도의 연산에 대한 Single-CPU 와 Multi-CPU 의 수행 속도를 비교하여 보았다. 수행에 소요되는 시간은 예상대로 입력 데이터의 개수 대해 선형적으로 증가하였다. 이번에는 O(n*r^2) 의 복잡도를 갖는 간단한 동일가중치 box blur 알고리즘에 대한 수행 속도를 비교해 보려고한다.(계산 복잡도는 box 크기 r 의 제곱에 비례한다.)
https://jrr.kr/487


Seonglae Cho