From: Brian W. Barrett (bbarrett_at_[hidden])
Date: 2007-05-27 17:38:16


You're right, in v1.2 it will return MPI_THREAD_SINGLE (although it really
shouldn't). Some MPI implementations may do something different if you
request MPI_THREAD_FUNNELED instead of MPI_THREAD_SINGLE, so you should
continue to do that. A future version of Open MPI will return the
provided as MPI_THREAD_FUNNELED in that case instead of MPI_THREAD_SINGLE.
 But you can safely use two threads as you describe even with the provided
of MPI_THREAD_SINGLE.

Brian

> I tried with MPI_THREAD_FUNNELED but it still returns MPI_THREAD_SINGLE
> in "provided". I tried a sample program that has thread_0 doing MPI and
> thread_1 doing some computation and thread_0 and thread_1 doing some
> thread synchronization (using pthread condition variables). The program
> seems to be doing fine and so also the thread synchronization. I think,
> even if MPI_THREAD_SINGLE is returned in provided, such a design works.
> Now, since the thread synchronization seems to be fine, I think multiple
> threads (with only one thread executing MPI calls) works even if
> "provided" returns MPI_THREAD_SINGLE.
>
> -Thanks and Regards,
> Sarang.
>
> Quoting "Brian W. Barrett" <bbarrett_at_[hidden]>:
>
>> If only one thread ever makes calls into MPI, you don't actually
>> need
>> MPI_THREAD_MULTIPLE but only MPI_THREAD_FUNNELED. Open MPI will
>> generally
>> support MPI_THREAD_FUNNELED out of the box (but on certain
>> configurations,
>> mainly platforms without threads, will not), so if you request
>> MPI_THREAD_FUNNELED, it should be returned in provided.
>>
>> Good luck,
>>
>> Brian
>>
>> > Thanks a lot guys for your help. I am also trying a design where I
>> have
>> > one thread doing MPI and others doing some computation (non-MPI).
>> If I
>> > have only MPI_THREAD_SINGLE enabled for OpenMPI, can I still
>> implement
>> > this kind of a design or there would be issues with threads in
>> OpenMPI.
>> >
>> > -Thanks and Regards,
>> > Sarang.
>> >
>> > Quoting "Brian W. Barrett" <bbarrett_at_[hidden]>:
>> >
>> >> There are two ways you can find out if an Open MPI build has
>> >> MPI_THREAD_MULTIPLE support:
>> >>
>> >> * On the command line: You can run "ompi_info | grep Thread". If
>> you
>> >> see
>> >> mpi: no, the build doesn't support MPI_THREAD_MULTIPLE. If you
>> see
>> >> mpi:
>> >> yes, the build does support MPI_THREAD_MULTIPLE.
>> >>
>> >> * At run-time. As mentioned below, if you request
>> >> MPI_THREAD_MULTIPLE and
>> >> provided is only MPI_THREAD_SINGLE, then Open MPI does not have
>> >> MPI_THREAD_MULTIPLE support.
>> >>
>> >>
>> >> Good luck,
>> >>
>> >> Brian
>> >>
>> >> > You are already there. the fact that MPI_Thread_init only
>> provide
>> >> > MPI_THREAD_SINGLE shows that MPI_THREAD_MULTIPLE is NOT enabled
>> in
>> >> the
>> >> > library binary that you're using. Although MPI_THREAD_MULTIPLE
>> is
>> >> > implemented in the library source code, it is only lightly
>> tested,
>> >> so it
>> >> > is
>> >> > not enabled by default.
>> >> >
>> >> > To enable MPI_THREAD_MULTIPLE, you need to recompile the library
>> by
>> >> first
>> >> > including --enable-mpi-threads as one of the parameters when you
>> >> rerun
>> >> > ./configure as the first step of recompiling the library.
>> >> >
>> >> >
>> >> >
>> >> > On 5/27/07, smairal_at_[hidden] <smairal_at_[hidden]> wrote:
>> >> >>
>> >> >> Hi,
>> >> >> I want to use threads with OpenMPI such that the
>> threads
>> >> would
>> >> >> be able to call MPI functions. For this purpose, I am using
>> >> >> MPI_Init_thread with MPI_THREAD_MULTIPLE option. But this
>> function
>> >> call
>> >> >> returns MPI_THREAD_SINGLE in the "provided" parameter
>> indicating
>> >> that
>> >> >> MPI_THREAD_MULTIPLE is not configured. Somewhere it is
>> mentioned
>> >> that
>> >> >> OpenMPI needs to be configured with --enable-mpi-threads
>> inorder
>> >> to use
>> >> >> MPI_THREAD_MULTIPLE. If true, is it possible to know whether
>> the
>> >> >> OpenMPI (1.1.2)which I have already configured, has the option
>> >> >> "--enable-mpi-threads" already configured or not? Also, how
>> easy
>> >> or
>> >> >> difficult is it to configure --enable-mpi-threads option?
>> >> >> Please share some information on this.
>> >> >>
>> >> >> -Thanks and Regards,
>> >> >> Sarang.
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> 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
>> >>
>> >> _______________________________________________
>> >> users mailing list
>> >> users_at_[hidden]
>> >> http://www.open-mpi.org/mailman/listinfo.cgi/users
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>
>
>