A FORTRAN77 Stub Library for OpenMP

OPENMP_STUBS is a FORTRAN77 library which constitutes a stub implementation of the OpenMP standard for shared memory parallel programming.

A stub library is useful when you want to try out a program on a system that does not have OpenMP, or when you need to have a formally complete program to analyze, or in other cases where you want to ignore the actual OpenMP library. A stub library can also help to understand the structure of the actual library.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


OPENMP_STUBS is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version.

Related Data and Programs:

DIJKSTRA_OPENMP, a FORTRAN77 program which uses OpenMP to parallelize a simple example of Dijkstra's minimum distance algorithm for graphs.

FFT_OPENMP, a FORTRAN77 program which demonstrates the computation of a Fast Fourier Transform in parallel, using OpenMP.

HEATED_PLATE_OPENMP, a FORTRAN77 program which solves the steady (time independent) heat equation in a 2D rectangular region, using OpenMP to run in parallel.

HELLO_OPENMP, a FORTRAN77 program which prints out "Hello, world!" using the OpenMP parallel programming environment.

MD_OPENMP, a FORTRAN77 program which carries out a molecular dynamics simulation using OpenMP.

MPI, FORTRAN77 programs which illustrate the use of MPI for doing parallel programming in a distributed memory environment, using message passing.

MULTITASK_OPENMP, a FORTRAN77 program which demonstrates how to "multitask", that is, to execute several unrelated and distinct tasks simultaneously, using OpenMP for parallel execution.

MXM_OPENMP, a FORTRAN77 program which computes a dense matrix product C=A*B, using OpenMP for parallel execution.

MXV_OPENMP, a FORTRAN77 program which compares the performance of plain vanilla Fortran and the FORTRAN90 intrinsic routine MATMUL, for the matrix multiplication problem y=A*x, with and without parallelization by OpenMP.

OPENMP, FORTRAN77 programs which use OpenMP directives and function calls to solve problems in parallel.

PRIME_OPENMP, a FORTRAN77 program which counts the number of primes between 1 and N, using OpenMP for parallel execution.

QUAD_OPENMP, a FORTRAN77 program which approximates an integral using a quadrature rule, and carries out the computation in parallel using OpenMP.

SATISFY_OPENMP, a FORTRAN77 program which demonstrates, for a particular circuit, an exhaustive search for solutions of the circuit satisfiability problem, using OpenMP for parallel execution.

SCHEDULE_OPENMP, a FORTRAN77 program which demonstrates the default, static, and dynamic methods of scheduling loop iterations in OpenMP to avoid work imbalance.

SGEFA_OPENMP, a FORTRAN77 program which reimplements the SGEFA/SGESL linear algebra routines from LINPACK for use with OpenMP.

ZIGGURAT_OPENMP, a FORTRAN77 program which demonstrates how the ZIGGURAT library can be used to generate random numbers in an OpenMP parallel program.


  1. Rohit Chandra, Leonardo Dagum, Dave Kohr, Dror Maydan, Jeff McDonald, Ramesh Menon,
    Parallel Programming in OpenMP,
    Morgan Kaufmann, 2001,
    ISBN: 1-55860-671-8,
    LC: QA76.642.P32.
  2. Barbara Chapman, Gabriele Jost, Ruud vanderPas, David Kuck,
    Using OpenMP: Portable Shared Memory Parallel Processing,
    MIT Press, 2007,
    ISBN13: 978-0262533027.
  3. OpenMP Architecture Review Board,
    OpenMP Application Program Interface,
    Version 3.1,
    July 2011.

Source Code:

Examples and Tests:

Note that these examples are normally run in parallel with OpenMP. The point being made here is that such programs can be run sequentially, as though OpenMP were available, by calling the OPENMP_STUBS library. They don't run well (fast) - it's just remarkable that they run at all.

COMPUTE_PI shows how information can be shared. Several processors need to compute pieces of a sum that will approximate pi.

HELLO is a very simple program which calls an OpenMP subroutine to set the number of threads, and then has each thread say hello;

HELMHOLTZ is a more extensive program that solves the Helmholtz equation on a regular grid, using a Jacobi iterative linear equation solver with overrelaxation;

List of Routines:

Again, please don't be confused. These routines have the same names as the real OpenMP library; they just don't do anything. Well, not much, anyway. They do just enough to let a program run in sequential mode.

You can go up one level to the FORTRAN77 source codes.

Last revised on 15 May 2012.