/* file: time.c compile: cc time.c -lmpi run: mpirun -np 4 ./a.out */ #include "mpi.h" #include main( argc, argv ) int argc; char **argv; { int myrank; int a[10000]; int i; int x[800]; int n; double before, after; MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); MPI_Comm_size( MPI_COMM_WORLD, &n ); for (i=0; i<800; i++){ x[i]=myrank+i; } before = MPI_Wtime(); MPI_Gather(x, 800, MPI_INT, a, 800, MPI_INT, 0, MPI_COMM_WORLD); after = MPI_Wtime(); if (myrank == 0){ printf("time = %5f\n", (float)(after-before)); /* for (i=0; i