
Hi, I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model. When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts. The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package. I was wondering whether this profiling problem is known. Best Wishes, Greg

[I forgot to reply-all first time. Sorry.]
Perhaps it's not a problem with profiling itself, but rather with
rewrite rules for hmatrix or some other package. If they fire they can
alter semantics of computations, and thus change numerical properties
of code.
Best regards
Krzysztof Skrzętnicki
On Mon, Mar 22, 2010 at 15:22, Gregory Wright
Hi,
I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model.
When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts.
The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package.
I was wondering whether this profiling problem is known.
Best Wishes, Greg
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hi, On 3/22/10 10:22 AM, Gregory Wright wrote:
Hi,
I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model.
When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts.
The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package.
I was wondering whether this profiling problem is known.
Best Wishes, Greg
The previously attach tarball was missing most of its contents, courtesy of my ham-fisted emacs technique. The tarball attached to this message has been tested by building and shows the problem mentioned above. -Greg

I got some results from GHC 6.12.1, Linux i686. In short: both
profiling and normal run produce the same final results, but there are
some differences. I don't know if they are valid or not.
./nsyn | tail
1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
./nsyn-prof | tail
1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7
1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
Best regards
Krzysztof Skrzętnicki
2010/3/22 Gregory Wright
Hi,
On 3/22/10 10:22 AM, Gregory Wright wrote:
Hi,
I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model.
When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts.
The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package.
I was wondering whether this profiling problem is known.
Best Wishes, Greg
The previously attach tarball was missing most of its contents, courtesy of my ham-fisted emacs technique. The tarball attached to this message has been tested by building and shows the problem mentioned above.
-Greg

Hi Krzysztof, On 3/22/10 2:42 PM, Krzysztof Skrzętnicki wrote:
I got some results from GHC 6.12.1, Linux i686. In short: both profiling and normal run produce the same final results, but there are some differences. I don't know if they are valid or not.
./nsyn | tail 1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
./nsyn-prof | tail 1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
Best regards
Krzysztof Skrzętnicki
2010/3/22 Gregory Wright
: Hi,
On 3/22/10 10:22 AM, Gregory Wright wrote:
Hi,
I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model.
When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts.
The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package.
I was wondering whether this profiling problem is known.
Best Wishes, Greg
The previously attach tarball was missing most of its contents, courtesy of my ham-fisted emacs technique. The tarball attached to this message has been tested by building and shows the problem mentioned above.
-Greg
Now they seem to both be correct. The key value is at the bottom of column 8. This should be 2.386e-1 (which means that 23.86 percent of the protons in the early universe end up as helium). So it seems that this is a problem either with 6.10.4, or with OS X. Quite strange. I will try to get 6.12 building on my machine to see if the problem persists. -Greg

On Mon, Mar 22, 2010 at 02:54:26PM -0400, Gregory Wright wrote:
Now they seem to both be correct. The key value is at the bottom of column 8. This should be 2.386e-1 (which means that 23.86 percent of the protons in the early universe end up as helium). So it seems that this is a problem either with 6.10.4, or with OS X.
Quite strange. I will try to get 6.12 building on my machine to see if the problem persists.
It would also be worth trying without the -optc-O3 and -optc-ffast-math flags, as the different code generated may confuse the mangler. If none of that helps, can you file a ticket please? If you can boil it down to a small self-contained testcase (in particular, removing the hmatrix dependency, if necessary by inlining code you need from it) that would make it easier to investigate. Thanks Ian

On 3/31/10 11:44 AM, Ian Lynagh wrote:
On Mon, Mar 22, 2010 at 02:54:26PM -0400, Gregory Wright wrote:
Now they seem to both be correct. The key value is at the bottom of column 8. This should be 2.386e-1 (which means that 23.86 percent of the protons in the early universe end up as helium). So it seems that this is a problem either with 6.10.4, or with OS X.
Quite strange. I will try to get 6.12 building on my machine to see if the problem persists.
It would also be worth trying without the -optc-O3 and -optc-ffast-math flags, as the different code generated may confuse the mangler.
If none of that helps, can you file a ticket please? If you can boil it down to a small self-contained testcase (in particular, removing the hmatrix dependency, if necessary by inlining code you need from it) that would make it easier to investigate.
Thanks Ian
Removing -optc-O3 and -optc-ffast-math did not help. In fact, I took at all of the ghc options I was passing and the problem is still there. I will try to reduce the failure to a self contained testcase. I don't use much from hmatrix --- aside from the LU solution for a matrix system, just basic matrix addition, subtraction, scaling and the dot product. Best, Greg

On 01/04/2010 02:10, Gregory Wright wrote:
On 3/31/10 11:44 AM, Ian Lynagh wrote:
On Mon, Mar 22, 2010 at 02:54:26PM -0400, Gregory Wright wrote:
Now they seem to both be correct. The key value is at the bottom of column 8. This should be 2.386e-1 (which means that 23.86 percent of the protons in the early universe end up as helium). So it seems that this is a problem either with 6.10.4, or with OS X.
Quite strange. I will try to get 6.12 building on my machine to see if the problem persists. It would also be worth trying without the -optc-O3 and -optc-ffast-math flags, as the different code generated may confuse the mangler.
If none of that helps, can you file a ticket please? If you can boil it down to a small self-contained testcase (in particular, removing the hmatrix dependency, if necessary by inlining code you need from it) that would make it easier to investigate.
Thanks Ian
Removing -optc-O3 and -optc-ffast-math did not help. In fact, I took at all of the ghc options I was passing and the problem is still there. I will try to reduce the failure to a self contained testcase. I don't use much from hmatrix --- aside from the LU solution for a matrix system, just basic matrix addition, subtraction, scaling and the dot product.
There is already a ticket for this issue: http://hackage.haskell.org/trac/ghc/ticket/3942 Please update it if you have more information. Cheers, Simon

On OS X 10.5.9 with ghc 6.10.4 with no profiling I get : 1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 but with profiling turned on I get 1301464.458 0.01 8.545e-1 9.002e-1 3.312e-12 5.820e-24 6.174e-24 1.367e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 1379801.447 0.01 8.545e-1 9.293e-1 3.312e-12 5.820e-24 6.174e-24 1.411e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 1462853.640 0.01 8.545e-1 9.596e-1 3.312e-12 5.820e-24 6.174e-24 1.458e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 1550904.850 0.01 8.545e-1 9.947e-1 3.312e-12 5.820e-24 6.174e-24 1.511e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 1644255.972 0.01 8.545e-1 1.032e0 3.312e-12 5.820e-24 6.174e-24 1.568e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 1743226.010 0.01 8.545e-1 1.074e0 3.312e-12 5.820e-24 6.174e-24 1.631e-34 1.505e-58 3.780e-70 3.586e-70 7.960e-82 It's not just a matter of some addition numerical inaccuracy; the numbers are off by orders of magnitude. -Greg On 3/22/10 2:42 PM, Krzysztof Skrzętnicki wrote:
I got some results from GHC 6.12.1, Linux i686. In short: both profiling and normal run produce the same final results, but there are some differences. I don't know if they are valid or not.
./nsyn | tail 1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
./nsyn-prof | tail 1080826.599 0.01 8.483e-15 7.612e-1 7.753e-5 2.517e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1134406.808 0.01 6.911e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1191190.672 0.01 5.615e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1251481.495 0.01 4.548e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1315638.396 0.01 3.671e-15 7.612e-1 7.753e-5 2.516e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1384093.315 0.01 2.952e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1457375.318 0.01 2.364e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1535826.102 0.01 1.884e-15 7.612e-1 7.753e-5 2.515e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1619603.195 0.01 1.495e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16 1709306.677 0.01 1.180e-15 7.612e-1 7.753e-5 2.514e-7 1.566e-5 2.387e-1 3.089e-14 6.337e-11 5.791e-11 5.665e-16
Best regards
Krzysztof Skrzętnicki
2010/3/22 Gregory Wright
: Hi,
On 3/22/10 10:22 AM, Gregory Wright wrote:
Hi,
I have a program (attached) that is relatively simple, but numerically intensive. It computes the abundances of the chemical elements generated by big-bang nucleosynthesis. At the moment, the executable takes no command line arguments, it simply runs the standard model.
When I build the program without profiling, it produces the right answer. When I build it with profiling (runhaskell configure --enable-executable-profiling) it runs without error, but gives completely incorrect numerical results. I'm using ghc 6.10.4 built from source using MacPorts.
The program is mostly self contained, but uses the hmatrix package to solve a linear system. Note also that the "Vector" type is hmatrix's Data.Packed.Vector and not the one from the more familiar "vector" package.
I was wondering whether this profiling problem is known.
Best Wishes, Greg
The previously attach tarball was missing most of its contents, courtesy of my ham-fisted emacs technique. The tarball attached to this message has been tested by building and shows the problem mentioned above.
-Greg
participants (4)
-
Gregory Wright
-
Ian Lynagh
-
Krzysztof Skrzętnicki
-
Simon Marlow