schedule Clause
- Updated2023-02-21
- 1 minute(s) read
schedule Clause
Specifies the type of schedule of the for directive.
Format
schedule(kind[, size])
The following types are valid values for kind:
- static
- dynamic
- guided
- run-time
size is the size of the iterations and is an integer value. You cannot designate a size for run time.
Example
#ifdef _OPENMP
#include <omp.h>
#endif
#include <stdio.h>
void work(int k)
{
#pragma omp ordered
printf(" %d\n", k);
}
void a21(int lb, int ub, int stride)
{
int i;
#pragma omp parallel for ordered schedule(dynamic)
for (i=lb; i<ub; i+=stride)
work(i);
}
int main()
{
a21(0, 100, 5);
return 0;
}