Issues in Developing a Thread-Safe MPI Implementation
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.
KeywordsMessage Passing Interface Error Handler Collective Function Reference Count Multithreaded Program
Unable to display preview. Download preview PDF.
- 1.Analysis of thread safety needs of MPI routines, http://www.mcs.anl.gov/mpi/mpich2/developer/design/threadlist.htm
- 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.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
- 5.Message Passing Interface Forum. MPI-2: Extensions to the Message-Passing Interface (July 1997), http://www.mpi-forum.org/docs/docs.html
- 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
- 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.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