A.7 Using the reduction Clause


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

The following example demonstrates the reduction clause (Section on page 28):

#pragma omp parallel for private(i) shared(x, y, n) \  
                         reduction(+: a, b)  
    for (i=0; i<n; i++) {  
        a = a + x[i];  
        b = b + y[i];