The mpich implementation of MPI is currently not threadsafe. It may,
however, be possible to use mpich in a threaded application as long as all
mpich calls are made by a single thread. An example of this is
OpenMP used for loop parallelism, combined with MPI.
However, you may run into some
problems with signals. Many thread packages make use of signals such as
SIGUSR1 and/or SIGUSR2. By default, the ch_p4 device
uses SIGUSR1. If you are using mpich with a thread package that uses
SIGUSR1, you will need to reconfigure, adding the argument
-listenersig=SIGNAL NAME to the --with-device=ch_p4 line and
rebuild mpich. For example,
./configure --with-device=ch_p4:-listenersig=SIGUSR2 make