Adrian,
I have updated the branch barry/fortran-PetscSFBcastBegin to support using Fortran datatypes and PetscSFGetGraph() Please let me know of additional difficulties. Barry > On Oct 24, 2017, at 6:58 AM, Jed Brown <j...@jedbrown.org> wrote: > > Lawrence Mitchell <wen...@gmail.com> writes: > >>> On 24 Oct 2017, at 06:21, Barry Smith <bsm...@mcs.anl.gov> wrote: >>> >>>>>> - With PetscSFBcastBegin() / PetscSFBcastEnd() you currently still have >>>>>> to use the C MPI types in the Fortran calling code, rather than the >>>>>> Fortran ones. I think it is a bit confusing to have to mix the two up in >>>>>> the same code. If you put MPI_INTEGER instead of MPI_INT for example, it >>>>>> dies in F90Array1dAccess() with 'unsupported MPI_Datatype'. Could the >>>>>> Fortran MPI types be supported in these routines just by adding them as >>>>>> alternatives into the conditionals? >>>>> Hmm, Jed will need to provide wisdom the Linux manual page for >>>>> MPI_INTEGER clearly states: >>>>> >>>>> Note that the Fortran types should only be used in Fortran programs, and >>>>> the C types should only be used in C programs. For example, it is in >>>>> error to use MPI_INT for a Fortran INTEGER. Datatypes are of type >>>>> MPI_Datatype in C and of type INTEGER in Fortran. >>>>> >>>>> If this is true then there is no place we can do the change properly. >>>> >>>> Yes, I first thought that MPI_Type_f2c() would convert Fortran MPI >>>> datatypes to the C ones (e.g. turn MPI_INTEGER into MPI_INT), so that the >>>> C side of the interface wouldn't have to worry about the Fortran MPI >>>> datatypes, but it doesn't really seem to do that. >>> >>> Do did I. Its existence seems to contradict the statement in the Linux >>> manual page. Well wait for Jed. >> >> A fortran INTEGER may have a different width to a C int. Hence the >> distinction. The MPI_XXX_f2c functions convert handles on the fortran side >> to handles on the C side (MPI_XXX_c2f does the opposite). Perhaps the >> standard sheds some light: >> >> Moving handles from Fortran to C >> >> http://mpi-forum.org/docs/mpi-3.1/mpi31-report/node446.htm#Node446 > > Thanks, Lawrence. And my recollection is that the C types are > guaranteed to exist if the MPI was built to support Fortran, but may not > be defined otherwise. So PETSc uses it in code that is only compiled > when Fortran is available, it should all work. > >> Interlanguage communication >> >> http://mpi-forum.org/docs/mpi-3.1/mpi31-report/node456.htm#Node456 >> >> Lawrence