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 the README in mpich/profiling/wrappergen. 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:
They can be incorporated manually into your application. This will involve 3 changes to the building of your application:
$(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