[mpich-discuss] Right level of thread safety

Florian Lindner mailinglists at xgm.de
Tue Jun 26 04:26:01 CDT 2018


Hello,

I have a multi-threaded MPI application. Actually, only two threads. The main thread does all kinds of MPI operations,
the secondary thread, launched by std::thread does only MPI_Test, no other MPI operations.

What is the required level of thread safety?

According to https://www.mpich.org/static/docs/v3.1/www3/MPI_Init_thread.html

MPI_THREAD_SINGLE
    Only one thread will execute.

MPI_THREAD_FUNNELED
    The process may be multi-threaded, but only the main thread will make MPI calls (all MPI calls are funneled to the
main thread).

MPI_THREAD_SERIALIZED
    The process may be multi-threaded, and multiple threads may make MPI calls, but only one at a time: MPI calls are
not made concurrently from two distinct threads (all MPI calls are serialized).

MPI_THREAD_MULTIPLE
    Multiple threads may call MPI, with no restrictions.


its THREAD_MULTIPLE, since I can not synchronize the main threads MPI calls and MPI_Test from the other thread.

Is that perception correct? I am asking, because I think Test is a relatively small operations and probably read only
and therefore maybe a lower thread safety level suffices.

Thanks,
Florian
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list