- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Peter,
This seems to be a bug. Can you submit a bug report at https://supporttickets.intel.com.
Your test case compiled with g++
vahoang@orcsle100:/tmp$ g++ -fopenmp t2.cpp -c
vahoang@orcsle100:/tmp$ cat t2.cpp
#include"omp.h"
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);
vahoang@orcsle100:/tmp$ g++ -fopenmp t2.cpp -c
vahoang@orcsle100:/tmp$ icpc -qopenmp t2.cpp -c
t2.cpp(7): error: syntax error in omp clause
#pragma omp parallel for reduction(+: a[:n])
^
compilation aborted for t2.cpp (code 2)
vahoang@orcsle100:/tmp$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
This is also an issue in ICC 18.0.0
Was there any response to the bug report? And any indication of whether this may be fixed in the next few updates?
Anthony

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page