[Llvm-bgq-discuss] Details behind MPI wrapper for bgclang++
Hal Finkel
hfinkel at anl.gov
Fri Mar 1 20:12:52 CST 2013
----- Original Message -----
> From: "Jack Poulson" <jack.poulson at gmail.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Jeff Hammond" <jeff.science at gmail.com>, "Jeff Hammond" <jhammond at alcf.anl.gov>,
> llvm-bgq-discuss at lists.alcf.anl.gov
> Sent: Friday, March 1, 2013 7:23:53 PM
> Subject: Re: [Llvm-bgq-discuss] Details behind MPI wrapper for bgclang++
>
> Hi Hal,
>
> Due to a temporary lapse in judgement, I'll explain the subtle bug in
> my program that I just found that seems to be the cause of this
> issue:
>
> Take the square [a,b] x [a,b] and subdivide it into an 8 x 8 grid of
> subsquares, and then draw a large number of random samples from
> [a,b) x [a,b) using std::uniform_real_dist, then determine which
> subsquare a random sample (x,y) is in via floor((x-a)/w) and
> floor((y-a)/w), where w=(b-a)/8 is the width of each box.
>
> The problem is fairly obvious in hindsight, but even though x and y
> are not allowed to be exactly equal to b due to being drawn from
> [a,b), the round-off error in (x-a)/w makes that irrelevant, and
> what was mathematically floor(7.9999999) might be computed as
> floor(8.00000000), which produced a box index which was out of
> bounds and therefore resulted in a segfault when I loaded from an
> invalid memory location.
>
> The probability of running into this edge case of course increases
> with the number of samples taken, which explains why I never ran
> into it developing on my own machine.
>
> I think this issue seems to be resolved now...thank you very much for
> your help Hal and Jeff.
Jack,
That's great news :)
So the take-away from this is:
1. I need to get the debug info fixed up
2. I need to get the address-sanitizer working
Thanks again,
Hal
>
> Jack
>
More information about the llvm-bgq-discuss
mailing list