Skip main navigation

Hands-on: Performance analysis of heat equation solver

In this exercise you analyse the performance of heat equation solver implemented in pure Python.
© CC-BY-NC-SA 4.0 by CSC - IT Center for Science

It is time for our first hands-on exercise. In the subsequent weeks there will be many more of them.

In this exercise you can familiarize yourself with cProfile.

Start your virtual machine, log in, and open the Terminal. The code for this exercise is located under performance/cprofile in the git-repository you cloned:

~/hpc-python$ cd performance/cprofile/

The file heat_main.py contains (very inefficient) implementation of the two dimensional heat equation. Use cProfile for investigating where the time is spent in the program. Note that the execution time can be between 40 – 60 s depending on your hardware. (You can see also results of the simulation in the heat_nnn.png output files).

What is the most time consuming part in your system? How long did it take? Please comment! During the course you will be able to bring the execution time down under one second.

© CC-BY-NC-SA 4.0 by CSC - IT Center for Science
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