Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI_Init() and MPI_Init_thread()
From: Dave Goodell (goodell_at_[hidden])
Date: 2010-03-04 11:16:29


On Mar 4, 2010, at 7:36 AM, Richard Treumann wrote:
> A call to MPI_Init allows the MPI library to return any level of
> thread support it chooses.
>
This is correct, insofar as the MPI implementation can always choose
any level of thread support.
> This MPI 1.1 call does not let the application say what it wants and
> does not let the implementation reply with what it can guarantee.
>
Well, sort of. MPI-2.2, sec 12.4.3, page 385, lines 24-25:

------8<------
24| A call to MPI_INIT has the same effect as a call to
MPI_INIT_THREAD with a required
25| = MPI_THREAD_SINGLE.
------8<------

So even though there is no explicit request and response for thread
level support, it is implicitly asking for MPI_THREAD_SINGLE. Since
all implementations must be able to support at least SINGLE (0 threads
running doesn't really make sense), SINGLE will be provided at a
minimum. Callers to plain-old "MPI_Init" should not expect any higher
level of thread support if they wish to maintain portability.

[...snip...]
> Consider a made up example:
>
> Imagine some system supports Mutex lock/unlock but with terrible
> performance. As a work around, it offers a non-standard substitute
> for malloc called st_malloc (single thread malloc) that does not do
> locking.
>
[...snip...]

Dick's example is a great illustration of why FUNNELED might be
necessary. The moral of the story is "don't lie to the MPI
implementation" :)

-Dave