Purpose
The schedule pragma
specifies the scheduling algorithms used for parallel processing.
Syntax

>>-#--pragma--ibm schedule--(sched-type)-----------------------><
Parameters
sched-type represents
one of the following options:
- affinity
- Iterations of
a loop are initially divided into local partitions of size ceiling(number_of_iterations/number_of_threads) contiguous iterations. Each local partition is then
further subdivided into chunks of size ceiling(number_of_iterations_remaining_in_partition/2).
When a thread becomes available, it takes the next chunk from
its local partition. If there are no more chunks in the local partition,
the thread takes an available chunk from the partition of another
thread.
- affinity,n
- As above, except that each local partition is subdivided into
chunks of size n contiguous iterations. n must
be an integral assignment expression of value 1 or greater.
- dynamic
- Iterations of a loop are divided into
chunks, each of which contains one iteration
Chunks are assigned
to threads on a first-come, first-do basis as threads become available.
This continues until all work is completed.
- dynamic,n
- Iterations of a loop are divided into
chunks that contain n contiguous iterations each. The final
chunk might contain fewer than n iterations.
Each
thread is initially assigned one chunk. After threads complete their
assigned chunks, they are assigned remaining chunks on a "first-come,
first-do" basis.
n must be an integral assignment expression
of value 1 or greater.
- guided
- Chunks are made progressively smaller until a chunk size of one
is reached. The first chunk is of size ceiling(number_of_iterations/number_of_threads) contiguous iterations. Remaining chunks are of size ceiling(number_of_iterations_remaining/number_of_threads).
Chunks are assigned to threads on a first-come, first-serve basis
as threads become available. This continues until all work is completed.
- guided,n
- As above, except the minimum chunk size for all
the chunks but the last chunk is set to n contiguous
iterations. n must be an integral assignment expression
of value 1 or greater.
- runtime
- Scheduling policy is determined at run time.
- static
- Iterations of a loop are divided into
chunks of size of at least floor(number_of_iterations/number_of_threads)
contiguous iterations. The first remainder(number_of_iterations/number_of_threads)
chunks have one more iteration. Each thread is assigned a separate
chunk.
This scheduling policy is also known as block scheduling.
- static,n
- Iterations of
a loop are divided into chunks of size n contiguous
iterations except for the last iteration.
Each chunk is assigned to a thread in round-robin fashion.
n must
be an integral assignment expression of value 1 or greater.
Note: If n=1,
iterations of a loop are divided into chunks of size 1 and each chunk
is assigned to a thread in round-robin fashion. This scheduling
policy is also known as block cyclic scheduling
Usage
Pragma must appear immediately before
the loop or loop block directive to be affected.
Scheduling
algorithms for parallel processing can be specified using any of the
methods shown below. If used, methods higher in the list override
entries lower in the list.
- pragma statements
- compiler command line options
- runtime command line options
- runtime default options
Scheduling algorithms can also be specified using
the schedule argument of the independent_loop pragma
statement. If different scheduling types are specified for a given
loop, the last one specified is applied.