/********************************************************** File: main.cc Description: A program that inputs an integer number and determines if it is a prime number or not in parallel. Author: Dana Vrajitoru Organization: IUSB Date: September 28, 2004 ***********************************************************/ #include #include using namespace std; #include "slave.h" #include "master.h" // The main function int main(int argc, char **argv) { int proc_id, nr_proc, n; /* Initialize MPI */ MPI_Init (&argc, &argv); /* Get the rank of this process */ MPI_Comm_rank (MPI_COMM_WORLD, &proc_id); /* Get nb of processes */ MPI_Comm_size (MPI_COMM_WORLD, &nr_proc); if (proc_id == MASTER_ID) Master(nr_proc); else Slave(proc_id, nr_proc); /* Finalize MPI */ MPI_Finalize (); return 0; } // End of the program