The actual MPI function call is redefined in a library (Umpire library), and wrapper calls may be made around it. The Umpire library allows us to define pre and post call wrappers for all the MPI function calls. These wrappers are defined in a file, which is passed to a wrapper-generator program, which generates the umpire files for profiling. The actual MPI operation is called indirectly using the PMPI interface [3]. The PMPI interface is specifically implemented to allow profiling, though they do not state its purpose in the standard.
The Umpire library [4] was developed by Lawrence Livermore National Lab (llnl). This library can be used for profiling and tracing. MPICTrace system makes use of Umpire mainly for recording the MPI calls into a trace file.
extern int MPI_Send (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { int rc = 0; void *pc = 0x0; rc = gwrap_MPI_Send (pc, (buf), &(count), &(datatype), &(dest), &(tag), &(comm)); return rc; } static int gwrap_MPI_Send (void *pc, void *buf, int *count, MPI_Datatype * datatype, int *dest, int *tag, MPI_Comm * comm) { int rc; rc = PMPI_Send ((buf), *(count), *(datatype), *(dest), *(tag), *(comm)); umpi_mpi_MPI_Send_post (rc, pc, buf, count, datatype, dest, tag, comm); return rc; }
The code above is from the umpi_mpi.c file generated by the wrapper. It can easily be seen how the call to the real MPI_Send function is made. The umpi_mpi_MPI_send_post function is the post-call profiling function generated by the umpire wrapper-generator. This profiling function can be defined in a file used by the wrapper-generator program to generate the umpi.