Thread overview | |||||
---|---|---|---|---|---|
|
June 02, 2013 std.math.pow produces incorrect results when used with std.parallelism | ||||
---|---|---|---|---|
| ||||
the following code compiled with GDC shows the bug (I'm using the gcc 4.8 windows mingw32 version from https://bitbucket.org/goshawk/gdc/downloads) import std.math; import std.stdio; import std.range; import std.parallelism; void main() { enum n = 1000; float step = 1.0f/n; float[n] results_singlethreaded; float[n] results_multithreaded; foreach(i; iota(n)) results_singlethreaded[i] = pow(step * i, 0.4545f); foreach(i; parallel(iota(n))) results_multithreaded[i] = pow(step * i, 0.4545f); foreach(i; iota(n)) assert(results_singlethreaded[i] == results_multithreaded[i]); } ~/Desktop $ ./test.exe core.exception.AssertError@test.d(26): Assertion failure The same code passes without assertion when compiled with DMD. |
June 02, 2013 Re: std.math.pow produces incorrect results when used with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to finalpatch | Am Sun, 02 Jun 2013 07:17:12 +0200
schrieb "finalpatch" <fengli@gmail.com>:
> the following code compiled with GDC shows the bug
> (I'm using the gcc 4.8 windows mingw32 version from
> https://bitbucket.org/goshawk/gdc/downloads)
>
> import std.math;
> import std.stdio;
> import std.range;
> import std.parallelism;
>
> void main()
> {
> enum n = 1000;
> float step = 1.0f/n;
>
> float[n] results_singlethreaded;
> float[n] results_multithreaded;
>
> foreach(i; iota(n))
> results_singlethreaded[i] = pow(step * i, 0.4545f);
> foreach(i; parallel(iota(n)))
> results_multithreaded[i] = pow(step * i, 0.4545f);
> foreach(i; iota(n))
> assert(results_singlethreaded[i] ==
> results_multithreaded[i]);
> }
>
> ~/Desktop $ ./test.exe
> core.exception.AssertError@test.d(26): Assertion failure
>
> The same code passes without assertion when compiled with DMD.
Please file a bug report on bugzilla.gdcproject.org
I can't reproduce this on linux/posix. Could you use feqrel to check the number of equal bits of the single/multithreaded results?
|
June 02, 2013 Re: std.math.pow produces incorrect results when used with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | Bug reported as #58 http://bugzilla.gdcproject.org/show_bug.cgi?id=58 I have added the output from feqrel to the report. On Sunday, 2 June 2013 at 08:28:42 UTC, Johannes Pfau wrote: >> >> The same code passes without assertion when compiled with DMD. > > Please file a bug report on bugzilla.gdcproject.org > > I can't reproduce this on linux/posix. Could you use feqrel to check > the number of equal bits of the single/multithreaded results? |
Copyright © 1999-2021 by the D Language Foundation