Parallel implementation in shared memory environments of a simple ecosystem based on Lotka-Volterra model (Predator-Prey) utilizing OpenMP library (PA 2 from Parallel Computing course - DCOMP - UFSJ).
-
GCC compiler:
sudo apt install gcc
-
OpenMP library:
sudo apt install libomp-dev
-
gprof tool;
-
To install all dependencies:
./install_dependencies.sh
-
Python3 and pip package manager:
sudo apt install python3 python3-pip build-essential python3-dev
-
PyCryptodome library:
pip install pycryptodomex
-
Matplotlib library:
pip install matplotlib
-
seaborn library:
pip install seaborn
Execute the following command to compile the source code:
make
You can alter the parameters, such as the number of threads in the source code (simulation.h).
To execute the sequential version with or without profiling, run the following respective commands:
-
Without profiling:
make sequential
-
With profiling (gprof):
make with_prof
Run the following command for executing the program with multiple threads:
make parallel
Inside instances directory, you can generate your own instances by executing the command using the following template: python3 instance_generator.py --rows <number> --columns <number> --genrabbit <number> --genfox <number> --hunger <number> --ngen <number> --rabbits <number> --foxes <number> --stones <number>
-
Example: Generating an instance file with ecosystem dimension 5 x 5, rabbit's reproduction interval 2, foxes' reproduction interval 4, foxes' starvation interval 3, 6 generations, 10% rabbits, 10% foxes and 20% stones:
python3 instance_generator.py -l 5 -c 5 -gr 2 -gf 4 -hf 3 -n 6 -r 0.1 -f 0.1 -s 0.2
Inside plotting directory, you can generate the time graphics present in this works report by running the following commmand:
python3 times.py