Skip main navigation

Course summary

In this video Jussi Enkovaara and Martti Louhivuori summarize the whole course.
Hi, we hope that you have enjoyed the course and learned a lot during these four weeks! Python is very efficient for the programmer, but the dynamic features come with a cost in performance. By restricting the flexibility of Python,
one can get the best out of both worlds: good programmer performance as well as good computer performance.
The four steps for this are:
One: Measure before you optimize. Even though some of the performance aspects can be taken into account when designing the program, the first priority is get the proram working correctly. Premature optimization is the root of all evil! When the program is working as expected, one should use application’s own timers and the cProfile tool to find out where the time is actually spent in the program. Then, one should focus optimizing only these parts.
Two: Use NumPy arrays for numerical data. Python’s built-in data structures are not optimal for number crunching. NumPy offers a static multidimensional array that is perfectly suited for numerical calculations. To get the most performance from Python use NumPy arrays whenever you can.
Three: Use Cython or external code for the most time consuming parts of the program. If all the flebility of Python is not needed, some parts of the application may be greatly speed up by introducing static type definitions and Cythonizing the code. Python provides also different ways for interfacing with code written in another, more performant languages. These languages can then be used for speeding up the most time critical parts of the Python program.
Four: Use MPI for parallel computing. Once you have squeezed out all the performance from a single CPU, or you have run out o the memory in a single CPU, you can gain further speed ups by using multiple CPUs in parallel. The mpi4py package offers a convenient Python interface to parallel computing using the message passing interface. Thanks for attending the course! Happy hacking in Python!
Congratulations for finishing the course!
Please complete the post-course survey and see also the other courses in FutureLearn provided by PRACE.
This article is from the free online

Python in High Performance Computing

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education