Using a Fortran Interface to Posix Threads

  • Richard J. Hanson
  • Clay P. Breshears
  • Henry A. Gabb
Part of the IFIP — The International Federation for Information Processing book series (IFIPAICT, volume 60)


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.


POSIX Threads Fortran scientific computing symmetric multiprocessor mathematical software barrier routine 


  1. [1]
    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
  2. [2]
    Butenhof, D. R. 1997. Programming with POSIX Threads. Addison-Wesley, Reading, MA.Google Scholar
  3. [3]
    Butenhof, D. R. 1999. Personal communication.Google Scholar
  4. [4]
    Geist, A., Beguelin, A., Dongarra, J., Jiang, W., Manchek, R., and Sunderam, V. 1994. PVM: A Users’ Guide and Tutorial for Network Parallel Computing. The MIT Press, Cambridge, MA.zbMATHGoogle Scholar
  5. [5]
    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
  6. [6] 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
  7. [7]
    Lewis, B. and Berg, D. J. 1998. Multithreaded Programming with Pthreads. Sun Microsystems Press, Mountain View, CA.Google Scholar
  8. [8]
    Nichols, B., Buttlar, D., and Farrell, J. P. 1996. Pthreads Programming. O’Reilly and Associates, Sebastopol, CA.Google Scholar
  9. [9]
    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

Copyright information

© IFIP International Federation for Information Processing 2001

Authors and Affiliations

  • Richard J. Hanson
    • 1
  • Clay P. Breshears
    • 2
  • Henry A. Gabb
    • 2
  1. 1.Rice UniversityHoustonUSA
  2. 2.Kuck & Associates Inc., an Intel CompanyChampaignUSA

Personalised recommendations