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. 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 (e.g., -listenersig=SIGUSR2, and rebuild mpich.