[mpich-discuss] MPI weak symbols and gfortran

Matthieu Dorier matthieu.dorier at irisa.fr
Sun Jan 19 04:00:43 CST 2014


Indeed, rewriting MPI_Init is not sufficient, rewriting mpi_init_ solves the problem. I thought that since mpi_init_ was using MPI_Init, rewriting only MPI_Init would be sufficient for fortran to use the overwritten version. Apparently not.

Thanks!

Matthieu Dorier 
PhD student at ENS Rennes 
http://people.irisa.fr/Matthieu.Dorier 

----- Mail original -----
> De: "Rajeev Thakur" <thakur at mcs.anl.gov>
> À: discuss at mpich.org
> Envoyé: Samedi 18 Janvier 2014 18:42:10
> Objet: Re: [mpich-discuss] MPI weak symbols and gfortran
> 
> The Fortran compiler adds an underscore (or two) to the function
> name. So the linker will be looking for MPI_Init_ . See the code in
> mpich/src/binding to see how MPICH handles this.
> 
> Rajeev
> 
> On Jan 18, 2014, at 7:44 AM, Matthieu Dorier
> <matthieu.dorier at irisa.fr>
>  wrote:
> 
> > Hi,
> > 
> > I've overwritten some MPI_* functions in a C library (typically
> > MPI_Init and MPI_Finalize). When I link a C program with this
> > library using gcc, the overwritten symbols are called correctly.
> > However when using a fortran program, it does not work: the
> > original functions are called. When I do "nm myprog" I see that
> > MPI_Init and PMPI_Init have the same address, which is not the
> > case with a C program. I also tried to compile the fortran program
> > into a .o file using gfortran, then use gcc to link it to mpich,
> > but I get the same result? Any workaround?
> > Thanks!
> > 
> > Matthieu Dorier
> > PhD student at ENS Rennes
> > http://people.irisa.fr/Matthieu.Dorier
> > _______________________________________________
> > discuss mailing list     discuss at mpich.org
> > To manage subscription options or unsubscribe:
> > https://lists.mpich.org/mailman/listinfo/discuss
> 
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
> 



More information about the discuss mailing list