I need to do some performance tests on my mpi app.  I simply want to determine how long it takes for my sends from one process to be received by another process. 


Here is the code I used as my example for non-blocking send/receive...

 if( myrank == 0 ) {
  /* Post a receive, send a message, then wait */
  MPI_Irecv( b, 100, MPI_DOUBLE, 1, 19, MPI_COMM_WORLD, &request );
  MPI_Isend( a, 100, MPI_DOUBLE, 1, 17, MPI_COMM_WORLD );
  MPI_Wait( &request, &status );
 }
 else if( myrank == 1 ) {
  /* Post a receive, send a message, then wait */
  MPI_Irecv( b, 100, MPI_DOUBLE, 0, 17, MPI_COMM_WORLD, &request );  
  MPI_Isend( a, 100, MPI_DOUBLE, 0, 19, MPI_COMM_WORLD );
  MPI_Wait( &request, &status );
 }

I originally thought to just put a timer call before affer the rank=0 receive, but that doesn't seem to capture the complete time... see the following code.

 if( myrank == 0 ) {

  timer.start();
  /* Post a receive, send a message, then wait */
  MPI_Irecv( b, 100, MPI_DOUBLE, 1, 19, MPI_COMM_WORLD, &request );
  MPI_Isend( a, 100, MPI_DOUBLE, 1, 17, MPI_COMM_WORLD );
  MPI_Wait( &request, &status );
  timer.stop();
  elapsedTime = getElapsedTime();
 }
 else if( myrank == 1 ) {
  /* Post a receive, send a message, then wait */
  MPI_Irecv( b, 100, MPI_DOUBLE, 0, 17, MPI_COMM_WORLD, &request );  
  MPI_Isend( a, 100, MPI_DOUBLE, 0, 19, MPI_COMM_WORLD );
  MPI_Wait( &request, &status );
 }

How do others time this process?  Should I send a msg from one app to the other to initiate timing, send the data I want to time?


 if( myrank == 0 ) {

  MPI_Irecv( b, 100, MPI_DOUBLE, 1, startTimeTag, MPI_COMM_WORLD, &request );
  MPI_Wait( &request, &status );
  timer.start();
  MPI_Irecv( b, 100, MPI_DOUBLE, 1, dataTag, MPI_COMM_WORLD, &request );
  MPI_Wait( &request, &status );
  timer.stop();
  elapsedTime = getElapsedTime();
 }
 else if( myrank == 1 ) {

  MPI_Isend( a, 100, MPI_DOUBLE, 0, startTimerTag, MPI_COMM_WORLD );
  MPI_Wait( &request, &status );
  MPI_Isend( b, 100, MPI_DOUBLE, 0, dataTag , MPI_COMM_WORLD, &request );  
  MPI_Wait( &request, &status );
 }

Ed