GPU programming with NumbaPro
NumbaPro is a Python compiler that provides a CUDA-based API to write CUDA programs. It is designed for array-oriented computing tasks, much like the widely used NumPy library. The data parallelism in array-oriented computing tasks is a natural fit for accelerators such as GPUs. NumbaPro understands NumPy array types and uses them to generate efficient compiled code for execution on GPUs or multicore CPUs.
The compiler works by allowing you to specify type signatures for Python functions, which enable compilation at runtime (called the JIT compilation).
The most important decorators are:
numbapro.jit
: This allows a developer to write CUDA-like functions. When encountered, the compiler translates the code under the decorator into the pseudo assembly PTX language to be executed in the GPU.numbapro.autojit
: This annotates a function for a deferred compilation procedure. This means that each function with this signature is compiled exactly once.numbapro.vectorize...