/* Estimate bandwidth and latency of a parallel computer using MPI. Ole Moller Nielsen - 1998 */ #include #include #include #define MAXI 10 /* Number of blocks */ #define MAXM 500000 /* Largest block */ #define BLOCK MAXM/MAXI /* Block size */ double linfit(double* x, double* y, int N, double* a, double* b) { /* Given vectors y and x fit a and b to the model y = ax + b */ double Sx=0, Sy=0, SxoN=0, SSoN=0, t=0; double res, varest=0, norm=0; int i; for (i=0; i maxtime[i]) maxtime[i] = t2; } else { MPI_Recv(&A[0],m,MPI_DOUBLE,myid-1,msgid,MPI_COMM_WORLD,&stat); MPI_Send(&A[0],m,MPI_DOUBLE,(myid+1)%procs,msgid,MPI_COMM_WORLD); } } } if (myid == 0) { printf("Bytes transferred time (micro seconds)\n"); printf(" min avg max \n"); printf("----------------------------------------------\n"); for (i=0; i