Computer Science 335
Parallel Processing and High Performance Computing
Fall 2026, Siena University
In this lab, you will see how to write, compile, and run programs that use a combination of MPI and OpenMP for parallelization.
We will work together through this lab, but everyone must submit their own responses to the lab questions.
Learning goals:
Getting Set Up
Since you will not be writing your own code for this lab, there is no lab-specific repository. However, you should clone the repositories for these examples:
At the end, you will submit a PDF file or a link to a Google shared document that contains your responses to the questions below through the Canvas assignment corresponding to this lab.
Compiling and Running
Clone the mpiopenmp-hello repository on noreaster.
Before looking at the program, notice that the Makefile uses
the mpicc compiler wrapper along with some extra compiler and
linker flags related to OpenMP. There are some extra flags related to
running on my Mac that don't seem to cause any problems on
noreaster.
Compile and link using make.
Set OMP_NUM_THREADS to 4 and run with 2 MPI processes
(mpirun -np 2).
Conway's Game of Life Example
Clone the mpiopenmp-life repository on noreaster.
This version of Conway's Game of Life is similar to the MPI and OpenMP versions we saw previously, bringing in the parallelization techniques from each.
Before we look at that, we take a look at the pseudorandom number
generation (PRNG) used by this version. Since we would like the
numbers generated to determine the initial state of the cells to be as
pseudorandom as the case where we have a single process and single
thread, separate PRNG seeds are computed for each thread, and each
thread uses a separate state variable that gets passed to
next_random to generate values. We do not need to worry about
the math, just be aware that this is an issue in parallel computing in
general.
Now looking at the parallelization.
OpenMP threads are used in multiple phases of the computation, each
using a for directive.
Here are some example timing studies. The first two are for 10 iterations on a 40960 ×40960 universe.
Running 16 total threads on a MacBook Pro M5 with 18 Cores (6 Super and 12 Performance). The script to run is here.
|
MPI Processes | OpenMP Threads/Proc | Time |
| 1 | 16 | 18.860615 |
| 2 | 8 | 18.532131 |
| 4 | 4 | 18.548327 |
| 8 | 2 | 17.802275 |
| 16 | 1 | 18.286892 |
And on noreaster, 20 cores:
|
MPI Processes | OpenMP Threads/Proc | Time |
| 1 | 16 | 50.557521 |
| 2 | 8 | 47.161144 |
| 4 | 4 | 48.092721 |
| 8 | 2 | 45.999678 |
| 16 | 1 | 46.226815 |
For multicore systems like these, we can run our computation with MPI processes, OpenMP threads, or any combination. But if we want to use cores in different physical computer systems (that do not share memory), such as multiple nodes of a supercomputer like Stampede3, we need to involve MPI for cross-node communication. But is it better to simply use as many MPI processes as there are cores, or use one MPI process per node and use OpenMP threads to take advantage of the cores on that node?
Two timing studies, submitted to 4 Stampede3 Skylake nodes using these Slurm files: Pure MPI and MPI/OpenMP Hybrid. Each was run with a 192000 ×192000 universe with a total of 192 threads.
Results:
Tools and techniques exist, that are beyond what we discuss in this class, to measure how much time is spent in computation, thread management, message passing, etc.
Submission
Submit your responses to the lab questions through the Canvas assignment for this lab.
Grading
This assignment will be graded out of 40 points.
|
Feature | Value | Score |
| Question 1 | 3 | |
| Question 2 | 1 | |
| Question 3 | 1 | |
| Question 4 | 10 | |
| Question 5 | 6 | |
| Question 6 | 2 | |
| Question 7 | 4 | |
| Question 8 | 5 | |
| Question 9 | 8 | |
| Total | 40 | |