This topic has not yet been rated - Rate this topic

A.10 Specifying Sequential Ordering

Ordered sections (Section 2.6.6 on page 22) are useful for sequentially ordering the output from work that is done in parallel. The following program prints out the indexes in sequential order:

#pragma omp for ordered schedule(dynamic)
    for (i=lb; i<ub; i+=st)
        work(i);
void work(int k)
{
    #pragma omp ordered
        printf_s(" %d", k);
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.