Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

OpenMP spec example

jhogg41
Beginner
131 Views
Consider the example A.2.2c on page 157 of the OpenMP 3.0 spec [not a new feature in openmp3 as far as I know].
(Available from here: http://www.openmp.org/mp-documents/spec30.pdf)

Question: Is this example and explanitive text correct about only data being defined at the end? If so, can you please explain to me why this is so?

Thread 0 has flushed the data and then the flag [ordering imposed by flush directives] in that order.

Thread 1 cannot cross the line 36 flush pragma until flag is 1, and hence data is 42. how can only data be the only one defined at the final print statement?

Thanks,
Jonathan.
0 Kudos
1 Reply
jimdempseyatthecove
Black Belt
131 Views

My comments on the referenced secton is the author made a typographical error.

IMHO lines 34:38 should be placed before line 28 (just inside the opening brace)

Anyone else wish to comment?

Good catch.

Jim Dempsey

Reply