OPEN_MP_STUBS
A C "Stub" Library for OpenMP
OPEN_MP_STUBS is a C library of routines which constitute a
"stub" implementation of the OpenMP 2.5 standard.
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.
Related Data and Programs:
MPI
is a library of routines for doing parallel programming in a distributed memory
environment, using message passing.
OPEN_MP
is a directory of C examples which
illustrate the use of the OpenMP application program interface
for carrying out parallel computations in a shared memory environment.
OPEN_MP_ECLIPSE
is a set of examples for running C++ OpenMP programs on Eclipse,
an IBM SP cluster that was once available at FSU.
OPEN_MP_STUBS is also available in
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version.
PESSL
is a parallel mathematical library for use on IBM SP systems.
PETSC
is a scientific library for parallel computations.
Reference:
-
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.
-
Barbara Chapman, Gabriele Jost, Ruud vanderPas, David Kuck,
Using OpenMP: Portable Shared Memory Parallel Processing,
MIT Press, 2007,
ISBN13: 978-0262533027.
-
Tim Mattson, Rudolf Eigenmann,
OpenMP: An API for Writing Portable SMP Application Software,
a slide presentation,
open_mp_slides.pdf.
-
libgomp.pdf,
The GNU OpenMP Implementation.
-
The OpenMP web site
-
OpenMP Application Program Interface,
Version 2.5,
May 2005,
open_mp_2.5.pdf
Source Code:
-
open_mp_stubs.c, the source code.
-
open_mp_stubs.csh,
commands to compile the source code.
-
open_mp_stubs.h,
a simple "include" file that declares the type of the
functions that are part of the library. An OpenMP code
will probably be looking for a file called "omp.h" instead.
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 OPEN_MP_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;
-
hello.c,
the source code;
-
hello.sh,
BASH commands to compile, link, load and run the program
with the OPEN_MP_STUBS library.
-
hello_output.txt,
the output file;
HELMHOLTZ is a program that solves
the Helmholtz equation on a rectangular grid, using Jacobi iteration
with overrelaxation;
MD is a time dependent molecular dynamics code;
-
md.c,
the source code;
-
md.sh,
BASH commands to compile, link, load and run the program
with the OPEN_MP_STUBS library.
-
md_output.txt,
the output file;
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.
-
OMP_DESTROY_LOCK destroys a simple lock.
-
OMP_DESTROY_NEST_LOCK destroys a nestable lock.
-
OMP_GET_DYNAMIC reports if dynamic adjustment of thread number is allowed.
-
OMP_GET_MAX_THREADS returns the default number of threads.
-
OMP_GET_NESTED reports if nested parallelism has been enabled.
-
OMP_GET_NUM_PROCS returns the number of processors available to the program.
-
OMP_GET_NUM_THREADS returns the number of threads in the current team.
-
OMP_GET_THREAD_NUM returns the thread number of a thread in a team.
-
OMP_GET_WTICK returns the precision of the timer used by OMP_GET_WTIME.
-
OMP_GET_WTIME returns elapsed wall clock time in seconds.
-
OMP_IN_PARALLEL returns TRUE if the call is made from a parallel region.
-
OMP_INIT_LOCK initializes a simple lock.
-
OMP_INIT_NEST_LOCK initializes a nestable lock.
-
OMP_SET_DYNAMIC enables dynamic adjustment of the number of threads.
-
OMP_SET_LOCK sets a simple lock.
-
OMP_SET_NEST_LOCK sets a nestable lock.
-
OMP_SET_NESTED controls the use of nested parallelism.
-
OMP_SET_NUM_THREADS sets the number of threads.
-
OMP_TEST_LOCK tests a simple lock.
-
OMP_TEST_NEST_LOCK tests a nestable lock.
-
OMP_UNSET_LOCK unsets a simple lock.
-
OMP_UNSET_NEST_LOCK unsets a nestable lock.
You can go up one level to
the C source codes.
Last revised on 21 November 2007.