Tuesday September 2, 2014
This problem challenges you to create a hybrid MPI/OpenMP parallel program that simulates a disease model. The disease model is a simple SIR (susceptible, infected, recovered) model with parameters for initial number of susceptibles and recovery rate.
The model works as follows. At each time step,
- the number of susceptibles decreases by a rate called "get sick", which is defined as an infection fraction times the number of susceptibles times the number of infecteds.
- the number of infecteds increases by the same "get sick" rate.
- the number of infecteds decreases by a rate called "get better", which is defined as a recovery fraction times the number of infecteds.
- the number of recovereds increases by the same "get better" rate.
The numbers that should remain constant in your program are the initial number of infecteds (1), the initial number of recovereds (0), the infection fraction (0.00218), and the total number of time steps (50).
Your program should parameterize the initial number of susceptibles and the recovery fraction as follows:
For each parallel process (MPI) except the first one (Rank 0), the initial number of susceptibles is 1000 times the process rank. Each process spawns threads (OpenMP), and for each thread, the recovery fraction is computed as follows:
(thread_num + 1) / (num_threads + 1)
Each thread should run a simulation with its given parameters and store the total number of recovereds in an array at the conclusion of the simulation. Each process should then send its completed array in a message to process Rank 0, who should print the final results in order (by process rank) using the following format:
X1 Y1 Z1
X2 Y2 Z2
where X, Y, and Z are the initial number of susceptibles, the recovery fraction, and the total number of recovereds at the end of the simulation, respectively.
- the number of susceptibles decreases by a rate called "get sick", which is defined as an infection fraction times the number of susceptibles times the number of infecteds.
- the number of infecteds increases by the same "get sick" rate.
- the number of infecteds decreases by a rate called "get better", which is defined as a recovery fraction times the number of infecteds.
- the number of recovereds increases by the same "get better" rate.
The numbers that should remain constant in your program are the initial number of infecteds (1), the initial number of recovereds (0), the infection fraction (0.00218), and the total number of time steps (50).
Your program should parameterize the initial number of susceptibles and the recovery fraction as follows:
For each parallel process (MPI) except the first one (Rank 0), the initial number of susceptibles is 1000 times the process rank. Each process spawns threads (OpenMP), and for each thread, the recovery fraction is computed as follows:
(thread_num + 1) / (num_threads + 1)
Each thread should run a simulation with its given parameters and store the total number of recovereds in an array at the conclusion of the simulation. Each process should then send its completed array in a message to process Rank 0, who should print the final results in order (by process rank) using the following format:
X1 Y1 Z1
X2 Y2 Z2
where X, Y, and Z are the initial number of susceptibles, the recovery fraction, and the total number of recovereds at the end of the simulation, respectively.
Show solution
Challenge Resources:
Hybrid Parallel SIR solution
—
Solution to the "Hybrid Parallel SIR" challenge problem in C.
©1994-2024
|
Shodor
|
Privacy Policy
|
NSDL
|
XSEDE
|
Blue Waters
|
ACM SIGHPC
|
|
|
|
|
|
XSEDE Code of Conduct
|
Not Logged In. Login