Hands-on: Performance analysis of heat equation solver

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

Share this article:

This article is from the free online course:

Python in High Performance Computing

Partnership for Advanced Computing in Europe (PRACE)