12.07.2015 Views

LF95 Linux User's Guide - Lahey Computer Systems

LF95 Linux User's Guide - Lahey Computer Systems

LF95 Linux User's Guide - Lahey Computer Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Details of Multi-Processingdo i = 1, 10000a(i) = b(i) + c(i)d(i) = e(i) + f(i)end doWhen parallelized, this becomes:CPU 1:CPU 2:do i = 1, 5000a(i) = b(i) + c(i)d(i) = e(i) + f(i)end dodo i = 5001, 10000a(i) = b(i) + c(i)d(i) = e(i) + f(i)end doLoop ReductionLoop reduction slices the DO loop, changing order of the operations (addition and multiplication,etc.). Note that loop reduction may cause small differences in execution results.Loop reduction optimization is applied if there is one of the following operations in the DOloop:• SUM: S=S+A(I)• PRODUCT: P=P*A(I)• DOT PRODUCT: P=P+A(I)*B(I)• MIN: X=MIN(X,A(I))• MAX: Y=MAX(Y,A(I))• OR: N=N.OR. A(I)• AND: M=M.AND.A(I)The next example shows loop reduction and automatic loop slicing.sum = 0do i = 1, 10000sum = sum + a(i)end doParallelized becomes:CPU 1:sum1 = 0do i = 1, 5000sum1 = sum1 + a(i)end do<strong>Lahey</strong>/Fujitsu <strong>Linux</strong>64 Fortran User’s <strong>Guide</strong> 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!