LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2004-10-20 06:50:51


On Oct 19, 2004, at 7:33 PM, Andy Tarpley wrote:

>> You can also do stuff like allow MPI_COMM_ACCEPT to block in a thread
>> while your app goes off and does other stuff. This allows so fairly
>> interesting scenarios.
>
> I thought I was already doing this in LAM. Is this only possible in
> Open MPI?

Allowing MPI_COMM_ACCEPT to block can be done with LAM. Having other
threads concurrently doing other things in MPI is not possible in LAM;
LAM is a single-threaded MPI implementation that will... ahem...
"behave badly" if you try to have multiple threads in MPI functions at
the same time. :-)

More specifically, LAM was not designed for concurrent multithreading.
It would take a Herculean effort to make it both thread safe and thread
concurrent (which is one of the reasons we started over with Open MPI
-- it's thread safe/concurrent from it's original design).

> One other question:
> Imagine my scenario from before. My system consist of multiple
> Services, all of which may be connected to other Services through MPI.
> When each Service starts up, I launch a thread to start trying to do
> an MPI_COMM_ACCEPT so connections can be made with other Services.
> However, after the accept thread is running and I try and actually
> *connect* with another Service (with the main thread), something
> doesn't work (I get a lamd kernel error). I take it this is because I
> am working with threads.

This is quite possible. The behavior of LAM is going to be undefined
if you use multiple threads concurrently in MPI functions. Getting a
lamd kernel error is not out of the question here (I can explain if you
care).

> In this scenario, is Open MPI required? I am not currently using
> MPI_Init_thread, maybe I should look into this. Any advice in this
> endeavor?

If you want to use multiple threads in an MPI application in the way
that you have described, you are supposed to use MPI_INIT_THREAD and
request MPI_THREAD_MULTIPLE. LAM will never return a value higher than
MPI_THREAD_SERIALIZED, meaning that it will put a mutex around every
MPI function (enforcing thread serialization). Open MPI supports
MPI_THREAD_MULTIPLE (one of our SC demos is similar to the scenario
that you describe), but, alas, it is not yet available to the public
(we're still working hard on the code!).

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/