Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Thread safety levels
From: Eugene Loh (eugene.loh_at_[hidden])
Date: 2010-05-10 10:35:23


N.M. Maclaren wrote:

>> On May 10 2010, Kawashima wrote:
>
>> If we use OpenMP with MPI, we need at least MPI_THREAD_FUNNELED even
>> if MPI functions are called only outside of omp parallel region,
>> like below.
>>
>> #pragma omp parallel for
>> for (...) {
>> /* computation */
>> }
>> MPI_Allreduce(...);
>> #pragma omp parallel for
>> for (...) {
>> /* computation */
>> }
>
> I don't think that's correct. That would call MPI_Allreduce once for
> each thread, in parallel, on the same process - which wouldn't work.

Just a minor nit: The code above calls MPI_Allreduce outside of
parallel regions rather than specifying that each OMP thread should make
the call in parallel. But, don't let that nit be a distraction from the
rest of the e-mail conversation.