/**************************************************************************** * FILE: msgsize.c * DESCRIPTION: * This code conducts timing tests on messages sent between two processes. * It sends/receives N roundtrips of incrementally sized messages * from start size J to finish size K by increment I. T trials are run * and the best result used. * LAST REVISED: 12/27/98 Blaise Barney ******************************************************************************/ #include "mpi.h" #include /* Modify these to change timing scenario */ #define TRIALS 10 #define START 0 #define FINISH 1000 #define REPS 100 #define INCR 100 #define MAXPOINTS 10000 int numtasks, rank, n, i, j, k, this, msgsizes[MAXPOINTS]; float bandwidth, tbytes, results[MAXPOINTS]; double t1, t2, ttime; char c[FINISH], host0[MPI_MAX_PROCESSOR_NAME], host1[MPI_MAX_PROCESSOR_NAME]; MPI_Status Stat; int main(argc,argv) int argc; char *argv[]; { /* Minor error check */ if ( ((FINISH - START)/INCR) > MAXPOINTS) { printf("\nMaximum number of datapoints exceeded. Terminating.\n"); exit(0); } MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &numtasks); MPI_Comm_rank(MPI_COMM_WORLD, &rank); /**************************** task 0 ***********************************/ if (rank == 0) { /* Initialize arrays which hold timing stats - and other things too */ this=0; for (n=START; n<=FINISH; n=n+INCR) { msgsizes[this] = n; results[this] = 0.0; this++; } MPI_Get_processor_name(host0, &n); MPI_Recv(&host1, 35, MPI_CHAR, 1, 999, MPI_COMM_WORLD, &Stat); for (i=0; i