Technical data
100
Chapter 5: Fortran Enhancements for Multiprocessors
Environment Variables: MP_SET_NUMTHREADS,
MP_BLOCKTIME, MP_SETUP
These environment variables act as an implicit call to the corresponding
routine(s) of the same name at program start-up time.
For example, the csh command
% setenv MP_SET_NUMTHREADS 2
causes the program to create two threads regardless of the number of CPUs
actually on the machine, just like the source statement
CALL MP_SET_NUMTHREADS (2)
Similarly, the sh commands
% set MP_BLOCKTIME 0
% export MP_BLOCKTIME
prevent the slave threads from autoblocking, just like the source statement
call mp_blocktime (0)
For compatibility with older releases, the environment variable
NUM_THREADS is supported as a synonym for
MP_SET_NUMTHREADS.
To help support networks with several multiprocessors and several CPUs,
the environment variable MP_SET_NUMTHREADS also accepts an
expression involving integers +, –, mm, max, and the special symbol all,
which stands for “the number of CPUs on the current machine.”
For example, the following command selects the number of threads to be
two fewer than the total number of CPUs (but always at least one):
% setenv MP_SET_NUMTHREADS max(1,all-2)










