<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Gregor,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for bring up the Fortran profiling interface issue. Admittedly, we have not discussed such issues thoroughly yet. I believe the truth lies in the consensus and you are the first real user I hear from 😉 .<br>
<br>
Yes, it appears that the Fortran PMPI_ should call C PMPI_ functions to avoid double profiling. Opinions?</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hui</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Gregor Corbin via discuss <discuss@mpich.org><br>
<b>Sent:</b> Thursday, February 20, 2025 9:56 AM<br>
<b>To:</b> discuss@mpich.org <discuss@mpich.org><br>
<b>Cc:</b> Gregor Corbin <g.corbin@fz-juelich.de><br>
<b>Subject:</b> [mpich-discuss] Wrapping routines with choice buffers from Fortran</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi everyone,<br>
<br>
I am developing a set of wrappers for the C and Fortran 2008 ('use <br>
mpi_f08') bindings. The F08 wrappers are intercepting the Fortran <br>
routines, for instance<br>
<br>
subroutine mpi_send_f08ts_(buf, count, datatype, dest, tag, comm, <br>
ierror)<br>
use :: mpi_f08, only: MPI_Comm, MPI_Datatype, PMPI_Send<br>
implicit none<br>
! argument declarations ...<br>
! wrapper code ...<br>
call PMPI_Send(buf, count, datatype, dest, tag, comm, ierror)<br>
end subroutine<br>
<br>
<br>
In MPICH, the call to PMPI_Send is forwarded to MPIR_Send_cdesc which <br>
then calls MPI_Send internally. Since I also wrap MPI_Send in C, calls <br>
from Fortran go through both wrappers, which is not intended. This only <br>
happens for routines with choice buffers, though. Routines without <br>
buffers call into the PMPI interface (e.g. mpi_wait_f08_ calls <br>
MPIR_Wait_c which binds directly to PMPI_Wait). I attached a small <br>
example that demonstrates the issue.<br>
<br>
Is this behavior intended? How can I correctly wrap these choice buffer <br>
routines?<br>
<br>
Best,<br>
<br>
Gregor Corbin<br>
<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>