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.
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

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now