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

608 HP MLIB User’s Guide
MLIB_SETNUMTHREADS Control extent of parallelism
Name MLIB_SETNUMTHREADS
Control extent of parallelism
Purpose This subprogram is used to control the extent to which parallelized MLIB
subprograms may use shared-memory parallelism.
nthread becomes internal state for MLIB_GETNUMTHREADS. Only one value
of
nthread is saved within a UNIX process; subsequent calls to
MLIB_SETNUMTHREADS overwrite the previous value.
Usage VECLIB, LAPACK, SCALAPACK:
INTEGER*4 nthread
CALL MLIB_SETNUMTHREADS(nthread)
VECLIB8, LAPACK8, SCALAPACK8:
INTEGER*8 nthread
CALL MLIB_SETNUMTHREADS(nthread)
Input nthread If nthread > 0, it specifies the maximum number of
parallel threads that can be spawned in subsequent
calls to parallelized MLIB subprograms.
If nthread is larger than the total number of threads
available to the application (typically the number of
CPUs), the internal state for
MLIB_GETNUMTHREADS is set to the total number
of threads available.
If nthread = 0, MLIB_GETNUMTHREADS will, on its
next call, restore the default maximum number of
threads from the MLIB_NUMBER_OF_THREADS
environment variable, if defined. If
MLIB_NUMBER_OF_THREADS is not defined, the
default maximum number of threads is set to one.
If nthread < 1, the default maximum number of
threads will be set to one.
For nested parallelism, if an MLIB routine is called
from a parallelized loop or region, there will be
multiple MLIB calls (one for each thread generated by
the parallelized region). Each MLIB call will attempt to
spawn multiple threads (up to nthread) to use the
remaining number of threads available to the
application.