[mpich-discuss] Is MPI thread-safe?

Darius Buntinas buntinas at mcs.anl.gov
Tue Aug 7 14:01:36 CDT 2012


Yup, that should work fine.  Note that you'll need to use MPI_Init_thread rather than MPI_Init if you're using threads.  Check the documentation on MPI_Init_thread to learn about the different MPI thread levels.

-d

On Aug 7, 2012, at 1:55 PM, Matthieu Dorier wrote:

> Hello,
> 
> I'd like to know if MPI (an more particularly Mpich2) is thread safe. What I mean by that is: if I use MPI_Comm_dup to create a copy of MPI_COMM_WORLD, and from each MPI process, I start 2 threads, one communicating through the original communicator and the second communicating through the copy, will it work fine or will possibly a thread of the second group accidentally receive messages from the first group?
> 
> (So far my only experience of hybrid MPI/thread programming was in a case where communication was done after the threads join, not by multiple threads).
> 
> Thanks,
> 
> Matthieu Dorier
> PhD student at ENS Cachan Brittany and IRISA
> http://people.irisa.fr/Matthieu.Dorier
> _______________________________________________
> mpich-discuss mailing list     mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss



More information about the mpich-discuss mailing list