On Aug 27, 2015, at 3:25 AM, Gilles Gouaillardet <gil...@rist.or.jp> wrote:
> 
> I am lost ...

Fortran does that to ya.  ;-)

> from ompi/mpi/fortran/mpif-h/profile/palltoall_f.c
> 
> void ompi_alltoall_f(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
>                    char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
>                    MPI_Fint *comm, MPI_Fint *ierr)
> {
>    [...]
>    c_ierr = MPI_Alltoall(sendbuf,
>                          OMPI_FINT_2_INT(*sendcount),
>                          c_sendtype,
>                          recvbuf,
>                          OMPI_FINT_2_INT(*recvcount),
>                          c_recvtype, c_comm);
>    [...]
> }
> 
> $ nm ompi/mpi/fortran/mpif-h/profile/.libs/palltoall_f.o | grep MPI_Alltoall
>                 U MPI_Alltoall
> 0000000000000000 W MPI_Alltoall_f
> 0000000000000000 W MPI_Alltoall_f08
> 0000000000000000 W PMPI_Alltoall_f
> 0000000000000000 W PMPI_Alltoall_f08
> 
> ompi_alltoall_f() calls MPI_Alltoall()
> 
> 
> the "natural" way of writing a tool is to write mpi_alltoall_ (that calls 
> pmpi_alltoall_)
> *and* MPI_Alltoall (that calls PMPI_Alltoall)

Sidenote: the only correct way to write a tool that intercepts Fortran MPI API 
calls is to write those interceptions *in Fortran*.  I.e., the tool should 
provide MPI_ALLTOALL as a Fortran subroutine.  I realize that this is not the 
point of what you are saying :-), but everyone always gets this point wrong, so 
I feel the need to keep pointing this out.

> since ompi_alltoall_f invokes MPI_Alltoall (and not PMPI_Alltoall), the tool 
> is invoked twice, by both the Fortran and C wrapper.

I didn't think that this was true, but I just confirmed it by looking at "gcc 
-E" output in the mpif-h/profile directory.

I don't think that it was the intent.  See below.

> my initial question was
> "why does ompi_alltoall_f invokes MPI_Alltoall instead of PMPI_Alltoall ?"
> 
> /* since we share the same source code when building with or without mpi 
> profiling,
> that means we would need to
> #define MPI_Alltoall PMPI_Alltoall
> when ompi is configure'd with --enable-mpi-profile
> */

I'm guessing that the complexity in the build system to support environments 
without and with weak symbols (i.e., OS X vs. just about everyone else) have 
made this get lost over time.

Can you supply a patch?

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to