Skip main navigation

£199.99 £139.99 for one year of Unlimited learning. Offer ends on 28 February 2023 at 23:59 (UTC). T&Cs apply

Find out more

Bonus hands-on: Parallel heat equation solver

Implement a parallel heat equation solver using MPI
© CSC - IT Center for Science Ltd.

If you would like to further practice your parallel programming skills, we have as a final parallel programming hands-on exercise parallelization of the heat equation solver with MPI.

Source code for this exercise is located in mpi/heat-equation/

Parallelise the serial heat equation solver in numpy/heat-equation/ with MPI,
by dividing the grid into blocks of rows and assigning one row block to one
task. A domain decomposition, that is.

Note that the tasks are able to update the grid independently everywhere else
than on the boundary rows – there the communication of a single row with the
nearest neighbor is needed. This can be achieved by having additional ghost
layers that contain the boundary data of the neighboring tasks. As the system
is aperiodic, the outermost ranks communicate with a single neighbor, and the
inner ranks with two neighbors.

Insert suitable MPI routines into the skeleton code in (search for “TODO”s). Remember to update all ghost layers at each iteration.

A schematic representation of the decomposition looks like: Domain decomposition

Once you have a functioning parallel pure Python version, try to Cythonize the main computational kernel by utilizing your solution (or model solution) in Step 3.11.

© CSC - IT Center for Science Ltd.
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