Tools for Profiling Library Management


Up: The MPE library of useful extensions Next: Examining event logs with  upshot Previous: Automatic generation of profiling libraries

The sample profiling wrappers for mpich are distributed as wrapper definition code. The wrapper definition code is run through the wrappergen utility to generate C code (see Section Automatic generation of profiling libraries . Any number of wrapper definitions can be used together, so any level of profiling wrapper nesting is possible when using wrappergen.

A few sample wrapper definitions are provided with mpich:

timing
Use MPI_Wtime() to keep track of the total number of calls to each MPI function, and the time spent within that function. This simply checks the timer before and after the function call. It does not subtract time spent in calls to other functions.
logging
Create logfile of all pt2pt function calls.
vismess
Pop up an X window that gives a simple visualization of all messages that are passed.
allprof
All of the above. This shows how several profiling libraries may be combined.


Note: These wrappers do not use any mpich-specific features besides the MPE graphics and logging used by `vismess' and `logging', respectively. They should work on any MPI implementation.

You can incorporate them manually into your application, which involves three changes to the building of your application:

* Generate the source code for the desired wrapper(s) with wrappergen. This can be a one-time task.
* Compile the code for the wrapper(s). Be sure to supply the needed compile-line parameters. `vismess' and `logging' require the MPE library (-lmpe), and the `vismess' wrapper definition requires MPE_GRAPHICS.
* Link the compiled wrapper code, the profiling version of the mpi library, and any other necessary libraries (`vismess' requires X) into your application. The required order is:
$(CLINKER)   <application object files...> \ 
    <wrapper object code> \ 
    <other necessary libraries (-lmpe)> \ 
    <profiling mpi library (-lpmpi)> \ 
    <standard mpi library (-lmpi)> 
  

To simplify it, some sample makefile sections have been created in mpich/profiling/lib:
Makefile.timing - timing wrappers 
    Makefile.logging - logging wrappers 
    Makefile.vismess - animated messages wrappers 
    Makefile.allprof - timing, logging, and vismess 
To use these Makefile fragments:
    1. (optional) Add $(PROF_OBJ) to your application's dependency list:
    myapp:  myapp.o $(PROF_OBJ) 
    

    2. Add $(PROF_FLG) to your compile line CFLAGS:
    CFLAGS = -O $(PROF_FLG) 
    

    3. Add $(PROF_LIB) to your link line, after your application's object code, but before the main MPI library:
    $(CLINKER) myapp.o -L$(MPIR_HOME)/lib/$(ARCH)/$(COMM) $(PROF_LIB) -lmpi 
    

    4. (optional) Add $(PROF_CLN) to your clean target:
    rm -f *.o *  myapp $(PROF_CLN) 
    

    5. Include the desired Makefile fragment in your makefile:
    include $(MPIR_HOME)/profiling/lib/Makefile.logging 
    
    (or
    #include $(MPIR_HOME)/profiling/lib/Makefile.logging 
    
    if you are using the wildly incompatible BSD 4.4-derived make)



Up: The MPE library of useful extensions Next: Examining event logs with  upshot Previous: Automatic generation of profiling libraries