- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[cpp]#include#include #include #include //~ #include int main(int argc,char **argv) { int i; double a,b,c,d,e,f; a=b=c=d=e=f=0.; #pragma omp parallel for reduction(+: a,b,c,d,e,f) for(i=0;i<10;i++) { a+=1.; b+=1.; c+=1.; d+=1.; e+=1.; f+=1.; //~ printf("i=%d:%d, %g,%g,%g,%g,%g,%gn",i,omp_get_thread_num(),a,b,c,d,e,f); } printf("%g,%g,%g,%g,%g,%gn",a,b,c,d,e,f); return 0; } [/cpp]
The above code compiles and runs correctly using icc v8.0 on ia64 and v10.0 on ia32 (which are two of my working platforms),but the result is confusing using icc v11.0.081 on ia64.
The expected results should print (and that's exactly the icc v8 and v10 results): 10,10,10,10,10,10.
While using icc v11, it prints: 10,10,10,10,1,1
Just the first four vars got reduced, the other two variables remain just the values of the main thread (which may change depending on the total threads used and thus work-sharing).
If I use float instead of double variables, the result is correct.What's more confusing is that Occasionally the result turns OK for the above code, but just once during my tests.
It's getting me feeling unsafe...
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a bug in the compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue is fixed in beta Intel C++ compiler version 11.1.023. I created a defect reference in the knowledge base http://software.intel.com/en-us/articles/openmp-reduction-error/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Om Sachan (Intel)
The issue is fixed in beta Intel C++ compiler version 11.1.023. I created a defect reference in the knowledge base http://software.intel.com/en-us/articles/openmp-reduction-error/
Thanks for your response.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page