|
From: Dave G. <go...@mc...> - 2010-07-08 16:57:13
|
On Jul 8, 2010, at 11:22 AM CDT, Bart Van Assche wrote: > On Thu, Jul 8, 2010 at 5:56 PM, Dave Goodell <go...@mc...> wrote: >> On Jul 8, 2010, at 5:27 AM CDT, Bart Van Assche wrote: > > DRD should understand all Helgrind annotations implemented via client > requests, but not the other way around. Ahh, thanks for the clarification. >> At the bottom of this email is the result of a run of DRD with USE_DRD defined instead of USE_HELGRIND. It also warns about the "flag" variable, so I don't think I'm being hit by #243935. > > If you modify your test program such that more than one thread is > waiting for the value of the variable "flag" becoming zero, I expect > that you will be hit by #243935. That's possible. In the case of my real code, I never have more than one thread waiting on a given flag thanks to MPI_Request semantics imposed by the MPI standard. However I'll keep it in mind in case I hit any similar case in the future. >> The HB/HA annotations do work for shared_data, but not for the flag variable. This makes sense to me, because I'm only indicating the HA point after the "racy" read. However I don't understand the correct way to annotate this without just telling the tool to ignore races on this memory location. I feel like what I need is an "atomic load" that will be treated the same way as a more complicated atomic operation like CAS or fetch_and_add. The various tools don't seem to have a problem with those operations (undef'ing USE_PLAIN_STORE in the test code makes DRD happy again). > > There are two ways to get rid of the race report on the flag variable, > both which were already mentioned by Konstantin: > * Adding an ANNOTATE_BENIGN_RACE() annotation. > * Replacing the assignment "flag = 0" by an atomic instruction that > sets "flag" to zero. OK, it seems that the consensus is just to do this then. I'll probably go with the atomic instruction just to keep Helgrind happy as well. It would be nice if Helgrind eventually implemented ANNOTATE_BENIGN_RACE or some roughly equivalent functionality. Thanks to all for the clarifications and suggestions. -Dave |