<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><span style="font-family:monospace">Brandon Cook raised an interesting issue w.r.t. user-defined reductions and Fortran 2008 in </span><a href="https://github.com/mpi-forum/mpi-issues/issues/576" target="_blank" style="font-family:monospace">https://github.com/mpi-forum/mpi-issues/issues/576</a><span style="font-family:monospace">.</span><br></div><div dir="ltr"><font face="monospace"><br>I looked at this and it appears we can do something better (<a href="https://github.com/mpi-forum/mpi-issues/issues/576#issuecomment-1317157138" target="_blank">https://github.com/mpi-forum/mpi-issues/issues/576#issuecomment-1317157138</a>), namely:<br><br> abstract interface<br><br> subroutine MPI_User_function_f18(invec, inoutvec, len, datatype)<br> use mpi_f08, only : MPI_Datatype<br> implicit none<br> type(*), dimension(..), target, intent(in) :: invec<br> type(*), dimension(..), target, intent(inout) :: inoutvec<br> integer, intent(in) :: len<br> type(MPI_Datatype), intent(in) :: datatype<br> end subroutine<br><br> end interface<br><br>which allows the user to create their own reduce functions, e.g.:<br><br> subroutine MY_function(invec, inoutvec, len, datatype)<br> use mpi_f08, only : MPI_Datatype<br> implicit none<br> real, dimension(:), target, intent(in) :: invec<br> real, dimension(:), target, intent(inout) :: inoutvec<br> integer, intent(in) :: len<br> type(MPI_Datatype), intent(in) :: datatype<br> inoutvec = inoutvec + invec<br> end subroutine<br><br>Do people think this is worth proposing for MPI-5? It would require a new MPI_Op_create function, but already did one for large-count.</font><div><font face="monospace"><br></font></div><div><font face="monospace">Also, can a proper Fortran language lawyer like Bill Long confirm that MY_function is compatible with the abstract interface above? Intel Fortran doesn't complain, but I want to be sure.<br></font><div><font face="monospace"><br></font></div><div><font face="monospace">Thanks!</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">Jeff</font></div><div><div><font face="monospace"><br>--<br>Jeff Hammond<br><a href="mailto:jeff.science@gmail.com" target="_blank">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/" target="_blank">http://jeffhammond.github.io/</a></font></div></div></div></div>
</div><div><br></div></div>