[mpich-discuss] Advice on thread support

Lawrence Stewart larry.stewart at sicortex.com
Wed Jan 7 12:20:19 CST 2009

Nicolas Rosner wrote:
> Hello all,
> I'm considering a threads-based approach to solve a problem in my C++
> MPI design.  I do know what threads are, and have written a few
> programs that use multiple threads in languages like Java or Python,
> but I don't have any experience with POSIX threads, or any other
> flavor of a threads lib in C++, let alone mixing threads with MPI
> code.  Furthermore, my idea would need different threads (well, at
> least two of them) to be able to call MPI primitives independently,
> thus requiring MPI_THREAD_MULTIPLE mode.
> Since some of the documents I've been reading about this matter seem
> to contradict each other (perhaps because some of them are older than
> others, or because my interpretation of them was incorrect due to
> ignorance of some details, or all of the above), I thought I'd ask you
> a few questions:
> - Does the current version of MPICH2 support threads in MULTIPLE mode?
>  Is said support stable/reliable?
> - What about MPICH2 1.0.7?  (The two clusters I'm currently using for
> test and production purposes are still at that version, and their
> maintenance is beyond my control; I guess I could install 1.0.8 in
> user space, and use that instead, but it would be nice to know if that
> will be necessary or 1.0.7 is recent enough.)
> - What about MVAPICH?  (We intend to run experiments on a cluster with
> an InfiniBand switch next month.)
> - What about other MPI implementations?  Generally speaking, would you
> say such support is reasonably widespread?
> Not that I'm planning to move away from MPICH anytime soon -- I'm very
> satisfied with it so far, and it's what most systems down here seem to
> be using anyway.  But our original decision to use MPI was driven by
> portability; in particular, we're still trying to gain access to some
> newer, more powerful clusters, and would like our program to be able
> to run on them with few or no modifications.
> (Actually, small changes wouldn't be a major concern, since deployment
> on a new cluster is by no means a frequent event. But it would be a
> problem if we decided to add MPI_THREAD_MULTIPLE support as a strict
> requirement, only to end up realizing, later on, that too many
> potential clusters don't provide it at all.)
> Thanks in advance for your opinion and any comments that might be of help.
> Regards (and happy 2009!),
> Nicolás Rosner
> Universidad de Buenos Aires
> Argentina
I have not heard that hybrid codes (part threaded and part MPI) have any 
performance advantage over pure MPI. I have heard that they have 
substantial complexity disadvantages.  Besides, it seems to be necessary 
to slow down MPI in order to add the locking to make THREAD_MULTIPLE 
work, which is an additional performance problem charged against the 
hybrid approach.

-Larry / Sector IX

More information about the mpich-discuss mailing list