MP_SCHEDTYPE Directive (U*X only)

The MP_SCHEDTYPE directive sets a default run-time scheduling type. The scheduling type does not effect the semantics of the program, but may affect performance.

The MP_SCHEDTYPE directive takes the following form: [See Note]

Is one of the following: C (or c), !, or * (see Section 15.2.1).
Is one of the following:


    Specifies that when a thread becomes available for more work, it is assigned the next chunksize of the remaining iterations. This is sometimes described as threads competing for iterations. If less than one chunksize of iterations remains, the next available thread is assigned all the remaining iterations.

  • GUIDED (or GSS)

    Similar to DYNAMIC, except that the number of iterations assigned is relatively large at the beginning of the loop, and decreases exponentially as threads become available for more work. The number of iterations assigned is not necessarily divisible by chunksize.

    For this scheduling type, chunksize is the minimum number of iterations that can be assigned when a thread becomes available for work. When the number of iterations remaining to be assigned is less than or equal to chunksize, all the remaining iterations are assigned to the next available thread.

    In some cases, setting a chunksize greater than 1 improves execution efficiency as the loop nears termination, by reducing contention among the threads for the small number of remaining iterations.


    Specifies that chunks of iterations are to be assigned to threads in a round-robin fashion.


    Specifies that environment variables are to be used to manage scheduling.

    Environment variable names are case-sensitive, but their values are not case-sensitive. Environment variables used are:

    • MP_CHUNK - Specifies a chunksize, where chunksize is an integer constant.

    • MP_SCHEDTYPE - Specifies one of the following modes: DYNAMIC, GSS, GUIDED, INTERLEAVE, INTERLEAVED, SIMPLE, or STATIC.


    Assigns each slave thread one contiguous group of iterations. Each thread is assigned an approximately equal number of iterations.

    STATIC is the default scheduling type when no other method has been specified.

Rules and Behavior

The MP_SCHEDTYPE directive can appear anywhere in a Compaq Fortran program. When more than one MP_SCHEDTYPE directive appears in the same program, the most recently encountered directive is used.

The scheduling type used for any parallel DO loop is determined from the following (in the order shown):

  1. A scheduling type specified in the PDO directive for the current DO loop

  2. A user-specified default specified in the most recent MP_ SCHEDTYPE directive

  3. If the scheduling type for the current DO loop is RUNTIME, a user-specified default specified in the environment variable MP_SCHEDTYPE

  4. The compiler default of STATIC

The DYNAMIC and GUIDED scheduling types introduce a certain amount of overhead to manage the continuing assignment of iterations to threads during the execution of the loop. However, this overhead is sometimes offset by better load balancing when the average execution time of iterations is not uniform throughout the DO loop.

The STATIC and INTERLEAVED types assign all of the iterations to the threads in advance, with each thread receiving approximately equal numbers of iterations. One of these is usually the most efficient scheduling type when the average execution time of iterations is uniform throughout the DO loop.

Note: The following form is also allowed: c$MP_SCHEDTYPE = mode

For More Information:

For details on chunksize, such as defaults, see Section

Previous Page Next Page Table of Contents