Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] How to override MPI functions such as MPI_Init, MPI_Recv...
From: Le Duy Khanh (khanhtn24_at_[hidden])
Date: 2009-05-13 14:33:19


Wow, that's great.

 You mean that PMPI_* is totally/functionally similar to MPI_*, right ?

 Thank you so much for your instructions.

Le , Duy Khanh
Cellphone: (+84)958521704
Faculty of Computer Science and Engineering
Ho Chi Minh city University of Technology , Viet Nam

--- On Wed, 5/13/09, Jeff Squyres <jsquyres_at_[hidden]> wrote:

From: Jeff Squyres <jsquyres_at_[hidden]>
Subject: Re: [OMPI users] How to override MPI functions such as MPI_Init, MPI_Recv...
To: "Open MPI Users" <users_at_[hidden]>
Date: Wednesday, May 13, 2009, 11:43 AM

You could just define your own library with the same signatures as official MPI functions, and link that into MPI applications.  Under the covers, you invoke the PMPI_* equivalents of each function.  Lots of profiling and analysis tools work this way.  For example:

int MPI_Init(int argc, char **argv)
{
    /* do whatever you want to do here */
    ret = PMPI_Init(argc, argv);
    /* do whatever you want to do here */
    return ret;
}

compile/link that into libextra_mpi_stuff.a.  Then compile your app with:

   mpicc my_mpi_app.c -lextra_mpi_stuff

and then when mpi_mpi_app.c calls MPI_Init(), it'll call *your* MPI_Init.  Your MPI_Init will do whatever it wants to, and invoke PMPI_Init() (i.e., the "real" init function) and return back to the user.

This is the profiling interface of MPI.

On May 13, 2009, at 1:20 PM, Le Duy Khanh wrote:

> Dear,
>
>  I intend to override some MPI functions such as MPI_Init, MPI_Recv... but I don't want to dig into OpenMPI source code.Therefore, I am thinking of a way to create a lib called "mympi.h" in which I will #include "mpi.h" to override those functions. I will create a new interface with exactly the same signatures like MPI_Init (because users are familiar with those functions). However, the problem is that I don't know how to override those functions because as I know, C/C++ doesn't allow us to override functions (only overload them).
>
>  Could you please show me how to override OMPI functions but still keep the same function names and signatures?
>
>  Thank you so much for your time and consideration
>
> Le , Duy Khanh
> Cellphone: (+84)958521704
> Faculty of Computer Science and Engineering
> Ho Chi Minh city University of Technology , Viet Nam
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

--Jeff Squyres
Cisco Systems

_______________________________________________
users mailing list
users_at_[hidden]
http://www.open-mpi.org/mailman/listinfo.cgi/users