Want to keep learning?

This content is taken from the Partnership for Advanced Computing in Europe (PRACE)'s online course, Python in High Performance Computing. Join the course to learn more.

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

Share this article:

This article is from the free online course:

Python in High Performance Computing

Partnership for Advanced Computing in Europe (PRACE)