Pandemic Exemplar

Yu Zhao and Libby Shoop, Macalester College

Aaron Weeden, Shodor Fuundation

Author Profile


In this module we present a typical real-world example from epidemiology, where the spread of a pandemic infectious disease is modeled using monte carlo simulation (random movements that simulate the real-world actions of people). Starting from a given amount of infected people, how a disease spreads is modeled over a user-provided length of time. We start with the sequential version of this classic iterative monte carlo solution, then show how the code can be parallelized. Students can run the code and examine performance of sequential and parallel versions.

Learning Goals

  • Students will appreciate how parallel program solutions can be used on real-world applications.
  • Students will be able to compare running versions of sequential and parallel solutions.

Context for Use

This module presents C code that has been decomposed into many small functions in separate files and makes use of data structures to hold simulation parameters and computed values. Students should have some familiarity with C programming. The code and how the simulation is carried out is described in detail, so most students with some coding experience should be able to grasp it. A prior working knowledge of OpenMP is necessary (see the Parallel Patternlets module in this collection to help with that).

Description and Teaching Materials

Teaching Notes and Tips

You will need multicore hardware with an OpenMP compiler to run the parallel examples.


Suggested homework problems and additional activities are in the works.

Comment? Start the discussion about Pandemic Exemplar