[petsc-dev] PetscSF in Fortran

Barry Smith bsmith at mcs.anl.gov
Fri Oct 20 21:54:05 CDT 2017


> On Oct 20, 2017, at 8:09 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
>>> On Oct 20, 2017, at 12:31 PM, Jed Brown <jed at jedbrown.org> wrote:
>>> 
>>> Barry Smith <bsmith at mcs.anl.gov> writes:
>>> 
>>>>  Adrian,
>>>> 
>>>>   You should not use F90Array1d *rptr as arguments in the Fortran interface. You should just use a regular Fortran one dimensional array of real/scalar.
>>>> Fortran doesn't handle polymorphism in this way at all. You have to have multiple f90 interfaces, one for each type and provide a C stub for real, int, or whatever else you want to send.
>>> 
>>> Barry, look at the "use mpi_f08" way of calling MPI from Fortran.
>> 
>>  Jed,
>> 
>>   Rather terse response. 
>> 
>>   Are you suggesting in PETSc we use type(*) to manage multiple types through the same function?  Looks doable, I wasn't aware of this. This could possibly reduce a lot of code duplication we currently have. 
> 
> PetscSF uses MPI type handling and thus it would make sense to use a
> similarly designed Fortran module.
> 
>>   Still I would like to get rid of the use PetscDataType rather than write new code that uses it.
>> 
>>   I need to think more in this case.
>> 
>>   Waiting to hear from Adrian what types he needs to pass around (use of PetscDataType restricts to built in MPI datatypes regardless of what Fortran interface approach we use
> 
> What does that has to do with PetscSF, which never used PetscDataType
> and uses MPI datatypes with support for derived types (albeit with a
> limited number of combiners)?

   Because the code he started to write uses F90Array1dAccess() which is built around PetscDataType, hence he needs to convert the MPI_Datatype. Which is where all the trouble comes from. There are multiple ways of resolving his problem, it more depends on my time then anything else since it is unlikely anyone but you or I will "fix" this, and you don't have time.

   

  Barry






More information about the petsc-dev mailing list