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_THREAD_INIT
From: George Bosilca (bosilca_at_[hidden])
Date: 2008-09-29 13:47:24


Gabriele,

If you want to write portable MPI applications then I think you should
stick with what the standard say. In other words for hybrid
programming, and if only one thread will make MPI calls you need
either MPI_THREAD_FUNNELED or MPI_THREAD_SERIALIZED.

Now, that being said, I don't know any operating systems nor MPI
implementations that make strong assumptions about this. Not anymore !
Usually the thread support is either ON or OFF. MPI_THREAD_MULTIPLE is
the only one that will activate the internal locks in the MPI library.
For every other mode, you have to make sure that at ANY moment only
one thread is making ANY kind of MPI calls.

MPI_THREAD_SINGLE Only one thread will execute.
MPI_THREAD_FUNNELED The task can 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 task can 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" by explicit application thread
                       synchronizations).
MPI_THREAD_MULTIPLE Multiple threads can call MPI with no
restrictions.

If you only need this as a temporary solution and if you only use Open
MPI, then MPI_THREAD_SINGLE should be enough if there is only one
thread making MPI calls at ANY moment. Looking at the example from
your original mail, as only the master thread call the MPI function
you are safe.

   george.

On Sep 29, 2008, at 11:03 AM, Gabriele Fatigati wrote:

> Hi George.
> So is it dangerous to use hybrid program ( MPI+OpenMP) without
> enable threads support?
>
> 2008/9/29 George Bosilca <bosilca_at_[hidden]>
> Gabriele,
>
> The thread support has to be explicitly requested at build time, or
> it will be disabled. Add --enable-mpi-threads (configure --help will
> give you more info) to your configure. If you plan to use threads
> with Open MPI I strongly suggest to update to the 1.3. This version
> is not yet released, but you can download the source from the
> nightly build section.
>
> george.
>
>
>
> On Sep 29, 2008, at 9:58 AM, Gabriele Fatigati wrote:
>
> Another question about MPI_INIT_THREAD.
>
> At the moment, as said, my OpenMPi version supports only level 0:
> MPI_THREAD_SINGLE. Suppose that i have this code:
>
> #pragma omp barrier
> #pragma omp master
> MPI_Send(buf,...);
> #pragma omp barrier
>
> Due my OpenMPI configuration, is it dangerous use this type of code?
> What does it means that OpenMPI doesn't support all thread levels of
> MPI_INIT_THREAD?
>
>
> 2008/9/29 Gabriele Fatigati <g.fatigati_at_[hidden]>
> Dear OpenMPi developers,
> i've noted that OpenMPI 1.25 and 1.2.6 version doesn't supports
> thread initialization function shows below:
>
> int MPI_Init_thread(int *argc, char *((*argv)[]), int required, int
> *provided)
>
> used in hybrid programming MPI+OpenMP. Returned vales provided is
> 0, so the unique thread level supported is MPI_THREAD_SINGLE.
>
> Whitch is the newest OpenMPI version that has full support for
> MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED, MPI_THREAD_SERIALIZED and
> MPI_THREAD_MULTIPLE?
>
> Thanks in advance.
>
> --
> Ing. Gabriele Fatigati
>
> CINECA Systems & Tecnologies Department
>
> Supercomputing Group
>
> Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
>
> www.cineca.it Tel: +39 051 6171722
>
> g.fatigati_at_[hidden]
>
>
>
> --
> Ing. Gabriele Fatigati
>
> CINECA Systems & Tecnologies Department
>
> Supercomputing Group
>
> Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
>
> www.cineca.it Tel: +39 051 6171722
>
> g.fatigati_at_[hidden]
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>
>
>
>
> --
> Ing. Gabriele Fatigati
>
> CINECA Systems & Tecnologies Department
>
> Supercomputing Group
>
> Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
>
> www.cineca.it Tel: +39 051 6171722
>
> g.fatigati_at_[hidden]
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users