/************************************************************** File: main.cc Description: A program that implements a pool of tasks model for encrypting a text. Author: Dana Vrajitoru Organization: IUSB, Computer and Information Sciences Date: October 2020 ***************************************************************/ #include #include #include #include #include #include using namespace std; #include "pool_tasks.h" int main(int argc, char **argv) { double time; int my_id, nr_proc; /* Initialize MPI */ MPI_Init (&argc, &argv); /* Get the rank of this process */ MPI_Comm_rank (MPI_COMM_WORLD, &my_id); /* Get nb of processes */ MPI_Comm_size (MPI_COMM_WORLD, &nr_proc); time = MPI_Wtime(); if (my_id == 0) Master(nr_proc); else Worker(my_id, nr_proc); time = MPI_Wtime() - time; if (my_id == 0) cout << "This program has run on " << nr_proc << " processes in " << time << " seconds." << endl; /* Finalize MPI */ MPI_Finalize (); return 0; }