For each of these libraries, the process of building the library was very similar. First, profiling versions of MPI_Init and MPI_Finalize must be written. The profiling versions of the other MPI routines are quite similar in style. The code in each looks like
int MPI_Xxx( . . . ) { do something for profiling library retcode = PMPI_Xxx( . . . ); do something else for profiling library return retcode; }We generate these routines by writing the ``do something'' parts only once, in schematic form, and then wrapping them around the PMPI_ calls automatically. It is thus extremely easy to generate profiling libraries.
Examples of how to write the wrapper templates can be found in the profiling/lib subdirectory. There you will find the source code (the .w files) for creating the three profiling libraries described above. An example Makefile for trying these out can be found in the profiling/examples directory.