JanoMinarik / NeverWhere

Skuska
0 stars 1 forks source link

Numerical Error in Batch method. #4

Open JanoMinarik opened 9 years ago

JanoMinarik commented 9 years ago

In cpu code there is a numerical error. To see it, choose myGrid.calcGrid(3, 100).

head out.txt Wrong: Using Intel(R) blas API. == SUCCESS == calculation time: 9.14604 ms no Points: 16496 no AOs: 15 no electrons: 2.655679

Good: Using Intel(R) blas API. == SUCCESS == calculation time: 8.27597 ms no Points: 16496 no AOs: 15 no electrons: 4.999998

bast commented 9 years ago

Please describe where the "good" numbers come from. Is this from a previous code version or from another method?

bast commented 9 years ago

Please also post all commands (including compilation) which are needed to reproduce this problem.

JanoMinarik commented 9 years ago

"good" numbers come from method 1 or method 2.

I use these commands: python neon_example.py > main.cpp make ./main.x > out.txt head out.txt

bast commented 9 years ago

The python generated main.cpp currently does not compile. I will open a new issue for that. But skipping this step I can reproduce the error.

bast commented 9 years ago

OK what I recommend to do is to move the allocation outside of tempMatMull. In the recommended functional programming style we try to have pure functions which do not modify the global state. So the tempMatMull should receive readily allocated arrays (allocated outside) and only compute. Also the vectorwiseProduct routine should not modify global data but receive input, add to it, and return the result. Then the result can be added outside. Also I highly recommend to write unit tests for tempMatMull and vectorwiseProduct. Pure functions are easy to unit test. Functions which modify global state are difficult to test.