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.

Chapter 5 Multi-Processing (PRO version only)do i = 1, 50000a(i) = b(i) + c(i)end doDifferent iterations of the DO loop can be executed on different CPUs at the same time.CPU 1:CPU 2:do i1 = 1, 25000a(i1) = b(i1) + c(i1)end dodo i2 = 25001, 50000a(i2) = b(i2) + c(i2)end doArray Operations and Automatic ParallelizationAutomatic parallelization also targets statements with array operations (array expressionsand array assignments).integer a(1000), b(1000)a = a + bHalf of the operations are made on one CPU and half are made on the other.CPU 1:CPU 2:a(1:500) = a(1:500) + b(1:500)a(501:1000) = a(501:1000) + b(501:1000)Automatic Loop Slicing by the CompilerLF64 parallelizes a DO loop if the order of data references will be the same as with serialexecution. LF64 assures that the result of a multi-processing program is the same as if theprogram were processed serially.The next example is a DO loop that is not amenable to loop slicing. In this DO loop, whenthe DO variable I is 5001, it is necessary to have the value of array element A(5000).do i = 2,10000a(i) = a(i-1) + b(i)end doThe following loop slicing cannot happen with the code above:CPU 1:do i = 2,5000a(i) = a(i-1) + b(i)end do90 <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!