| United States-English |
|
|
|
![]() |
Parallel Programming Guide for HP-UX Systems > Chapter 6 Parallel
optimization featuresLevels of parallelism |
|
In the HP compilers, parallelism exists at the loop level, task level, and region level, as described in Chapter 9 “Parallel programming techniques”. These are briefly described as follows.
HP compilers locate parallelism at the loop level, generating parallel code that is automatically run on as many processors as are available at runtime. Normally, these are all the processors on the same system where your program is running. You can specify a smaller number of processors using any of the following:
Automatic parallelization is useful for programs containing loops. You can use compiler directives or pragmas to improve on the automatic optimizations and to assist the compiler in locating additional opportunities for parallelization. If you are writing your program entirely under the message-passing paradigm, you must explicitly handle parallelism as discussed in the HP MPI User’s Guide.
Assuming that the I loop does not contain any parallelization-inhibiting code,
this program can be parallelized to run on eight processors by running
128 iterations per processor (1024 iterations divided by 8 processors
= 128 iterations each). One processor would run the loop for At a certain point, however, adding more processors does not improve performance. The compiler generates code that runs on as many processors as are available, but the dynamic selection optimization (described in the section “Dynamic selection”) ensures that parallel code is executed only if it is profitable to do so. If the number of available processors does not evenly divide the number of iterations, some processors perform fewer iterations than others. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||