[mpich-discuss] f77 bindings and profiling
Rajeev Thakur
thakur at mcs.anl.gov
Mon Nov 17 15:39:10 CST 2014
You need to add the right number of underscores at the end of the C function depending on the Fortran compiler you are using. For gfortran I think it is two underscores. So define the C function as mpi_init__. If that doesn't work, use one underscore. MPICH detects all this automatically at configure time.
Rajeev
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
_______________________________________________
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