HP MLIB User's Guide Vol. 1 7th Ed.

18 HP MLIB User’s Guide
Parallel processing
You can enable or disable parallel processing at link time or at runtime. A
program does not use parallelism in VECLIB unless parallel processing is
enabled at both link time and at runtime.
Linking for parallel or non parallel processing
To enable parallel processing at link time, your link step must produce a
multithreaded executable. On HP-UX systems, use the +
O3 and +Oparallel
compiler options to get a multithreaded executable when you link with the HP
Fortran compiler; use +O3 and +Oopenmp when you link with the HP C
compiler; and use +Oopenmp when you link with the HP aC++ compiler:
f90 [options including +O3 +Oparallel] file ... –Wl,–aarchive_sharedlveclib
cc
[options including +O3 +Oopenmp] file ... –Wl,–aarchive_sharedlveclib lcl
lm
aCC
[options including +Oopenmp] file ... –Wl,–aarchive_sharedlveclib lcl
lm
To disable VECLIB’s automatic parallelism at link time, omit the +Oparallel
and +Oopenmp options:
f90 [options] file ... –Wl,–aarchive_sharedlveclib
cc
[options] file ... –Wl,–aarchive_sharedlveclib lcl lm
aCC
[options] file ... –Wl,–aarchive_sharedlveclib lcl lm
VECLIB for Linux is always multithreaded enabled.
Controlling VECLIB parallelism at runtime
When you enable parallelism at link time, three methods are available at
runtime to specify the extent of parallel processing in MLIB.
Use MLIB_NUMBER_OF_THREADS, a shell environment variable that
allows you to enable parallelism within MLIB subprograms and to specify
the maximum number of threads that can be used in parallel regions.
Not setting MLIB_NUMBER_OF_THREADS has the same result as setting
it to 1; that is, parallel processing is disabled within MLIB subroutines.
Setting MLIB_NUMBER_OF_THREADS to the number of CPUs in the
system, or greater, allows parallelized MLIB subprograms to use as many
CPUs as are available to the process.
The following command lines show the C shell syntax and Korn shell syntax
to use when setting the variable to eight processors:
For C shell:
setenv MLIB_NUMBER_OF_THREADS 8