[MPICH] Best way to time MPI_Allreduce

Ashley Pittman ashley at quadrics.com
Thu Aug 10 12:43:54 CDT 2006


On Thu, 2006-08-10 at 13:20 -0400, Mehmet Belgin wrote:
> Hi, 
> 
> I am trying to do some timing measurements with MPI_Allreduce. I get
> different results from every processor, as expected. Should I use the
> MPI_Barrier before and after the MPI_Allreduce call and then time it
> (which will include the overhead of MPI_Barrier to the timing)? Or
> will it be accurate if I simply get the maximum of the timing results
> I collected form each processor. 

The easiest way would be to use IMB which does it already but assuming
you want to roll your own, I'd suggest something like this:

  int warmup = 10;
  int reps = 10000;

  for ( count = 0 ; count < warmup ; count++)
  {
     MPI_Allreduce(..)
  }
  start = time();
  for ( count = 0 ; count < reps ; count++)
  {
     MPI_Allreduce(..)
  }
  end = time() - start;

  MPI_Reduce(&end,&sum,1,MPI_INT,MPI_SUM,0,...)

Ashley,




More information about the mpich-discuss mailing list