Parallel Programming in Fortran 95 using OpenMP - People
Parallel Programming in Fortran 95 using OpenMP - People
Parallel Programming in Fortran 95 using OpenMP - People
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
52 3. PRIVATE, SHARED & Co.<br />
Pieces of work<br />
1 2<br />
3 4 5 6<br />
7 8<br />
9 10 11<br />
12<br />
✻<br />
256 iter.<br />
512 iter.<br />
246 iter.<br />
1024 iter.<br />
2048 iter.<br />
Figure 3.8: Graphical representation of the effect of the SCHEDULE(GUIDED,chunk) clause on a<br />
do-loop with 10230 iterations and with chunk = 256.<br />
To see <strong>in</strong> figure 3.8 is that the last piece of work is smaller than the value specified<br />
<strong>in</strong> chunk. This is necessary <strong>in</strong> order to fulfill the total number of iterations of the<br />
do-loop, namely 10230.<br />
Once the pieces of work have been created, the way <strong>in</strong> which they are distributed<br />
among the available threads is the same as <strong>in</strong> the previous schedul<strong>in</strong>g method<br />
DYNAMIC.<br />
RUNTIME : Any of the previous three schedul<strong>in</strong>g methods needs to be fixed at the time of<br />
compil<strong>in</strong>g the source code. But it may be of <strong>in</strong>terest to be able to modify dur<strong>in</strong>g<br />
runtime the way <strong>in</strong> which the work is distributed among the threads. This can be<br />
achieved by specify<strong>in</strong>g the RUNTIME schedul<strong>in</strong>g method:<br />
!$OMP DO SCHEDULE(RUNTIME)<br />
If this is done, then the content of the environment variable OMP SCHEDULE specifies<br />
the schedul<strong>in</strong>g method to be used. More <strong>in</strong>formation about the OMP SCHEDULE<br />
environment variable can be found on page 70.<br />
3.2.5 ORDERED<br />
When a do-loop <strong>in</strong>cludes statements, which need to be executed sequentially, like <strong>in</strong> the<br />
follow<strong>in</strong>g example:<br />
do i = 1, 1000<br />
A(i) = 2 * A(i-1)<br />
enddo