Issues in Developing a Thread-Safe MPI Implementation

  • William Gropp
  • Rajeev Thakur
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4192)


The MPI-2 Standard has carefully specified the interaction between MPI and user-created threads, with the goal of enabling users to write multithreaded programs while also enabling MPI implementations to deliver high performance. In this paper, we describe and analyze what the MPI Standard says about thread safety and what it implies for an implementation. We classify the MPI functions based on their thread-safety requirements and discuss several issues to consider when implementing thread safety in MPI. We use the example of generating new context ids (required for creating new communicators) to demonstrate how a simple solution for the single-threaded case cannot be used when there are multiple threads and how a naïve thread-safe algorithm can be expensive. We then present an algorithm for generating context ids that works efficiently in both single-threaded and multithreaded cases.


Message Passing Interface Error Handler Collective Function Reference Count Multithreaded Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Analysis of thread safety needs of MPI routines,
  2. 2.
    Demaine, E.D.: A threads-only MPI implementation for the development of parallel programs. In: Proc. of the 11th International Symposium on High Performance Computing Systems, July 1997, pp. 153–163 (1997)Google Scholar
  3. 3.
    García, F., Calderón, A., Carretero, J.: MiMPI: A multithread-safe implementation of MPI. In: Proc. of 6th European PVM/MPI Users’ Group Meeting, September 1999, pp. 207–214 (1999)Google Scholar
  4. 4.
    Lee, E.A.: The problem with threads. Computer 39(5), 33–42 (2006)CrossRefGoogle Scholar
  5. 5.
    Message Passing Interface Forum. MPI-2: Extensions to the Message-Passing Interface (July 1997),
  6. 6.
  7. 7.
    Plachetka, T.: Quasi- thread-safe PVM and (quasi-) thread-safe MPI without active polling. In: Proc. of 9th European PVM/MPI Users’ Group Meeting, September 2002, pp. 296–305 (2002)Google Scholar
  8. 8.
    Protopopov, B.V., Skjellum, A.: A multithreaded message passing interface (MPI) architecture: Performance and program issues. Journal of Parallel and Distributed Computing 61(4), 449–466 (2001)zbMATHCrossRefGoogle Scholar
  9. 9.
    Skjellum, A., Protopopov, B., Hebert, S.: A thread taxonomy for MPI. In: Proc. of the 2nd MPI Developers Conference, June 1996, pp. 50–57 (1996)Google Scholar
  10. 10.
    Tang, H., Yang, T.: Optimizing threaded MPI execution on SMP clusters. In: Proc. of the 15th ACM International Conference on Supercomputing, June 2001, pp. 381–392 (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • William Gropp
    • 1
  • Rajeev Thakur
    • 1
  1. 1.Mathematics and Computer Science DivisionArgonne National LaboratoryArgonneUSA

Personalised recommendations