### 15.2.4.2 CHUNK Directive (TU*X only)

The CHUNK directive sets a default chunksize to adjust the number of iterations assigned to a thread. The effect of CHUNK varies, depending on the scheduling type.

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

  c$PAR CHUNK = chunksize
  c
  Is one of the following: C (or c), !, or * (see Section 15.2.1).
  chunksize
  Is a scalar integer expression.

Rules and Behavior

The effect of chunksize varies by scheduling type, as follows:

- For DYNAMIC and INTERLEAVED scheduling, iterations are always assigned to threads in chunksized groups. If the total number of iterations is not divisible by chunksize, the last group has fewer than chunksize iterations.
- For GUIDED scheduling, chunksize is the minimum number of iterations that can be assigned to a thread. If less than chunksize iterations remain, the next available thread is assigned all of the remaining iterations.
- For STATIC scheduling, chunksize is ignored and has no effect.

The chunksize used for any parallel DO loop is determined by the following (in the order shown):

1. A chunksize specified in the PDO directive for the current DO loop
2. A user-specified default specified in the most recent CHUNK directive
3. If the scheduling for the current DO loop is INTERLEAVED, DYNAMIC, GUIDED, or RUNTIME, a user-specified default specified in the environment variable MP_CHUNK
4. The compiler default of one

  Note: The following form is also allowed: `c$CHUNK = chunksize`

For More Information:

For details about scheduling types, see Section 15.2.4.6.

Previous Page Next Page Table of Contents