HP MLIB for PA-RISC and Itanium2 HP-UX Version 9.5 Release Note
HP MLIB for PA-RISC and Itanium® 2 HP-UX Version 9.5 Release Note
Compatibility Information
29
Use the subroutine MLIB_SETNUMTHREADS to override the environment variable
MLIB_NUMBER_OF_THREADS. Refer to the mlib_setnumthreads(3m) man page for usage
information.
2. Use the subroutine MLIB_SETNUMTHREADS.
You can call this subroutine at any time to set the maximum number of parallel threads
used in subsequent VECLIB or LAPACK calls. The specified value overrides the absence
of the MLIB_NUMBER_OF_THREADS environment variable or any value assigned to it. Refer
to the mlib_setnumthreads(3m) man page for usage information.
To modify the effect of MLIB_NUMBER_OF_THREADS and MLIB_SETNUMTHREADS, you can also
use MP_NUMBER_OF_THREADS at runtime. When MP_NUMBER_OF_THREADS is set to a value
smaller than MLIB_NUMBER_OF_THREADS and MLIB_SETNUMTHREADS, the value of
MP_NUMBER_OF_THREADS takes precedence and limits the amount of parallelism to
MP_NUMBER_OF_THREADS.
These controls set the maximum amount of SMP parallelism that your program can use, and
the VECLIB-specific mechanisms offer finer control within that maximum. Refer to
Performance Benefits below for more information.
Performance Benefits If MLIB parallelism is enabled, each parallelized MLIB subprogram
determines at runtime if multiple processors are available. If multiple processors are
available, MLIB detects whether the program is already using multiple threads, and uses this
information to automatically choose between a single- or parallel-processor algorithm.
If you are using an HP server with multiple processors, you can realize the performance
benefits of parallel processing in three ways:
1. Call any parallelized MLIB subprogram. Let it use parallelism internally (if it determines
that it is appropriate to do so) based on such factors as problem size, system configuration,
and user environment.
2. Call MLIB subprograms in an OpenMP parallelized loop or region. To use this
mechanism, you must be familiar with the techniques of parallel processing. Refer to the
OpenMP documentation at http://www.openmp.org for more information. MLIB routines
may also be called within regions that are parallelized via pthread calls. The Parallel
Programming Guide for HP-UX Systems is a source for parallelism information for
HP-UX.
3. Use the HP-MPI explicit parallel model. Refer to the HP-MPI User’s Guide or the MPI(1)
man page for details.
MLIB subprograms are reentrant, meaning that they may be called multiple times in parallel
to do independent computations without one call interfering with another. You can use this
feature to call MLIB subprograms in a parallelized loop or region. You can force it to
parallelize such a loop by inserting compiler directives before the loop.