Parallel processing

For Korn shell:

export MLIB_NUMBER_OF_THREADS=8

MLIB_NUMBER_OF_THREADS is examined on the first call to a parallelized VECLIB subprogram to establish the default parallel action within VECLIB.

Use the subroutine MLIB_SETNUMTHREADS to restore VECLIB parallel processing to its run-time default that was specified by MLIB_NUMBER_OF_THREADS. Refer to the mlib_setnumthreads(3m) man page for usage information.

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.

To modify the effect of the 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 VECLIB parallelism is enabled, each parallelized VECLIB subprogram determines at runtime if multiple processors are available. If multiple processors are available, VECLIB detects whether the program is already using multiple threads. If the application calling VECLIB is not running multiple threads, VECLIB will attempt to use all available threads (limited by MLIB_NUMBER_THREADS). If the application calling VECLIB is already running multiple threads, VECLIB will attempt to use the remaining threads without over-subscribing. This is a form of nested parallelism.

If you are using an HP server with multiple processors, you can realize the performance benefits of parallel processing in three ways:

Call any parallelized VECLIB 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.

Chapter 1 Introduction to VECLIB 19