[Mpi-forum] Threading guarantees of MPI_User_function

Jeff Hammond jeff.science at gmail.com
Thu May 25 11:55:54 CDT 2017


This is not necessary stated in the standard or guaranteed by it, it's just
my intuition...

I expect that MPI_User_function is invoked by the thread that invokes the
MPI function that uses it, and that you need a mutex to touch shared state
associated with MPI_User_function when running with MPI_THREAD_MULTIPLE,
but not otherwise.

I would hope that MPI implementations do not serialize calls to
MPI_User_function
in MPI_THREAD_MULTIPLE mode, because there are many cases where
MPI_User_function
is trivially reentrant and I would like simultaneous progress if I call
MPI_Allreduce concurrently from 2+ threads (with different communicators,
of course) with the same MPI_User_function.

Jeff

On Thu, May 25, 2017 at 9:35 AM, Phil Ruffwind <rf at rufflewind.com> wrote:

> Hello all,
>
> I have another question about MPI_User_function.  Does MPI make any
> guarantees regarding (a) whether multiple invocations of
> MPI_User_function could occur simultaneously within a given process for
> a given MPI_Op, and regarding (b) which thread MPI_User_function gets
> called on?
>
> The answer to (a) affects whether MPI_User_function would need any
> synchronization (like mutexes or semaphores) if it mutates global state.
>  The answer to (b) affects whether it is possible to use thread-local
> state inside MPI_User_function.
>
> I would appreciate any clarifications.  Thanks.
> Phil
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum
>



-- 
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20170525/04d2a76c/attachment.html>


More information about the mpi-forum mailing list