A.4 Using the nowait Clause


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

If there are multiple independent loops within a parallel region, you can use the nowait clause (Section 2.4.1 on page 11) to avoid the implied barrier at the end of the for directive, as follows:

#pragma omp parallel  
    #pragma omp for nowait  
        for (i=1; i<n; i++)  
             b[i] = (a[i] + a[i-1]) / 2.0;  
    #pragma omp for nowait  
        for (i=0; i<m; i++)  
            y[i] = sqrt(z[i]);