Python is one of the most popular programming languages today for science, engineering, data analytics and deep learning applications. However, as an interpreted language, it has been considered too slow for high-performance computing.

Numba, a Python compiler from Anaconda that can compile Python code for execution on CUDA-capable GPUs, provides Python developers with an easy entry into GPU-accelerated computing and a path for using increasingly sophisticated CUDA code with a minimum of new syntax and jargon. With CUDA Python and Numba, you get the best of both worlds: rapid iterative development with Python combined with the speed of a compiled language targeting both CPUs and NVIDIA GPUs.

SETUP CUDA PYTHON

To run CUDA Python, you will need the CUDA Toolkit installed on a system with CUDA capable GPUs. Use this guide for easy steps to install CUDA. If you do not have a CUDA-capable GPU, you can access one of the thousands of GPUs available from cloud service providers including Amazon AWS, Microsoft Azure and IBM SoftLayer. The NVIDIA-maintained CUDA Amazon Machine Image (AMI) on AWS, for example, comes pre-installed with CUDA and is available for use today.

To get started with Numba, the first step is to download and install the Anaconda python distribution that includes many popular packages (Numpy, Scipy, Matplotlib, iPython, etc) and “conda”, a powerful package manager. Once you have Anaconda installed, install the required CUDA packages by typing conda install numba cudatoolkit pyculib.  

GET STARTED WITH CUDA PYTHON

The blog post Numba: High-Performance Python with CUDA Acceleration is a great resource to get you started. Also refer to the Numba tutorial for CUDA on the ContinuumIO github repository and the Numba posts on Anaconda’s blog.

If you are new to Python, explore the beginner section of the Python website for some excellent getting started resources. The blog, An Even Easier Introduction to CUDA, introduces key CUDA concepts through simple examples.

Check out Numbas github repository for additional examples to practice. You can also get the full Jupyter Notebook for the Mandelbrot example on Github.

ADDITIONAL RESOURCES

The developer blog posts, Seven things you might not know about Numba and GPU-Accelerated Graph Analytics in Python with Numba provide additional insights into GPU Computing with python.

NVIDIA also provides hands-on training through a collection of self-paced courses and instructor-led workshops. The courses guide you step-by-step through editing and execution of code and interaction with visualization tools, woven together into a simple immersive experience. Practice the techniques you learned in the materials above through hands-on content.

NVIDIA DLI

You can register for free access to NVIDIA TESLA GPUs in the cloud to deploy your python applications once they are ready.