Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'var' : variable in 'reduction' clause must be shared in enclosing context
Remarks
A variable specified in a reduction clause may not be private to each thread in the context.
Example
The following example generates C3037:
// C3037.cpp
// compile with: /openmp /c
int g_i;
int main() {
   int i;
   #pragma omp parallel private(g_i)
   // try the following line instead
   // #pragma omp parallel
   {
      #pragma omp for reduction(+:g_i)   // C3037
      for (i = 0 ; i < 10 ; ++i) {
         g_i += i;
      }
   }
}