#include #include #include #include #include "stack.h" #define EPSILON 1e-3 #define F(arg) cosh(arg)*cosh(arg)*cosh(arg)*cosh(arg) #define A 0.0 #define B 5.0 #define SLEEPTIME 1 int *tasks_per_process; double farmer(int); void worker(int); int main(int argc, char **argv ) { int i, myid, numprocs; double area, a, b; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD,&numprocs); MPI_Comm_rank(MPI_COMM_WORLD,&myid); if(numprocs < 2) { fprintf(stderr, "ERROR: Must have at least 2 processes to run\n"); MPI_Finalize(); exit(1); } if (myid == 0) { // Farmer // init counters tasks_per_process = (int *) malloc(sizeof(int)*(numprocs)); for (i=0; i