Using a Fortran Interface to Posix Threads
Pthreads is the library of POSIX standard functions for concurrent, multithreaded programming. The POSIX standard only defines an application programming interface (API) to the C programming language, not to Fortran. Many scientific and engineering applications are written in Fortran. Also, many of these applications exhibit functional, or tasklevel, concurrency. They would benefit from multithreading, especially on symmetric multiprocessors (SMP). We summarize here an interface to that part of the Pthreads library that is compatible with standard Fortran. The contribution consists of two primary source files: a Fortran module and a collection of C wrappers to Pthreads functions. The Fortran module defines the data structures, interface and initialization routines used to manage threads. The stability and portability of the Fortran API to Pthreads is demonstrated using common mathematical computations on three different systems.
This paper is a shortened and slightly modified version of a complete Algorithm submitted for publication to the journal ACM Trans. Math. Software, during July, 2000.
KeywordsPOSIX Threads Fortran scientific computing symmetric multiprocessor mathematical software barrier routine
- Adams, J. C., Brainerd, W. S., Martin, J. T., Smith, B. T., and Wagener, J. L. 1997. Fortran 95 Handbook. The MIT Press, Cambridge, MA.Google Scholar
- Butenhof, D. R. 1997. Programming with POSIX Threads. Addison-Wesley, Reading, MA.Google Scholar
- Butenhof, D. R. 1999. Personal communication.Google Scholar
- Hanson, R. J., Breshears, C. P., Gabb, H. A. “A Fortran Interface to POSIX Threads,” submitted to ACM Trans. Math. Software, during July, 2000.Google Scholar
-  IEEE. IEEE Standards Press, 1996. 9945-1:1996 (ISO/IEC)IEEE/ANSI Std 1003. 1 1996 Edition] Information Technology, Portable Operating System Interface (POSIX), Part 1: System Application: Program Interface (API) [C Language] (ANSI).Google Scholar
- Lewis, B. and Berg, D. J. 1998. Multithreaded Programming with Pthreads. Sun Microsystems Press, Mountain View, CA.Google Scholar
- Nichols, B., Buttlar, D., and Farrell, J. P. 1996. Pthreads Programming. O’Reilly and Associates, Sebastopol, CA.Google Scholar
- Snir, M., Otto, S., Huss-Lederman, S., Walker, D., and Dongarra, J. 1998. MPI The Complete Reference: Volume 1, the MPI Core. The MIT Press, Cambridge, MA.Google Scholar