By Oliver Laslett, SSI Fellow and PhD Candidate at the University of Southampton.
Nearly 12,000 keen people visited the exhibition floor of Supercomputing 2015, among the flashing LEDs and towering racks of computers, it was easy to feel that you are experiencing computation at its physical limits; a world of highly optimised hardware and software built for maximum performance. Yet it was obvious that Python, the most popular language for teaching introductory programming, has become an integrated component of the HPC stack.
Python is known for its very expressive language, easy to read syntax, large community, and impressive range of extension modules. Whilst these advantages have not historically been enough to warrant a replacement of compiled languages, Python has regularly come to be used as a program glue due to its ability to interface so easily with external applications.
However for scientific research, where time is precious and software development must compete for resources against publishing and report writing, the choice between python and compiled languages for HPC applications is more complex. A day earned from software development may be worth the performance costs incurred at run time.
With an increase in the availability of Python tools for HPC comes a decrease in the performance barrier between Python and its complied foes. There are the more mature projects such as NumPy and SciPy, which offer performance without compilation, as well as recent attempts to bring parallel libraries and just-in-time compiling to Python. An interesting example of this is Numba, a python module that produces compiled code from python functions that (for the right problems) can lead to significant speed-ups. Numba is also able to compile code for both Nvidia and AMD GPUs, which presents an exciting new HPC approach consisting of rapid development times and fast execution on desktops.
Large companies, too, have shown their support for Python in HPC. Intel have recently released their own distribution of Python (free but not open-source) that is built on their popular Math Kernel Library and includes parallel implementations of common linear algebra operations, as well as providing support for Python in their VTune profiling software.
Evidently, there are many options for accelerating python code but this is no free lunch; the success of these strategies is problem dependent and often requires sacrificing program readability, portability or development time. Compiled languages may still be the only viable option for many applications but Python looks well positioned to shake up the world of high performance computing in the near future.
Teaching high performance programming
An immediate benefit of the availability of HPC tools for Python is their potential to transform teaching methods in parallel computing. Take a student learning GPU programming with CUDA, for example. The student grapples with the complexities of writing a kernel and navigating C++ syntax, all for the purposes of learning the basic concepts such as understanding memory hierarchies and management.
Python, which has proved itself as a great language for learning, presents a much less cluttered environment to learn these new concepts.Teaching parallel and GPU programming could be achieved with less clutter and time-wasting.
Python is being used in high performance applications from computational fluid dynamics to numerical optimisation with great success. For everybody but the biggest power users, Python should be considered as a serious candidate for HPC applications.