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.

Notes on ParallelizationCPU 2:sum2 = 0do i = 5001, 10000sum2 = sum2 + a(i)end doThen the partial sums are added:sum = sum + sum1 + sum2The variable SUM accumulates the values A(1) to A(10000) in order with serial execution.In parallel execution, SUM1 accumulates the values A(1) to A(5000), and SUM2 accumulatesthe values A(5001) to A(10000) at the same time. After that, the sum of SUM1 andSUM2 is added to SUM.Loop reduction optimization may cause a side effect (a different result due to rounding) inthe execution result, because the order of adding the array elements is different between parallelexecution and serial execution.Invalid Usage of Optimization Control LineThe following program specifies DISJOINT by mistake for array A. The execution resultwill be incorrect when array A is sliced, because the order of the data references for array Ais different from the order of data references for serial execution.!ocl disjoint(a)do i = 2,10000a(i) = a(i-1) + b(i)end doThe following program specifies TEMP by mistake for variable T. The correct value will notbe assigned to variable last, because LF64 does not guarantee a correct value of variable Tat the end of the DO loop.!ocl temp(t)do i = 1, 1000t = a(i) + b(i)c(i) = t + d(i)end dolast = tThe following program specifies INDEPENDENT by mistake for procedure SUB. The executionresult may be incorrect when array A is sliced, because the order of the data referencesfor array A is different from the data references for serial execution.<strong>Lahey</strong>/Fujitsu <strong>Linux</strong>64 Fortran User’s <strong>Guide</strong> 105

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

Saved successfully!

Ooh no, something went wrong!