Re: [mpich-discuss] Wrapping routines with choice buffers from Fortran
Hi Joachim, Thanks for the hints. I handle the optional ierror argument like this: integer :: my_ierror call PMPI_Send(..., my_ierror) ! tool can use my_ierror if (present(ierror)) ierror = my_ierror If I read the test correctly, 'profile1f90.f90' checks whether mpi_send and mpi_recv are intercepted by the wrappers mpi_send_f08ts and mpi_recv_f08ts. My problem is that the calls to pmpi_send and pmpi_recv in these wrappers redirect to the C MPI_ functions and then also enter my C wrappers. Cheers, Gregor On 20.02.25 17:25, Joachim Jenke via discuss wrote:
Sorry, the mail was intended to be PM :/ Translation inline below
Am 20.02.25 um 17:16 schrieb Joachim Jenke via discuss:
Hallo Gregor,
beim gucken, was es dazu in mpich so gibt bin ich darüber gestolpert:
grepping trough MPICH source I found:
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?
Are you aware of the necessary present check?
- Joachim
- 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 [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss
_______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss
_______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss
participants (1)
-
Gregor Corbin