michael-hartmann / caps

The Casimir Effect in the plane-sphere geometry.
GNU General Public License v2.0
4 stars 1 forks source link

Wrong results from casimir #32

Closed michael-hartmann closed 7 years ago

michael-hartmann commented 7 years ago

In the MPI program casimir there seems to be some kind of race condition. If there are processes, some values of logdetD(xi,m) for some m are wrong. If only one core is used for the calculation, this problem does not seem to occur.

michael-hartmann commented 7 years ago

The problem disappears when using LAPACK and LU decomposition. Therefore the problem is probably related to HODLR.

michael-hartmann commented 7 years ago

Maybe this is an issue with rand and srand in the HODL code.

michael-hartmann commented 7 years ago

It does not seem to be related to the calls of rand and srand in the HODLR library.

michael-hartmann commented 7 years ago

The problem is not related to Drude. Also, casimir_logdetD gives correct results. The function slave also gets the correct input parameters and returns the (maybe wrong) value of logdetD correctly.

michael-hartmann commented 7 years ago

don't calling casimir_set_ldim solves the problem - very strange

michael-hartmann commented 7 years ago

==8500== Conditional jump or move depends on uninitialised value(s) ==8500== at 0x5FF29D3: __printf_fp_l (printf_fp.c:1212) ==8500== by 0x5FECB81: printf_positional (vfprintf.c:2022) ==8500== by 0x5FEE4A5: vfprintf (vfprintf.c:1677) ==8500== by 0x5FF0EF0: buffered_vfprintf (vfprintf.c:2320) ==8500== by 0x5FEE32C: vfprintf (vfprintf.c:1293) ==8500== by 0x5FF6898: printf (printf.c:33) ==8500== by 0x4020AB: main (casimir_logdetD.c:230) ==8500== Uninitialised value was created by a heap allocation ==8500== at 0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8500== by 0x5B6C6E6: HODLR_Tree::create_Tree(HODLR_Node&) (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x5B6CAD7: HODLR_Tree::create_Tree(HODLR_Node&) (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x5B6CAD7: HODLR_Tree::create_Tree(HODLR_Node&) (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x5B6CAD7: HODLR_Tree::create_Tree(HODLR_Node&) (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x5B6AAD0: hodlr_logdet_diagonal (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x5B6B638: hodlr_logdet (in /home/michael/git/hodlr_wrapper/libhodlr.so) ==8500== by 0x40C3E7: casimir_logdetD0_hodlr (libcasimir.c:1046) ==8500== by 0x40C2FD: casimir_logdetD0 (libcasimir.c:1020) ==8500== by 0x40202E: main (casimir_logdetD.c:227)

michael-hartmann commented 7 years ago

The problem is probably connected with the parameter nLeaf - increasing this parameter might solve this issue.

michael-hartmann commented 7 years ago

"nLeaf is the size (number of rows of the matrix) of the smallest block at the leaf level. The number of levels in the tree is given by log_2(N/nLeaf)"

michael-hartmann commented 7 years ago

hopefully fixed by: https://github.com/michael-hartmann/hodlr_wrapper/commit/34bda2ddf82b90452cd19a15dfcd1bf4cd071057

michael-hartmann commented 7 years ago

The bug was indeed the uninitialized variable in the HODLR library.