[Omp] OpenMP spec 2.5 seems to have incorrect flush example on page 12
Marcel Beemster
marcel at ace.nl
Tue May 8 09:04:15 PDT 2007
Bronis wrote:
> We simply require the user to compile the functions using
> a thread-safe compiler! End of story.
Bronis, your post analyzes the issue very well. I'm very happy
about that. But I am not happy with your conclusion that we
should modify our compilers to be thread-safe. (Which does
not imply that you are wrong.)
First, I (repeat to) disagree with the opinion that a
thread-safe compiler (doing software dirty bits or no
optimization at all) has only a small overhead compared to
sequential compilation. I can't quantify this for obvious
reasons, but my intuition differs from yours. In a RISC
architecture EVERYTHING goes through a register.
Second: "simply [] compile with a thread-safe compiler" --
It is never going to be simple. There are many models for
thread-safety. Do all compilers implement the same model, if
at all? If we have to do thread-safe, then I suggest to start
at checking "The Java Memory Model" by Manson, Pugh and Adve
(POPL'05). It has a lot of history included and promises to fit
our goals - to allow many optimizations and to be intuitive.
Third: We used to have flushes in OMP and compiler freedom to
do whatever between flushes. Now you argue to have flushes and
a thread-safe memory model (==restrictions to optimize code
between flushes). Do we still need flushes at all? In Java
the "happens-before" relation is used to guarantee order. It
relates two threads T1 and T2. Flush does not relate two
threads and may not be strong enough to do anything safely
at all.
Marcel
More information about the Omp
mailing list