<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Just to be clear on this, the MPI standard generally requires the user to enforce any synchronization needed when using threads with MPI, so Jeff’s answer is aligned with the standard.<div class=""><br class=""></div><div class="">Bill</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">William Gropp<br class="">Interim Director and Chief Scientist, NCSA<br class="">Thomas M. Siebel Chair in Computer Science<br class="">University of Illinois Urbana-Champaign</div><br class="Apple-interchange-newline"></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On May 25, 2017, at 1:49 PM, Phil Ruffwind <<a href="mailto:rf@rufflewind.com" class="">rf@rufflewind.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Thu, May 25, 2017, at 12:55, Jeff Hammond wrote:<br class=""><blockquote type="cite" class="">I expect that MPI_User_function is invoked by the thread that invokes the<br class="">MPI function that uses it, and that you need a mutex to touch shared<br class="">state<br class="">associated with MPI_User_function when running with MPI_THREAD_MULTIPLE,<br class="">but not otherwise.<br class=""><br class="">I would hope that MPI implementations do not serialize calls to<br class="">MPI_User_function<br class="">in MPI_THREAD_MULTIPLE mode, because there are many cases where<br class="">MPI_User_function<br class="">is trivially reentrant and I would like simultaneous progress if I call<br class="">MPI_Allreduce concurrently from 2+ threads (with different communicators,<br class="">of course) with the same MPI_User_function.<br class=""></blockquote><br class="">Thanks for clarifying.  In that case, I'll assume synchronization is<br class="">necessary.<br class="">_______________________________________________<br class="">mpi-forum mailing list<br class=""><a href="mailto:mpi-forum@lists.mpi-forum.org" class="">mpi-forum@lists.mpi-forum.org</a><br class="">https://lists.mpi-forum.org/mailman/listinfo/mpi-forum<br class=""></div></div></blockquote></div><br class=""></div></body></html>