[comp.sys.sequent] the KAP Fortran Preprocessor

gerry@cs.keele.ac.uk (Gerry Pratt) (02/04/89)

We have just (!) installed the KAP preprocessor here on our Sequent
I was surprised to see the the results of parallelised Fortran was
different, in some cases, from the original results.

Is this a real or imagined problem, has it been discussed in this
newsgroup and can anyone suggest some ground rules about preparing
programs for KAP.

Thanks,

Gerry Pratt - Workstation Support - University of KEELE
NEWCASTLE - Staffordshire - ST5 5BG - ENGLAND

ming@horizon.KAI.COM (02/08/89)

In programming for parallel execution, the user has to be aware of the
potential of changing computational precision in some arithmetic
operations, in particular, the reduction operation.  Reductions are
typically implemented for parallel execution by allowing each processor
to accumulate a local result, then combine the local results into the
global result at the end of the loop. The arithmetic operations are
done in a different order than the sequential program; consequently,
roundoff error is accumulated differently and the answer may differ
from the original program output.  It is important to note that this
roundoff error is different than scalar, not "worse" in a mathematical
sense.

If reproducibility is important, the KAP/Sequent user can set a
ROUNDOFF switch on the command line, telling KAP to generate code that
will reproduce the same answer as the serial program at the expense of
execution speed.  For instance, for the following loop:

C$DOACROSS REDUCTION(S),SHARE(a)
	   DO 10 i = 1,n
	     s = s + a(i)
10         continue

in serial mode: Computation is done in the following sequence
       s = s + a(1) + a(2) + a(3) + ....

in parallel mode with 3 processors on a Sequent machine which uses static
scheduling, i.e. process 1 will be executing iteration 1,4,7...
process 2 will be executing iteration 2,5,8,... 
process 3 will be executing iteration 3,6,9,...

Computation is done in the following manner:

      p1 : ls1 = a(1) + a(4) + a(7) + ....
      p2 : ls2 = a(2) + a(5) + a(8) + ....
      p3 : ls3 = a(3) + a(6) + a(9) + ....

s = ls1 + ls2 + ls3

Precision may be changed in the process and since the order of
accumulating the result is different in concurrent mode and serial
mode, different answers may result.

If KAP is run with roundoff=0, reduction operations will be done with
an ordered critical section to ensure that the answer is accumulated in
the same order as the serial execution.  Please refer to the
KAP/Sequent User's Guide for more details.

If a KAP/Sequent user has any problem or questions on using KAP, please
feel free to call the KAI customer representative at (217) 356-2288 or
send e-mail to

    internet: kai@kai.com
    UUCP    : {uunet,ucbvax}!uiucuxc!kailand!kai