#include struct Repro { int count; int count2; std::vector sums[2]; void doit(double* table) { auto* sums0 = &sums[0][0]; auto* sums1 = &sums[1][0]; // If changed to the commented version, we get an error about this reduction type being unsupported instead. // If the intended reduction was truly this simple, many other approaches would be better. //#pragma omp target teams loop reduction(+:sums0[:count2], sums1[:count2]) #pragma omp parallel for schedule(dynamic,131072) reduction(+:sums0[:count2], sums1[:count2]) for (int j = 0; j < count; j++) { const double val = table[j]; sums0[j % count2] += val; sums1[j / count2] += val; } } }; int main() { Repro r; r.doit(new double[131072]); }