Hello,
I was getting syntax errors when trying to use OpenMP array reductions in icpc 17.0.4. After reducing the problem, it seems that array reductions might not be supported inside templated functions. Here's an example of what I'm seeing:
// This is OK. void test1(int n) { double *a; #pragma omp parallel for reduction(+: a[:n]) for (int i = 0; i < n; ++i) { } } // This fails to compile -- "error: syntax error in omp clause" template <typename T> void test2(int n, T /*unused*/) { T *a; #pragma omp parallel for reduction(+: a[:n]) for (int i = 0; i < n; ++i) { } } template void test2(int, double); // This also fails to compile, with the same error template <typename T> void test3(int n, T) { double *a; #pragma omp parallel for reduction(+: a[:n]) for (int i = 0; i < n; ++i) { } } template void test3(int,double);
Is this a known issue, or did I make a mistake somewhere? Thanks!
Peter