Table of Contents
The main objective of this project is to simulate the spread of Covid in civilization. The computation of the simulation has been carried out in parallel, using the MPI library of C.
The following components have been taken into account to perform the simulation:
- Person
- Population
- Scenario
In the specified scenario, each person can perform the following actions: move, vaccinate and propagate. The simulation results are stored in a .out file. Here is a summary of the simulation execution:
- Initialize the variables required for MPI.
- If it is Node 0, the different program configuration methods are checked, and the global variables of the simulation configuration are initialized.
- Initialize the global variables.
- The gsl library is initialized, for the probabilities calculation.
- In the case of Node 0, the quadrants, the people to be vaccinated and the population per node are calculated. Once calculated, each variable is sent with an MPI_Bcast.
- Initialize the lists dynamically.
- Each node creates its population, with the previously calculated parameters (population per node, quadrants...).
- Iterate with a loop up to the stipulated number of iterations. For each iteration, all the actions that people can do are carried out.
- Each node sends its metrics and positions to Node 0.
- Node 0 prints the metrics and positions in its corresponding file.
- All the structures that remain to be freed are released.
- The simulation is finished.
The technologies used for this project are as follows:
Is mandatory to have installed C program an the make package. To avoid errors during runtime, use Linux instead Windows. The following examples are for an Ubuntu distribution:
- c
sudo apt install GCC
- Clone the repo
git clone https://github.com/iakigarci/KernelSimulator.git
- Install C packages
sudo apt install make gsl
- Compile source files
make
- Run the init script. Change the parameters name with the simulation parameters
For example:
./run.sh metrics.txt [parameters]
With configuration file:./run.sh "covid.out -s8 -p0.2 -g60 -b2 -i10 -d2 -m20" 4
./run.sh ”covid.out config_file.txt” 4
The parameters that the program accepts are the following. it can also be executed using a .txt configuration file
- -s or -world size: Side of the square matrix. Default value 8.
- -p or -percent: Percentage of the population to be vaccinated per iteration. Default value 0.05.
- -g or -population size: Population size. Default value 60.
- -b or -batch: Number of iterations per batch. Default value 2.
- -i or -iter: Number of iterations. Default value 10000.
- -d or -seed: N ́umero que act ́ua como semilla. Default value 3.
- -m or -ageMean: Average age of the population. Default value 28.
For more examples, please refer to the Documentation (Spanish)
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Iñaki García : [email protected] Asier Zubia: [email protected] Project Link: https://github.com/Asierzubia/CovidMPI
-
iakigarci https://github.com/iakigarci/
-
Asierzubia https://github.com/Asierzubia/