Technical data

70
Chapter 5: Fortran Enhancements for Multiprocessors
Overview
The Silicon Graphics Fortran compiler allows you to apply the capabilities
of a Silicon Graphics multiprocessor workstation to the execution of a single
job. By coding a few simple directives, the compiler splits the job into
concurrently executing pieces, thereby decreasing the run time of the job.
This chapter discusses techniques for analyzing your program and
converting it to multiprocessing operations. Chapter 6, Compiling and
Debugging Parallel Fortran, gives compilation and debugging instructions
for parallel processing.
Parallel Loops
The model of parallelism used focuses on the Fortran DO loop. The compiler
executes different iterations of the DO loop in parallel on multiple
processors. For example, using the SIMPLE scheduling method, a DO loop
consisting of 200 iterations will run on a machine with four processors. The
rst 50 iterations run on one processor, the next 50 on another, and so on. The
multiprocessing code adjusts itself at run time to the number of processors
actually present on the machine. Thus, if the above 200-iteration loop was
moved to a machine with only two processors, it would be divided into two
blocks of 100 iterations each, without any need to recompile or relink. In fact,
multiprocessing code can even be run on single-processor machines. The
above loop would be divided into one block of 200 iterations. This allows
code to be developed on a single-processor Silicon Graphics IRIS-4D Series
workstation or Personal IRIS, and later run on an IRIS POWER Series
multiprocessor.
The processes that participate in the parallel execution of a task are arranged
in a master/slave organization. The original process is the master. It creates
zero or more slaves to assist. When a parallel DO loop is encountered, the
master asks the slaves for help. When the loop is complete, the slaves wait
on the master, and the master resumes normal execution. The master process
and each of the slave processes are called a thread of execution or simply a
thread. By default, the number of threads is set equal to the number of
processors on the particular machine. If you want, you can override the
default and explicitly control the number of threads of execution used by a
Fortran job.