[mpich-discuss] Wrapping routines with choice buffers from Fortran

Joachim Jenke jenke at itc.rwth-aachen.de
Thu Feb 20 10:16:10 CST 2025


Hallo Gregor,

beim gucken, was es dazu in mpich so gibt bin ich darüber gestolpert:

https://github.com/pmodels/mpich/blob/main/test/mpi/f08/profile/profile1f90.f90#L70

Hast du den present check für ierr auf dem Schirm?

- Joachim

Am 20.02.25 um 16:56 schrieb Gregor Corbin via discuss:
> Hi everyone,
> 
> I am developing a set of wrappers for the C and Fortran 2008 ('use 
> mpi_f08') bindings. The F08 wrappers are intercepting the Fortran 
> routines, for instance
> 
>      subroutine mpi_send_f08ts_(buf, count, datatype, dest, tag, comm, 
> ierror)
>          use :: mpi_f08, only: MPI_Comm, MPI_Datatype, PMPI_Send
>          implicit none
>          ! argument declarations ...
>          ! wrapper code ...
>          call PMPI_Send(buf, count, datatype, dest, tag, comm, ierror)
>      end subroutine
> 
> 
> In MPICH, the call to PMPI_Send is forwarded to MPIR_Send_cdesc which 
> then calls MPI_Send internally. Since I also wrap MPI_Send in C, calls 
> from Fortran go through both wrappers, which is not intended. This only 
> happens for routines with choice buffers, though. Routines without 
> buffers call into the PMPI interface (e.g. mpi_wait_f08_ calls 
> MPIR_Wait_c which binds directly to PMPI_Wait). I attached a small 
> example that demonstrates the issue.
> 
> Is this behavior intended? How can I correctly wrap these choice buffer 
> routines?
> 
> Best,
> 
> Gregor Corbin
> 
> 
> 
> 
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss


-- 
Dr. rer. nat. Joachim Jenke

IT Center
Group: High Performance Computing
Division: Computational Science and Engineering
RWTH Aachen University
Seffenter Weg 23
D 52074  Aachen (Germany)
Tel: +49 241 80- 24765
Fax: +49 241 80-624765
jenke at itc.rwth-aachen.de
www.itc.rwth-aachen.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6140 bytes
Desc: Kryptografische S/MIME-Signatur
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20250220/6a1b7366/attachment-0001.p7s>


More information about the discuss mailing list