[petsc-dev] PetscSF in Fortran
Barry Smith
bsmith at mcs.anl.gov
Mon Oct 23 23:21:12 CDT 2017
> On Oct 23, 2017, at 11:11 PM, Adrian Croucher <a.croucher at auckland.ac.nz> wrote:
>
> hi
>
>
> On 24/10/17 17:00, Barry Smith 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.
>
> - Adrian
>
> --
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz
> tel: +64 (0)9 923 4611
>
More information about the petsc-dev
mailing list