Repository navigation
GPEC, DCON, RDCON, STRIDE - BUGFIX - Fix LAPACK and ZVODE type and size errors - #299
Conversation
|
Thanks to @StuartBenjamin for pointing out that this issue was more widespread than previously thought |
| key=-ABS(1/evals) | ||
| CALL bubble(key,index,1,mpert) | ||
| c----------------------------------------------------------------------- | ||
| c compute inverse plasma response matrix (zheev destroys wp). |
There was a problem hiding this comment.
I am surprised to see this needed here since I see no new zheev in the diff and even a Xtmp=X guard added. Is this fixing a bug introduced by another PR? If so, it needs to be clearly marked as urgent!
It seems like that style of guard is the better way to go rather than introducing repeat wp calculations that are hard to maintain.
Even the rdcon diff is different from the dcon one already. Inevitably someone will change the original wp calculation location and not realize they need to go fix these other locations as well.
There was a problem hiding this comment.
We could do instead an Xtmp=X type thing, yes, and I see your point why that one would be better. Though I am not sure I understand the rest of your comment about another PR. The ZHEEV statement that had the bug looks like it was added 10 years ago when you added RDCON.
|
@claude review this PR |
|
Claude finished @logan-nc's task in 46s —— View job PR review: LAPACK and ZVODE type and size fixesI read the full diff. I haven't compiled it or run any cases, so the review is from reading the code only. The fixes look correct, and I found nothing blocking. Two points below are worth acting on. Reply to the inline question on This is not a regression from another PR. In the base branch, This is not urgent. It only affects the diagnostic Changes I checked
Suggestions
CLAUDE.md compliance: I did not check every changed |
logan-nc
left a comment
There was a problem hiding this comment.
@matt-pharr ignore the claude item 3. Item 1 is overkill I think since we plan to stop actively developing fortran anyways and the wptmp approach still requires inversion (doesn't save many lines / opportunities for mistakes).
Item 2 would be nice if you have time. If not, then it's not blocking.
|
@matt-pharr I leave this to you to hit "merge" when happy |
Fixes a number of semantic errors according to the LAPACK documentation. Different implementations of LAPACK may or may not be unsafe to these errors, but some certainly caused undefined behavior on my laptop:
wmatthat was missed in a past variable renaming circa 2020 which messed up W_xe_eigenvalues in gpecThese instances are easily discernible from each other by looking at the small code diff. This does fix a number of behaviors, including the eigenvalues of the reluctance, the vacuum matrix, and eigenvalues of the inverse plasma energy matrix.
Here is Claude's list of what changed:
What changed (11 files, 56 insertions, 21 deletions):
wmattypo, soW_xe_eigenvalue/W_xe_ampare real numbers againgpec/gpout.fpermeabsvdeclaredREAL(r8), so thes_Pcolumn has all singular values at full precisiongpec/gpglobal.F,gpec/gpout.fevis now real; the netcdfW_v_eigenvalueis 1-D like dcon's after #256rdcon/free.f,rdcon/rdcon_netcdf.f,rdcon/dcon.fevalsicomputed from an independently built inverse response matrixdcon/ode_output.friccati_eigcopiesXbefore ZHEEVstride/riccati.fgpdiagev/evodeclared realgpec/gpdiag.flwork=2*mpert-1reset before ZHEEVdcon/free.f,rdcon/free.fzeropassed asBETAtozgbmv/zhbmvstride/sing.Fdcon/ode_output.f,rdcon/ode_output.f