- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why?
#pragma omp parallel for
for (i=0; i
sum+ = a * b;
}
and
#pragma omp parallel for reduction(+:sum)
for (i=0; i
sum+ = a * b;
}
Please tell me why the two running results are identical?
Thank you.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a) You got lucky
b) You compiled with OpenMP off
c) You compiled with OpenMP on, Nested levels off, and loop is in nested level.
d) You compiled with OpenMP on, but only 1 thread is used
e) N <= 1
f) all of a or all of b or both are 0
g) N is sufficiently small such that each thread finishes before the other starts (assuming multiple threads run the loop)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jimdempseyatthecove
a) You got lucky
b) You compiled with OpenMP off
c) You compiled with OpenMP on, Nested levels off, and loop is in nested level.
d) You compiled with OpenMP on, but only 1 thread is used
e) N <= 1
f) all of a or all of b or both are 0
g) N is sufficiently small such that each thread finishes before the other starts (assuming multiple threads run the loop)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much indeed for your reply.
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