/* Simple MPI communication test. Ole Moller Nielsen - 2011 */ #include #include #include #define M 5000 /* Data size */ int main(int argc, char **argv) { int repeats = 3, msgid = 0; int myid, procs; int j, k; double A[M]; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Status stat; /* Initialize */ MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &procs); MPI_Comm_rank(MPI_COMM_WORLD, &myid); MPI_Get_processor_name(processor_name, &namelen); if (myid == 0) { printf("Number of processes = %d\n", procs); printf("Test repeated %d times for reliability\n", repeats); } if (procs < 2) { printf("Program needs at least two processors - aborting\n"); MPI_Abort(MPI_COMM_WORLD,999); } /* Create the data */ for (j=0; j