On Thursday 04 March 2010 01:32:39 Yuanyuan ZHANG wrote:
> Hi guys,
> Thanks for your help, but unfortunately I am still not clear.
> > You are right Dave, FUNNELED allows the application to have multiple
> > threads but only the man thread calls MPI.
> My understanding is that even if I use SINGLE or MPI_Init, I can still
> have multiple threads if I use OpenMP PARALLEL directive, and only
> the main thread makes MPI calls. Am I correct?
Actually if your application asks for MPI_THREAD_SINGLE, it specifies that it
won't use any thread, so you shouldn't use OpenMP threads. If you asked SINGLE
and use threads (even if only the main thread calls MPI) the behavior is
unspecified (we can imagine that some MPI implementation cannot support any
thread within the process for some reason).
> > An OpenMP/MPI hybrid program that makes MPI calls only in between
> > parallel sections is usually a FUNNELED user of MPI
> For an OpenMP/MPI hybrid program, if I only want to make MPI calls using
> the main thread, ie., only in between parallel sections, can I just use
> SINGLE or MPI_Init? What's the benefit of FUNNELED?
Asking for the FUNNELED thread-safety level informs the MPI library that your
application is going to run threads. If you ask for SINGLE, then you say "I
promise, I won't use any thread". The difference may be unclear from an
application developer point of view, but it is important from the MPI library
point of view.
However, I guess most modern MPI libraries support FUNNELED by default and the
performance should be the same for FUNNELED and SINGLE