On 13 February 2014 15:33, Matthias Troyer <troyer_at_[hidden]> wrote:
> 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
> So in my case, as I have a main thread that doesn't call MPI, and another
purposely created user thread to call MPI lib, the mode is
as boost 1.54 doesn't have the level in the enviroment ctor, I need to
explicitly call the underlying MPI::Init_thread(MPI_THREAD_FUNNELED).
once I move to 1.55, I'll use the env ctor.