Purpose
Note: #pragma ibm schedule and
#pragma
ibm parallel_loop have been deprecated and might be removed from
the future release. Use
#pragma omp parallel for with the
schedule clause.
For more information about SMP directives, see
Deprecated directives.
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).
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. n must be an integral assignment expression
of value 1 or greater.
- dynamic
- Iterations of a loop are divided into chunks of size 1.
Chunks
are assigned to threads on a first-come, first-serve basis as threads
become available. This continues until all work is completed.
- dynamic,n
- As above, except that all chunks are set to size n. 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).
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 is set to n. 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 ceiling(number_of_iterations/number_of_threads).
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.
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 parallel_loop and independent_loop pragma statements.
For example, the following sets of statements are equivalent:
#pragma ibm parallel_loop
#pragma ibm schedule (sched_type)
<countable for|while|do loop>
|
| and |
#pragma ibm parallel_loop (sched_type)
<countable for|while|do loop>
|
If different scheduling types are specified for a
given loop, the last one specified is applied.