[petsc-users] Fortran interfaces: Google Summer of Code project?

Martin Diehl martin.diehl at kuleuven.be
Fri Mar 22 06:03:00 CDT 2024


Dear All,

pls. find attached the proposal for
https://github.com/fortran-lang/webpage/wiki/GSoC-2024-Project-ideas.

I tried to keep it general such that we keep all options open.

Let me know if you want to change/add/remove anything and/or if you
want to be listed as mentor.

Since I've mixed up the deadline, the most urgent task is the finding
of suitable candidates. Once it's online, I'll post on linkedin but
ideally we can motivate someone who is already known.

best regards,
Martin

On Thu, 2024-03-21 at 23:13 -0600, Jed Brown wrote:
> Barry Smith <bsmith at petsc.dev> writes:
> 
> > > We already have the generated ftn-auto-interfaces/*.h90. The
> > > INTERFACE keyword could be replaced with CONTAINS (making these
> > > definitions instead of just interfaces), and then the bodies
> > > could use iso_c_binding to call the C functions. That would
> > > reduce repetition and be the standards-compliant way to do this.
> > 
> >    Sure, the interface and the stub go in the same file instead of
> > two files. This is slightly nicer but not significantly simpler,
> > and alone, it is not reason enough to write an entire new stub
> > generator.
> 
> I agree, but if one *is* writing a new stub generator for good
> reasons (like better automation/completeness), there's a case for
> doing it this way unless users really need an environment in which
> that feature can't be used.
> 
> > > What we do now with detecting the Fortran mangling scheme and
> > > calling conventions "works" but doesn't conform to any standard
> > > and there's nothing stopping Fortran implementations from
> > > creating yet another variant that we have to deal with manually.
> > 
> >    From practical experience, calling C/Fortran using non-standards
> > has only gotten easier over the last thirty-five years (fewer
> > variants on how char* is handled); it has not gotten more
> > complicated, so I submit the likelihood of "nothing stopping
> > Fortran implementations from creating yet another variant that we
> > have to deal with manually" is (though possible) rather unlikely.
> > As far as I am concerned, much of iso_c_binding stuff just solved a
> > problem that never really existed (except in some people's minds)
> > since calling C/Fortran has always been easy, modulo knowing a tiny
> > bit of information..
> 
> An examples for concreteness:
> 
> https://fortranwiki.org/fortran/show/Generating+C+Interfaces
> 
> And discussion:
> 
> https://fortran-lang.discourse.group/t/iso-c-binding-looking-for-practical-example-of-how-it-helps-with-mangling/3393/8
> 
> With this approach, one could even use method syntax like
> ksp%SetOperators(J, Jpre), as in the nlopt-f project linked in the
> top of this question. I don't know if we want that (it would be a
> huge change for users, albeit it "easy"), but generating stubs in
> Fortran using iso_c_binding opens a variety of possibilities for more
> idiomatic bindings.

-- 
KU Leuven
Department of Computer Science
Department of Materials Engineering
Celestijnenlaan 200a
3001 Leuven, Belgium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PETSc.md
Type: text/markdown
Size: 2570 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240322/62f0a0bf/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PETSc.pdf
Type: application/pdf
Size: 89431 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240322/62f0a0bf/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240322/62f0a0bf/attachment-0001.sig>


More information about the petsc-users mailing list