Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] meaning of MPI_THREAD_*
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-12-06 09:26:42

-----Original Message-----
From: "Tim Prince" [n8tm_at_[hidden]]
Date: 06/12/2010 01:40 PM
To: users_at_[hidden]
Subject: Re: [OMPI users] meaning of MPI_THREAD_*

>On 12/6/2010 3:16 AM, Hicham Mouline wrote:
>> Hello,
>> 1. MPI_THREAD_SINGLE: Only one thread will execute.
>> Does this really mean the process cannot have any other threads at all, even if they doen't deal with MPI at all?
>> I'm curious as to how this case affects the openmpi implementation?
>> Essentially, what is the difference between MPI_THREAD_SINGLE and MPI_THREAD_FUNNELED?
>> 2. In my case, I'm interested in MPI_THREAD_SERIALIZED. However if it's available, I can use MPI_THREAD_FUNNELED.
>> What cmake flags do I need to enable to allow this mode?
>> 3. Assume I assign only 1 thread in my program to deal with MPI. What is the difference between
>> int MPI::Init_thread(MPI_THREAD_SINGLE)
>> int MPI::Init_thread(MPI_THREAD_FUNNELED)
>> int MPI::Init()
>You're question is too broad; perhaps you didn't intend it that way.
>Are you trying to do something which may work only with a specific
>version of openmpi, or are you willing to adhere to portable practice?
>I. tend to believe what it says at

>A call to MPI_INIT has the same effect as a call to MPI_INIT_THREAD with
>a required = MPI_THREAD_SINGLE

>You would likely use one of those if all your MPI calls are from a
>single thread, and you don't perform any threading inside MPI. MPI
>implementations vary on the extent to which a higher level of threading
>than what is declared can be used successfully (there's no guarantee of
>bad results if you exceed what was set by MPI_INIT). There shouldn't
>be any bad effect from setting a higher level of thread support which
>you never use.

>I would think your question about cmake flags would apply only once you
>chose a compiler. I have never seen anyone try mixing
>auto-parallelization with MPI; that would require MPI_THREAD_MULTIPLE
>but still appears unpredictable. MPI_THREAD_FUNNELED is used often with
>OpenMP parallelization inside MPI.

>Tim Prince

Thanks, it is now clarified that a call to MPI_INIT has the same effect as a call to MPI_INIT_THREAD with
a required = MPI_THREAD_SINGLE. Perhaps it should be added here:
as well.
I try to remain portable but am using only openmpi at the moment.

It is still unclear to me the difference between MPI_THREAD_SINGLE and MPI_THREAD_FUNNELED.
Whether a program is or no multi threaded, if using MPI only from 1 thread (the one that calls MPI_INIT) would have no bearing on the mpi implementation, or?