[mpich-discuss] f77 bindings and profiling
Balaji, Pavan
balaji at anl.gov
Mon Nov 17 15:35:56 CST 2014
Florin,
What version of MPICH are you using? There should be an -lmpifort in the library list. Here’s what I get with mpich-3.2a2, which is correct:
% mpif77 -show ./examples/f77/fpi.f
/usr/local/bin/gfortran -Wl,-flat_namespace ./examples/f77/fpi.f -I/usr/local/Cellar/mpich2/3.1.3/include -I/usr/local/Cellar/mpich2/3.1.3/include -L/usr/local/Cellar/mpich2/3.1.3/lib -lmpifort -lmpi -lpmpi
% PROFILE_PRELIB=-lfoo mpif77 -show ./examples/f77/fpi.f
/usr/local/bin/gfortran -Wl,-flat_namespace ./examples/f77/fpi.f -I/usr/local/Cellar/mpich2/3.1.3/include -I/usr/local/Cellar/mpich2/3.1.3/include -L/usr/local/Cellar/mpich2/3.1.3/lib -lmpifort -lfoo -lmpi -lpmpi
In the latter case, the Fortran symbols are in the libmpifort library, which uses libfoo when it tries to find the corresponding C symbols.
— Pavan
> On Nov 17, 2014, at 3:28 PM, Isaila, Florin D. <fisaila at mcs.anl.gov> wrote:
>
> Hi ,
>
> I am trying to use MPI profiling to make mpi_init from a F77 program call my MPI_Init (written in C), but I do not manage to achieve that. In this simple F77 program:
> program main
> include 'mpif.h'
> integer error
> call mpi_init(error)
> call mpi_finalize(error)
> end
>
> I try to make the mpi_init call:
> int MPI_Init (int *argc, char ***argv){ int ret;
> printf("My function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
> ret = PMPI_Init(argc, argv);
> return ret;
> }
>
> My MPI_Init belongs to a library libtarget.a I created. I use -profile for compiling and I created the target.conf containing:
> PROFILE_PRELIB="-L/homes/fisaila/benches/try/staticlib_mpif77 -ltarget"
> in the right place.
>
> The library appears in the command line before the mpich library:
> mpif77 -show -g -profile=target init_finalize.f -o init_finalize
> gfortran -g init_finalize.f -o init_finalize -I/homes/fisaila/software/mpich/include -L/homes/fisaila/software/mpich/lib -L/homes/fisaila/benches/try/staticlib_mpif77 -ltarget -Wl,-rpath -Wl,/homes/fisaila/software/mpich/lib -lmpich -lopa -lmpl -lrt -lpthread
>
> However, the program never gets into my MPI_Init.
>
> Any suggestion about what I am missing?
>
> Thanks
> Florin
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> discuss mailing list discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
--
Pavan Balaji ✉️
http://www.mcs.anl.gov/~balaji
_______________________________________________
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