Boost logo

Boost-MPI :

Subject: Re: [Boost-mpi] openmpi 1.6.2 boost 1.54 mswin7 vs2010 Threading support:No
From: Matthias Troyer (troyer_at_[hidden])
Date: 2014-02-13 10:33:27


Hi,

In orders to use MPI in a multi-threaded environment, even when only one thread uses MPI, you need to request the necessary level of thread support in the environment constructor. Then you'd an check whether your MPI implementation supports multi threading. Note that using MPI the way you do need not work even though it seems safe at first sight. One reason is that your MPI implementation might use threads internally to support, e.g. nonblocking calls and those threads might not be compatible with your threads.

Matthias

> On Feb 13, 2014, at 16:22, MM <finjulhich_at_[hidden]> wrote:
>
> Apologies for the issue,
>
> I was getting output from the 2 processes, and their threads, and I was focused on only 1 process.
>
> Please ignore,
>
>
>> On 13 February 2014 14:33, MM <finjulhich_at_[hidden]> wrote:
>> Hello,
>>
>> I am running a MPI application on a single host, with a dual quadcore with hyperthreading on. (16 OS-visible processors), but just in debug mode (msvc2010) 32bit, with 2 mpi processes only.
>>
>> mpirun -mca btl_tcp_if_exclude lo -np 1 prog1.exe : -np 1 prog2.exe
>>
>> . when progr1.exe has 1 thread (mpi never initialized), everything works fine.
>> . when progr2.exe has 2 threads (1 thread with no call to mpi functions, and a second thread where mpi is initialized, through a default ctor of boost::mpi::environment, I think thos means just a call to MPI_Initialize() ), ompi_info gives "Threading support: No"
>>
>> 1. I start prog1, create addition thread boost::thread that handles MPI calls.
>> 2. proceed to a point where both thread1 and threadMPI, not concurrently, call a function f().
>> f() initializes a global const std::string* X=null, to a static, this X is visible from both threads.
>>
>> In fact, it appears at a certain point during a boost::mpi::broadcast, within threadMPI, boost::mpi calls MPI_Isend (point_to_point.cpp: 53), during this Isend, a 3rd thread (not threadMPI) is created and causes a call to f() which doesn't see X as !=nullptr.
>>
>> I can see this while debugging with msvc, and stepping into MPI_Isend (i don't have the sources for it). At that moment, suddenly a new thread is created, and a call to f() is made.
>>
>> This all sounds quite nightmarish.
>>
>> I understand I haven't presented any specific code to receive an accurate answer, but any help is appreciated.
>>
>> Regards,
>>
>> MM
>
> _______________________________________________
> Boost-mpi mailing list
> Boost-mpi_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-mpi



Boost-Commit list run by troyer at boostpro.com