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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Details of Multi-ProcessingCPU 2:do i = 5001, 10000a(i) = a(i-1) + b(i)end doA(5000) is not available to CPU2 and the loop will not be slicedLoop Interchange and Automatic Loop SlicingWhen a nested DO loop is sliced, LF64 attempts to parallelize the outermost loop if it can.LF64 selects a DO loop that can be sliced and interchanges it with the outermost possibleloop. The purpose of this is to reduce the overhead of multi-processing and improve executionperformance.The next figure shows an example of loop interchange for a nested loop. It is possible to slicethe inner loop with control variable J. The frequency of multi-processing control can bereduced by interchanging it with the outer loop.do i = 2, 10000do j = 1, 10a(i,j) = a(i-1,j) + b(i,j)end doend doWith loops interchanged, this becomes:do j = 1, 10do i = 2, 10000a(i,j) = a(i-1,j) + b(i,j)end doend doWhen parallelized, this becomes:CPU 1:CPU 2:do j = 1, 5do i = 2, 10000a(i,j) = a(i-1,j) + b(i,j)end doend dodo j = 6, 10do i = 2, 10000a(i,j) = a(i-1,j) + b(i,j)end doend do<strong>Lahey</strong>/Fujitsu <strong>Linux</strong>64 Fortran User’s <strong>Guide</strong> 91

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

Saved successfully!

Ooh no, something went wrong!