Skip to main content
SciNet
  • Home
  • All Courses
  • Calendar
  • Certificates
  • SciNet
    Main Site Documentation my.SciNet
  • CCDB
  • More
Close
Toggle search input
English
English Français
You are currently using guest access
Log in
SciNet
Home All Courses Calendar Certificates SciNet Collapse Expand
Main Site Documentation my.SciNet
CCDB
Expand all Collapse all
  1. PHY1610 - Winter 2026
  2. 8. Managing many serial computations

8. Managing many serial computations

Completion requirements
Opened: Saturday, 21 March 2026, 12:00 AM
Due: Sunday, 29 March 2026, 11:59 PM

The Modified Zombie Apocalypse Model

After an ice storm, the doors of one apartment building are frozen shut, trapping everyone inside.  To make matters worse, some of the tenants suddenly become zombies.  The zombies go rampaging through the building, turning other apartment dwellers into zombies.

Fortunately, some people know how to kill zombies and are able to teach the other people in the apartment building.  The change of surviving a zombie encounter differs between zombie killers and non-zombie killers, but if a person does not survive the encounter, they become a zombie.

This process can be described by the equations:

\(\displaystyle\frac{dx}{dt} = -\beta x z - \delta x y\)

\(\displaystyle\frac{dy}{dt} = -\gamma y z + \delta x y\)

\(\displaystyle\frac{dz}{dt}= \beta xz + \gamma y z - \alpha yz\)

where

  • \(x(t)\) is the uninfected population without zombie killing skills ("regular people")
  • \(y(t)\) is the uninfected population with zombie killing skills ("zombie killers")
  • \(z(t)\) is the zombie population

These are fractions of the original population of the apartment building, so that \(0\leq x\leq1\), \(0\leq y\leq1\), \(0\leq z\leq1\), \(x(0)+y(0)+z(0) = 1\).

The parameters of the model are constants which can be interpreted as follows:

  • \(\alpha\) is the rate at which zombies are killed (by \(y\))
  • \(\beta\) is the rate at which regular people are turned into zombies  
  • \(\gamma\) is the rate at which zombie killers are turned into zombies
  • \(\delta\) is the rate at which zombie killers teach regular people how to kill zombies.

(This model was inspired by Munz et al., Infectious Disease Modeling Research Progress, 2009.)

The mza application

In this assignment, you are already given a program called 'mza' that uses GSL's odeiv2 sublibrary to solve this system of equations and writes out the time series to a NetCDF file.  

The mza application should not be changed.  You can find the code for the mza executable on the Teach cluster in the directory /home/l/lcl_uotphy1610/lcl_uotphy1610s1466/mza , i.e., you can compile it with

$ git clone /home/l/lcl_uotphy1610/lcl_uotphy1610s1466/mza
$ cd mza
$ source setup
$ make

The mza application accepts the following parameters as command-line arguments:

  • argument 1: Y(0), i.e., the initial uninfected fraction of the population without zombie-killing knowledge;
  • argument 2: Z(0), i.e., the initial fraction of the population that has turned into zombies;
  • argument 3: alpha, i.e. the rate at which zombies are killed (by zombie killers)
  • argument 4: beta, i.e., the rate at which regular people are turned into zombies  
  • argument 5: gamma, i.e.,the rate at which zombie killers are turned into zombies
  • argument 6: delta, i.e. the rate at which zombie killers teach others how to kill zombies
  • argument 7: the name of the netcdf file to be written with the time evolution of the populations until convergence.

In addition to the netcdf file, the application produces output to console as well, of the following form:

[PARAMETERS]
X0(regular)=0.978
Y0(killers)=0.018
Z0(zombies)=0.004
alpha=3
beta=2
gamma=1
delta=1.5
filename=timeseries.nc
[OUTCOME]
runtime=25.81
survival=59%
winners=humans

This particular output would be result of the command line "./mza 0.018 0.004 3 2 1 1.5 timeseries.nc". Note that the initial value of X(0) is computed from Y(0) and Z(0) and did not have to be entered as a commandline parameter. Also note that his ouput is enough to see who wins in the end, the winners or the humans,

Your Assignment

Your task is to 

  1. Perform a parameter sweep calculation using the "mza" application which implements a solution of the modified zombie apocalypse equations, and
  2. Post-process the results.

Step 1

Perform a parameter scan for all combinations of 51 values of Y(0) between 0 and 1 (inclusive), and 51 values of Z(0) between 0 and 1 (inclusive), so a total of 2601 cases, Keep the parameters alpha=3, beta=2, gamma=1, and delta=1.5 fixed.  Each subjob should be writing to a different netcdf file and redirecting its console output to a unique file.   These files should be written to a different directory for each parameter combination, so different runs do not overwrite each others output.

The mza application stops when the populations no longer change, so the runtime cannot be predicted ahead of time.  This could cause a load balanacing issue. To solve this, use GNU Parallel, such that it uses all 40 cores on a Teach cluster compute node.  The GNU Parallel command should be called in a job script to be submitted to the scheduler.  The script will also need to create the directories that will contain the output (perhaps utilizing GNU parallel as well).

A few of GNU Parallel and bash features that you should consider using:

  • The "--joblog" parameter to write a record of how each job went. You will need to use bash redirection to capture the console output in this case.
  • Use the ":::" syntax to create combinations of parameters .
  • Use the "{1}", "{2}", etc replacement string syntax to specify the template command from which GNU Parallel constructs the actual command list.

Also very useful is the bash command `seq` which can create a range of non-integer values (see "man seq").  For instance, you can generate a range of numbers between 0 and 1 with a step of 0.1 with "seq 0 0.1 1", and you can insert this in a bash command with "$(seq 0 0.1 1)" , for instance, "echo $(seq 0 0.1 1)".

Note that some of the 2601 combinations will not be successful as the total population would exceed 100%.

Step 2

For the postprocessing step, after the slurm job has run, the console output of the successful computations should be collected into two ASCII text files as follows.  You are to write a script or program that creates one file called "humanswin.dat", containing lines with the "Y(0) Z(0)" pairs for which the humans win, and it should create another file called "zombieswin.dat" containing the pairs for which the zombies win.  (Note: we are not using the netcdf files here.)

You can write the post-processing script/program in any language you wish, as long as it works on the Teach cluster and produces these two files.

Submission

You should submit a git repo with:

  • Your job script for step 1 
  • The script or program for step 2
  • The file "humanswin.dat" 
  • The file "zombieswin.dat",
  • and a README file explaining which script/program does what and how you ran the commands.

Do not include the output of the individual computations nor the mza code or executable.

Submit the repo by midnight Sunday March 29, 2026.

Keep in minds that the compute nodes of the teach cluster will be offline on March 24 and possibly March 25. 

You are currently using guest access (Log in)
Data retention summary


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Powered by Moodle