Published June 22, 2026 | Version 1.0.0

From For-Loop to Supercomputer: A Hands-On Introduction to Parallel Computing with OpenMP and MPI

  • 1. ROR icon UiT The Arctic University of Norway

Description

Most research code starts the same way: a for-loop over a dataset, processing one item at a time. This tutorial shows how to break that bottleneck — step by step, from a single CPU core all the way to a distributed HPC cluster.

Starting from a plain Python loop (SISD — Single Instruction, Single Data), we walk through Flynn's Taxonomy to build intuition about why parallelism works, then implement the same workload four different ways: Python multiprocessing, C++ (sequential), C++ with OpenMP, and C++ with MPI. Each version comes with live benchmarks so attendees can see the speedup for themselves.

By the end of the session, attendees will understand:
1. The difference between shared-memory (OpenMP) and distributed-memory (MPI) parallelism
2. When to reach for each tool and when not to
3. The key OpenMP pragma that can parallelise a loop in one line
4. How MPI coordinates work across multiple machines, and why it scales to thousands of nodes

All code is provided as ready-to-run scripts. No prior parallel programming experience is required, just basic familiarity with Python and/or C++. In this repository you will find an example for running a [Monte Carlo Pi Estimation](https://www.geeksforgeeks.org/dsa/estimating-value-pi-using-monte-carlo/) using 20,000,000 random points implemented in:

2. C++
5. MPI

Files

Files (386.1 kB)

Name Size Download all
md5:30424dc5fbd03fdb336046501953f038
386.1 kB Download

Additional details

Software

Repository URL
https://github.com/youssefwally/FromForLoopToSupercomputer
Programming language
Python , C++
Development Status
Active