LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Bernard Knaepen (bknaepen_at_[hidden])
Date: 2005-02-25 12:20:49


Thanks to all for the quick replies. I thought I had checked the documentation
thoroughly but I obviously overlooked those handle converters...

Bernard.

On Fri, 25 Feb 2005 12:08:22 -0500, Prabhanjan Kambadur
<pkambadu_at_[hidden]> wrote:
> As pointed out in the mail, the only "standard" way of calling C
> functions from fortran code and vice versa is by doing the appropriate
> conversions to and from fortran handles. This is done using various f2c
> and c2f functions. One pair of such functions is provided for each of
> the opaque types in MPI. The rationale behind this being that the MPI
> implementation is free to design the underlying infra-structure in any
> way they feel fit. Your code is not portable since it does not make use
> of these functions.
>
> For more information on these functions, see MPI-2 standard on Language
> interoperability issues (subsection "transfer of handles" : section
> 4.12.4) at
>
> http://www.mpi-forum.org/docs/mpi-20-html/node59.htm#Node59
>
> Regards,
> Anju
>
> On Feb 25, 2005, at 11:45 AM, Ed Zaron wrote:
>
> >
> > We have seen this with OS X where the LAM-MPI fortran bindings were
> > compiled with xlf and the main LAM-MPI was compiled with gcc.
> >
> > There are two functions MPI_Comm_f2c and MPI_Comm_c2f for doing this
> > conversion between C and Fortran communicator handles.
> >
> > Example of usage:
> >
> >
> > int *new_rect_comm_constructor_ (int **gr,
> > int *rank,
> > int *comm_f,
> > int *icnt,
> > int *jcnt,
> > int *kcnt){
> >
> > NewRectComm_t * rectcomm;
> > RectGraph_t * graph=(RectGraph_t *)(*gr);
> >
> > #ifdef LAM_MPI
> > MPI_Comm comm_c = MPI_Comm_f2c( (int)*comm_f);
> > #else
> > MPI_Comm comm_c = *comm_f;
> > #endif
> >
> > rectcomm=NewRectCommConstructor(graph,
> > *rank,
> > comm_c,
> > *icnt,
> > *jcnt,
> > *kcnt);
> >
> > #ifdef LAM_MPI
> > rectcomm->comm = MPI_Comm_c2f(rectcomm->comm_c);
> > #else
> > rectcomm->comm = rectcomm->comm_c;
> > #endif
> >
> > printf("new_rect_comm_constructor: comm_f = %i rectcomm->comm =
> > %i\n",*comm_f,(int)rectcomm->comm);
> >
> > return (int *)rectcomm;
> > }
> >
> >
> > ..............................................
> > Edward D. Zaron, PhD
> > Research Associate
> > College of Oceanic and Atmospheric Sciences
> > Oregon State University
> > Corvallis, OR 97331-5503
> > Phone: (541) 737-3504
> > Fax: (541) 737-2064
> > ezaron_at_[hidden]
> > ...............................................
> >
> > _______________________________________________
> > This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>