On Mon, 26 Apr 2004, Jeff Squyres wrote:
> MPI was designed with the concept of link-time intercepting MPI calls in
> mind. Hence, you can intercept a call to MPI_Send, record the fact that
> it was called (and in your case, from which thread it was called), and
> then call the real/underlying MPI_Send. This is known as MPI's
> profiling layer. In this case, you'll provide your own MPI_Send
> function (and all other MPI functions that you want to intercept) and do
> something like this (this is typed off the top of my head -- pardon
> typos):
I forgot to mention an important point -- all these functions that you
supply (MPI_Init, MPI_Send, etc.) should be in a separate library. e.g.,
compile them all into libmy_mpi.a. Then when you link your application,
you can include them or not -- depending if you want a profiled run or an
optimized run (remember that running with all this profiling stuff and
writing to files and whatnot will cost you in terms of performance).
Hence, you can:
# for a non-profiled run
mpicc my_application.c -o my_application
# for a profiled run
mpicc my_application.c -o my_application -lmy_mpi
See the chapter in MPI-1 about MPI's profiling interface.
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|