is SUN's implementation of MPI 5.0 multithreaded-safe?

is SUN's implementation of MPI 5.0 multithreaded-safe?

Post by Randy Crawfor » Wed, 28 Aug 2002 12:28:03

It says nothing about whether a particular Sun library is thread-safe.

The sentence says only that, if a library is thread-safe, then it will be
safe to call it from MPI.  That's obvious.  Calling a thread-safe function
from a threaded or a non-threaded program is always safe.  It's only
when a THREADED program calls a function that the function's thread
safety matters.

MPI is not multithreaded.  Therefore ALL library functions called from
MPI will have no problems with thread safety.  A more interesting
question is whether MPI functions may be called safely from inside a
multi-threaded program.  As long as all the MPI variables are declared
as global, it ought to be safe.  But each shared-memory computer is
different in its ability to maintain memory coherence.  It's possible that
some compilers on some machines may not recognize some MPI buffers
as aliased to global variables, and could introduce bugs.

In terms of MPI, when you run any MPI program, an MPI executive
process is created to manage the MPI processes -- creating them,
synchronizing I/O, scheduling processes, and reaping them.  The
executive MPI process (probably) is not threaded.  If you're having
problems making sense of MPI I/O output, it may be that the MPI
executive is poorly written, and it's buffering the output improperly,
and thereby, mixing and combining the characters when printing then
to the standard Unix streams such as stdout or stderr.

But this is unlikely, since each MPI process's I/O is generally maintained
separately throughout execution and combined in a coordinated manner
by the executive.


> Dear all,

> I am using SunOS5.8, with SUN's MPI 5.0 implementation
> installed in the machine. My question is: is this
> version of MPI multithreaded-safe?

> In SUN's document: SUN MPI 5.0 Programming and Reference
> Manual, it says:

> ...When you are linked to one of the thread-safe libraries,
> Sun MPI calls are thread safe...

> What does this mean?

> Any help appreciated.

> Yong

Randy Crawford


1. Solaris 2.6: 'Async safe' implies 'thread safe' ?


I'm currently involved in multithreaded development tasks on
Solaris 2.6 and trying to make sense of the MT attributes for
system/library calls.

Especially, I'm wondering wether 'time' can be called safely
in a multithreaded app.

On the manpage of 'time' I read
  | MT-Level      |  Async-Signal-Safe|

and for async-safety attributes(5) tells me

  Async-Signal-Safe refers to  particular  library
  routines that can be safely called from a signal
  handler.  A thread that is executing  an  Async-
  Signal-Safe   routine  will  not  deadlock  with
  itself if interrupted by a signal.  Signals  are
  only a problem for MT-Safe routines that acquire

  Signals are disabled when locks are acquired  in
  Async-Signal-Safe  routines.   This  prevents  a
  signal handler that might acquire the same  lock
  from being called.

Now, this description tells me that a thread calling
'time' won't deadlock in the call when interrupted
and that signals are disabled in 'time' whenever it
acquires locks.

It doesn't tell me wether any data can be corrupted
on reentering the call (i.e. is it 'Safe' ?) or wether
concurrency is provided (i.e. is it 'MT-Safe' ?).

Can anybody shed some light on this topic ?

Thanks a lot

2. jdk install w/o X11 or RPMs ?

3. Difference Between 'Safe' And 'MT-Safe' ML-Level

4. readvcd archive sites

5. Complete MPI std. implementation on LAM available.

6. Sequence for PPP ???

7. MPI implementation on Debian Linux

8. Linux routing problems

9. Safe Multithreaded Solaris

10. Implementations/Examples of "Multithreaded RPC server"?

11. To run MPI program using Sun studio cc option

12. Thread-safe Link-List implementation

13. 'malloc' and 'free' is MT-safe in linux ?