Introduction

OpenMP Usage

Users of the IMSL C Numerical Library are able to leverage shared-memory parallelism by means of native support for the OpenMP API specification within parts of the Library.  Those parts are flagged by the OpenMP icon shown below.

Parallelism in OpenMP is implemented by means of threads.  In the OpenMP programming model, it is assumed that memory is shared among threads, such as in multi-core machines.  These threads are spawned by OpenMP in response to directives embedded in source code.

The Library's use of OpenMP is largely transparent to the user.  Codes that have been enhanced with OpenMP directives will still work properly in serial execution environments. Error handling routines have been extended so that the most severe error during a parallel run will be returned to the user.

Note: The IMSL C Numerical Library uses OpenMP only if the compiler supports OpenMP.

Note: Details on linking to appropriate libraries are explained in the online README files of the product distribution.

OpenMP is used by the Library in two main ways:

1.     To speed up computationally intensive functions by exploiting data parallelism in their processing.

2.     To parallelize the evaluation of user-supplied functions in routines that use them, e.g. in the genetic algorithm routines.

In this second case, the user must explicitly signal to the Library that the user-supplied functions themselves are thread-safe, or by default the user's function(s) will not evaluate in parallel. The utility imsls_omp_options allows the user to assert that all routines passed to the library are thread-safe.

Thread safety implies that function(s) may be executed simultaneously by multiple threads and still function correctly.  Requiring that user-supplied functions be thread-safe is crucial, because the different threads spawned by OpenMP may call user-supplied functions simultaneously, and/or in an arbitrary order, and/or with differing inputs.  Care must therefore be taken to ensure that the parallelized algorithm acts in the same way as its serial “ancestor”.  Functions whose results depend on the order in which they are executed are not thread-safe and are thus not good candidates for parallelization; neither are functions which access and modify global data.

Specifications of the OpenMP standards are provided at (http://openmp.org/wp/).


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260