Hi All, In porting an MPI application written mainly in Fortran and a little c to using mpi_f08 rather than mpi, I’ve hit an issue.
Namely, how would I write example 19.11 in the MPI 4 standard if the app uses type(MPI_Type) rather than integer? Note I’m working with an application, so the MPI_Type structure is opaque, or at least I thought we’re supposed to treat it as opaque. Here’s the example: Example 19.11 The example below illustrates how the Fortran MPI function MPI_TYPE_COMMIT can be implemented by wrapping the C MPI function MPI_Type_commit with a C wrapper to do handle conversions. In this example a Fortran-C interface is assumed where a Fortran function is all upper case when referred to from C and arguments are passed by addresses. ! FORTRAN PROCEDURE SUBROUTINE MPI_TYPE_COMMIT(DATATYPE, IERR) INTEGER :: DATATYPE, IERR CALL MPI_X_TYPE_COMMIT(DATATYPE, IERR) RETURN END /* C wrapper */ void MPI_X_TYPE_COMMIT(MPI_Fint *f_handle, MPI_Fint *ierr) { MPI_Datatype datatype; datatype = MPI_Type_f2c(*f_handle); *ierr = (MPI_Fint)MPI_Type_commit(&datatype); *f_handle = MPI_Type_c2f(datatype); return; } Now I suspect that most of the time if one has some old ‘c’ code assuming a pointer to a 4 byte fortran integer argument for the datatype is just going to work, but I’d rather not just try to be lucky. Anyway, there are fortran gurus on this project and they’d be sure to want a better solution. Thanks for any help/ideas, Howard — [signature_61897647] Howard Pritchard Research Scientist HPC-ENV Los Alamos National Laboratory howa...@lanl.gov [signature_577235141]<https://www.instagram.com/losalamosnatlab/>[signature_692833302]<https://twitter.com/LosAlamosNatLab>[signature_2019430084]<https://www.linkedin.com/company/los-alamos-national-laboratory/>[signature_231667440]<https://www.facebook.com/LosAlamosNationalLab/>
_______________________________________________ mpi-forum mailing list mpi-forum@lists.mpi-forum.org https://lists.mpi-forum.org/mailman/listinfo/mpi-forum