juliorodrigues07 / ecosystem_simulation

Parallel implementation of a simple ecosystem based on Lotka-Volterra model (Predator-Prey).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C99

Ecosystem Simulation

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).

Requirements

  • GCC compiler:

    sudo apt install gcc
    
  • OpenMP library:

    sudo apt install libomp-dev
    
  • gprof tool;

  • To install all dependencies:

    ./install_dependencies.sh
    

Optional Requirements

  • 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
    

Compilation

Execute the following command to compile the source code:

make

Execution

You can alter the parameters, such as the number of threads in the source code (simulation.h).

Sequential

To execute the sequential version with or without profiling, run the following respective commands:

  • Without profiling:

    make sequential
    
  • With profiling (gprof):

    make with_prof
    

Parallel

Run the following command for executing the program with multiple threads:

make parallel

Optional Running

Instance Generator

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
    

Time graphics

Inside plotting directory, you can generate the time graphics present in this works report by running the following commmand:

python3 times.py

About

Parallel implementation of a simple ecosystem based on Lotka-Volterra model (Predator-Prey).


Languages

Language:C 75.7%Language:Python 21.0%Language:Makefile 2.4%Language:Shell 0.9%