#1429: Assertion error when using "eval" & new UIUC speedup in TwoPunctures ---------------------------------------+------------------------------------ Reporter: bernard.j.kelly@… | Owner: Type: defect | Status: new Priority: major | Milestone: ET_2013_11 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: TwoPunctures, malloc ---------------------------------------+------------------------------------
Comment (by rhaas):
Sorry for the tardy reply, the bug report was indeed very concise and clear.
I agree that the memory management in TP_utilities is unnecessarily complex. It tries to be a drop in replacement for the (C-language) numerical recipes routines which allowed to have arrays to start with 1 instead of 0 (or any other offset for that matter). Not sure about the extra entry that they all allocate in each dimenension. It is possible that TP actually does us all elements from 0 to N inclusive (would need to check). Does anyone remember?
The patch included however allocates the wrong type namely typeof(CCTK_REAL *) rather than typeof(CCTK_REAL) in line 48 of the patch. For typical machines this will go unnoticed since sizeof(CCTK_REAL)==sizof(double)==sizeof(void*)==8.
Otherwise it seems to be ok (baring issues that TP might use element "L" which I don't remember anymore).
I wonder though if simply changing the original code as outlined in the description "the last factor should be (ndh-ndl+1), not (nrh-nrl+1)" would be sufficient? Mind you that I am the one responsible for the original buggy code should not have that much of an influence :-)