To run a parallel program compiled by KAP on an SMP system, you must set the following environment variables:
Replace <integer> with the number of parallel threads to use. The number of parallel threads is equal usually to the number of processors on the system. Do not specify more parallel threads than there are processors to avoid performance degradation.
Increasing the number of threads may result in the need to increase the stack size of your system, as explained in the following KMP_STACKSIZE description.
The KMP_STACKSIZE <integer> environment variable specifies the threads stack size in bytes. Replace <integer> with the desired stack size in bytes. KMP_STACKSIZE should be as large as the largest stack size given in the annotated listing. The default setting is 1 megabyte.
Two indications that your system stack size is too small are the following:
DECthreads Last Chance handler: thread 1 exiting on status exception 0x177db005 Exception: Invalid memory address (dce / thd)
kf77 -fkapargs='-conc' large.f KAP/Digital_UA_F 3.1 k271615 961104 28-Nov-1996 15:38:26 ### enddo ### in line 620 procedure EVALWW of file large.f ### Routine PKEVALWW requires the parallel STACKSIZE must be at least 221544 bytes. ### enddo ### in line 978 procedure EVALFW of file large.f ### Routine PKEVALFW requires the parallel STACKSIZE must be at least 221400 bytes.
To display the stack size on your system, use the C shell
limit stacksize
command and then increase the size
to a larger value (if limit can be increased from your process)
as follows:
% limit stacksize stacksize 4096 kbytes % limit stacksize 32676 % limit stacksize stacksize 32676 kbytes
You can also remove the limitation on stacksize with the
stacksize unlimited
command, for example:
% limit stacksize unlimited
Similarly, with the Korn and Bourne shells, use the ulimit command with the -s flag (see ksh(1) and sh(1)), for example:
$ ulimit -s 096 $ ulimit -s 32676 $ ulimit -s 32676
If you continue to have problems, ask your system manager
to increase the maxssiz
entry in the system
configuration file. The KAP annotated source file and the
preprocessing warning message tell you how much to increase KMP_
STACKSIZE. Generally, maxssiz
should be as large as
or, preferably, larger than KMP_STACKSIZE.
The KMP_SPINLOCKS <on/off> environment variable sets the synchronization mechanism:
For example, to run a program on a multiprocessor system with 4 parallel threads, a thread stack size of 1 megabyte, and mutex synchronization, set the environment variables as follows:
setenv PARALLEL 4 setenv KMP_STACKSIZE 100000 setenv KMP_SPINLOCKS off
kf77 -fkapargs='-conc' myprog.f
setenv PARALLEL 1
kf77 -fkapargs='-noconc' myprog.f