Re: [OMPI devel] LD_PRELOAD a C-coded shared object with a FORTRAN application

2016-12-12 Thread Jeff Squyres (jsquyres)
Ah, sorry -- I didn't read your first post carefully. I would go with Gilles' suggestion: write trivial versions of MPI_Init / MPI_Finalize in Fortran, and then have them call your back-end C function to do whatever it is you want the intercepts to do. This will keep you out of all the portabi

Re: [OMPI devel] LD_PRELOAD a C-coded shared object with a FORTRAN application

2016-12-12 Thread George Bosilca
Indeed this is the best solution. If you really want a clean portable solution, take a look at any of the files in ompi/mpi/fortran/mpif-h directory, to see how we define the 4 different versions of the Fortran interface. George. On Mon, Dec 12, 2016 at 10:42 AM, Clement FOYER wrote: > Thank

Re: [OMPI devel] LD_PRELOAD a C-coded shared object with a FORTRAN application

2016-12-12 Thread Clement FOYER
Thank you all for your answers. I stayed with the C version, with the FORTRAN symbols added as it worked with the tests I was willing to start. Nevertheless, in order to keep a more proper/portable solution, is it possible to use the same tools as in ompi/mpi/fortran/mpif-h/init_f.c in order t

Re: [OMPI devel] LD_PRELOAD a C-coded shared object with a FORTRAN application

2016-12-12 Thread Jeff Squyres (jsquyres)
If your Fortran compiler is new enough (and it *probably* is...?), you can use the BIND(C) notation to ease C / Fortran interoperability issues. > On Dec 12, 2016, at 5:37 AM, Gilles Gouaillardet > wrote: > > Clement, > > Ideally, your LD_PRELOAD'able library should be written in Fortran so

Re: [OMPI devel] LD_PRELOAD a C-coded shared object with a FORTRAN application

2016-12-12 Thread Gilles Gouaillardet
Clement, Ideally, your LD_PRELOAD'able library should be written in Fortran so you do not even run into this kind of issues (name mangling + parameter types) If you really want to write it in C, you have to do it all manually SUBROUTINE MPI_INIT(ierror) INTEGER IERROR can become void mpi_init_