<div dir="ltr">I check fmpich2.dll with "Dependency Walker (depends.exe)". It shows that fmpich2.dll imports mpich2mpi.dll, and the import function list view (top right window) only list PMPI_XXXX() functions, so I'm sure that Fortran binding calls PMPI version but not C binding.<br>
<br>BTW, you can also investigate mpich2mpi.dll and mpich2.dll, all the entry points for MPI_YYY() and the coresponding PMPI_YYY() are the same. This is how the c binding work.<br><br>Best<br><br>Andrew<br><br><div class="gmail_quote">
On Thu, Jul 31, 2008 at 9:17 AM, Ruini Xue <span dir="ltr"><<a href="mailto:xueruini@gmail.com">xueruini@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Here is a link which illustrate this topic: <a href="http://www.netlib.org/utk/papers/mpi-book/node190.html" target="_blank">http://www.netlib.org/utk/papers/mpi-book/node190.html</a><br><br>All C version MPI_XXXX() are defined as *weak symbols* to PMPI_XXXX(), which means that if there is no MPI_XXX() definition, the<br>
user application would use the coresponding PMPI_XXX(). The figure also shows that in normal case (without profiling), PMPI_Bcast()<br>do all the real work (see MPI_Bcast()--->PMPI_Bcast()) because MPI_Bcast() is not defined yet, otherwise (with profiling), since MPI_Send() is provided by the profiling lib, use app would be linked to the MPI_Send() in profiling lib, which in turn calls the original PMPI_Send(). So, I think it's PMPI_XXX() do all the work internally, both C and Fortran bindings calls PMPI_XXX().<br>
<br>Now let check code. There a piece of code from: src/mpi/pt2pt/bsend.c<br>///////////////////////////////////////////////////////////<br>/* -- Begin Profiling Symbol Block for routine MPI_Bsend */<br>#if defined(HAVE_PRAGMA_WEAK)<br>
#pragma weak MPI_Bsend = PMPI_Bsend<br>#elif defined(HAVE_PRAGMA_HP_SEC_DEF)<br>#pragma _HP_SECONDARY_DEF PMPI_Bsend MPI_Bsend<br>#elif defined(HAVE_PRAGMA_CRI_DUP)<br>#pragma _CRI duplicate MPI_Bsend as PMPI_Bsend<br>#endif<br>
/* -- End Profiling Symbol Block */<br><br>/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build<br> the MPI routines */<br>#ifndef MPICH_MPI_FROM_PMPI<br>#undef MPI_Bsend<br>#define MPI_Bsend PMPI_Bsend<br>
<br>#endif<br><br>#undef FUNCNAME<br>#define FUNCNAME MPI_Bsend<br>//////////////////////////////////////////////////////////////////////////<br><br>It seems that if #pragma weak is supported, MPI_Bsend is weakly defined to PMPI_Bsend, otherwise MPI_Bsend is defined to<br>
PMPI_Bsend via macro. That's to say, MPI_Bsend always does nothing, but is mapped to PMPI_Bsend. This is the C binding version.<br><br>For fortran binding, check src/binding/f77/bsendf.c:<br>//////////////////////////////////////////////////////////////////////<br>
FORT_DLL_SPEC void FORT_CALL mpi_bsend_ ( void*v1, MPI_Fint *v2, MPI_Fint *v3, MPI_Fint *v4, MPI_Fint *v5, MPI_Fint *v6, MPI_Fint *ierr ){<br> *ierr = MPI_Bsend( v1, *v2, (MPI_Datatype)(*v3), *v4, *v5, (MPI_Comm)(*v6) );<br>
}<br>/////////////////////////////////////////////////////////////////////<br><br>It seems that the fortran binding calls the C binding directly, but actually MPI_Bsend() is PMPI_Bsend().<br><br>I am not sure whether I describe and analysis it accurately.<br>
<br><br>Best<br><br>Andrew <br><div><div></div><div class="Wj3C7c"><br><div class="gmail_quote">On Thu, Jul 31, 2008 at 2:11 AM, Jayesh Krishna <span dir="ltr"><<a href="mailto:jayesh@mcs.anl.gov" target="_blank">jayesh@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<p><font size="2"><div>>> Looks like the Fortran interface does call the MPI version of the C function.<br>
<br></div>
Only if the call is from PMPI_* funcs. (If the MPI call is not from PMPI, MPI_* funcs get defined to PMPI_*)<br>
<br>
>> If the fortran binding calls PMPI version of C function...<br>
<br>
In windows this currently does not work (I guess, it is due to the different calling convention/name mangling by the mpe lib and the fortran lib in windows) :( Defenitely a TODO item :)<br>
<br>
Regards,<br><font color="#888888">
Jayesh</font><div><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">owner-mpich-discuss@mcs.anl.gov</a> [<a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">mailto:owner-mpich-discuss@mcs.anl.gov</a>] On Behalf Of Rajeev Thakur<br>
Sent: Wednesday, July 30, 2008 12:42 PM<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br></div><div><div></div><div>
Subject: RE: [mpich-discuss] How does the fortran binding work?<br>
<br>
Looks like the Fortran interface does call the MPI version of the C function.<br>
<br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">owner-mpich-discuss@mcs.anl.gov</a><br>
> [<a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">mailto:owner-mpich-discuss@mcs.anl.gov</a>] On Behalf Of Anthony Chan<br>
> Sent: Wednesday, July 30, 2008 12:01 PM<br>
> To: <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
> Subject: Re: [mpich-discuss] How does the fortran binding work?<br>
><br>
> If the fortran binding calls PMPI version of C function, can the<br>
> fortran MPI program still be profiled ?<br>
> <br>
> ----- "Rajeev Thakur" <<a href="mailto:thakur@mcs.anl.gov" target="_blank">thakur@mcs.anl.gov</a>> wrote:<br>
><br>
> > The Fortran binding calls the PMPI version of the C function.<br>
> ><br>
> > Rajeev<br>
> ><br>
> > > -----Original Message-----<br>
> > > From: <a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">owner-mpich-discuss@mcs.anl.gov</a><br>
> > > [<a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank">mailto:owner-mpich-discuss@mcs.anl.gov</a>] On Behalf Of Anthony Chan<br>
> > > Sent: Wednesday, July 30, 2008 9:46 AM<br>
> > > To: <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
> > > Cc: <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
> > > Subject: Re: [mpich-discuss] How does the fortran binding work?<br>
> > ><br>
> > ><br>
> > > No. PMPI is the MPI profiling interface and is standardized by<br>
> > > the MPI forum.<br>
> > > Fortran/C++ MPI binding just calls the C MPI routine.<br>
> > ><br>
> > > A.Chan<br>
> > ><br>
> > > ----- "Ruini Xue" <<a href="mailto:xueruini@gmail.com" target="_blank">xueruini@gmail.com</a>> wrote:<br>
> > ><br>
> > > > On Wed, Jul 30, 2008 at 8:54 PM, Dave Goodell <<br>
> > > <a href="mailto:goodell@mcs.anl.gov" target="_blank">goodell@mcs.anl.gov</a> ><br>
> > > > wrote:<br>
> > > ><br>
> > > ><br>
> > > > Hi Andrew,<br>
> > > ><br>
> > > > Yes, the fortran and c++ bindings are just wrappers over the C<br>
> > > > bindings. The C binding implements the functionality directly.<br>
> > > ><br>
> > > > Are they wrappers of MPI_XXX() or PMPI_XXX()?<br>
> > > ><br>
> > > > Best<br>
> > > ><br>
> > > > Andrew<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > -Dave<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > On Jul 30, 2008, at 6:11 AM, Ruini Xue wrote:<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > Hello, everyone,<br>
> > > ><br>
> > > > I am working with MPICH2 on Windows platfrom. The fortran MIP<br>
> > > > application is linked to fmpich.lib, and fmpich2.dll is<br>
> loaded in<br>
> > > > runtime, which in turn loads mipch2mpi.dll.<br>
> > > > mpich2mpi.dll contains all MPI APIs which exported C<br>
> > > interface. What I<br>
> > > > want to know is: what is the 'underlying' relation between<br>
> > > fmpich2.dll<br>
> > > > and mpich2mip.dll? Do all<br>
> > > > Fortran MPI calls are converted to c bindings in mpich2mpi.dll?<br>
> > For<br>
> > > > example, does MPI_BCAST() in fmich2.dll directly calls<br>
> > > MPI_Bcast() in<br>
> > > > mpich2mpi.dll? Is MPI_BCAST() just a stub while MPI_Bcast() do<br>
> > the<br>
> > > > real job?<br>
> > > ><br>
> > > > Thanks<br>
> > > ><br>
> > > > Andrew<br>
> > ><br>
> > ><br>
><br>
><br>
<br>
</div></div></font>
</p>
</div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>