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.

Chapter 5 Multi-Processing (PRO version only)Loop Distribution and Automatic Loop SlicingIn the next example, the references to array A cannot be sliced, because the order of data referenceswould be different from the data reference order in serial execution. Array B can besliced, because the order of data references is the same as for serial execution. For this case,the statement where array A is defined and the statement where array B is defined are separatedinto two DO loops, and the DO loop where array B is defined is parallelized.do i = 1, 10000a(i) = a(i-1) + c(i)b(i) = b(i) + c(i)end doWith the loop distributed this becomes:do i = 1, 10000a(i) = a(i-1) + c(i)end dodo i = 1, 10000b(i) = b(i) + c(i)end doThe second loop is then parallelized:CPU 1:CPU 2:do i = 1, 5000b(i) = b(i) + c(i)end dodo i = 5001, 10000b(i) = b(i) + c(i)end doLoop Fusion and Automatic Loop SlicingIn the next example, there are DO loops in sequence having the same DO loop control. Inthis case, the overhead of the DO loop control and the frequency of multi-processing controlcan be reduced by merging those two loops into a single loop.do i = 1, 10000a(i) = b(i) + c(i)end dodo i = 1, 10000d(i) = e(i) + f(i)end doWith loops fused this becomes:92 <strong>Lahey</strong>/Fujitsu <strong>Linux</strong>64 Fortran User’s <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!