dmrg: refuse MEASURE_* parameters with a clear error instead of SIGSEGV - #101
Open
skilledwolf wants to merge 1 commit into
Open
dmrg: refuse MEASURE_* parameters with a clear error instead of SIGSEGV#101skilledwolf wants to merge 1 commit into
skilledwolf wants to merge 1 commit into
Conversation
The classic dmrg binary crashes with SIGSEGV on every input that requests MEASURE_LOCAL, MEASURE_AVERAGE, MEASURE_CORRELATIONS, or MEASURE_STRUCTURE_FACTOR (tutorials dmrg-03 and dmrg-04 are visible consumers): dmtk::System::rotate_hami dereferences the result of System::operator()(op) without a null check, and the lookup legitimately returns 0 while a measurement operator's site is not yet covered by the current block layout during early final_sweep iterations near the chain endpoints. A skip-null guard at the call sites is NOT a fix: it compiles but silently drops legitimate measurement terms wholesale (Sz_total=2 sums to 0.15 instead of 2). Correctly fixing the legacy path needs the block operator-set bookkeeping re-derived so measurement operators are guaranteed present at every iteration. Until someone does that surgery, fail fast in DMRGTask::dostep with an actionable message pointing at the mps_optim binary, which accepts the same parameter-file syntax and measures correctly. Before: rc=139 (SIGSEGV), empty stderr. After: clean nonzero exit with a single-line explanation. Diagnosed (lldb: BasicOp::is_diagonal called on this=0x0 via rotate_hami) and fixed by the ALPS modernization fork, where the guard is pinned by an API regression test asserting the non-signal exit code and the actionable stderr text. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> v2: reworded the guidance — mps_optim was removed upstream (PR ALPSim#92), so the error now suggests dropping MEASURE_* or using a release that still ships mps_optim.
skilledwolf
marked this pull request as ready for review
July 19, 2026 13:44
Contributor
|
@afeiguin give me a sign of life here – do you have capacity to deal with this or should we sign up others? |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The classic
dmrgbinary crashes with SIGSEGV on every input that requestsMEASURE_LOCAL,MEASURE_AVERAGE,MEASURE_CORRELATIONS, orMEASURE_STRUCTURE_FACTOR:dmtk::System::rotate_hamidereferences the result ofSystem::operator()(op)without a null check, and the lookup legitimately returns 0 while a measurement operator's site is not yet covered by the current block layout during earlyfinal_sweepiterations near the chain endpoints. Diagnosed with lldb:BasicOp::is_diagonalcalled onthis == 0x0viarotate_hami.A skip-null guard at the call sites is not a fix: it compiles but silently drops legitimate measurement terms wholesale (a
Sz_total=2local-Sz sum comes out as 0.15 instead of 2). Correctly fixing the legacy path needs the block operator-set bookkeeping re-derived so measurement operators are guaranteed present at every iteration.Fix
Until someone does that surgery, fail fast in
DMRGTask::dostepwith an actionable message when anyMEASURE_*parameter is present. Since #92 removed themps_optimapplication (which supported the sameMEASURE_*syntax), the message suggests dropping theMEASURE_*parameters (energy/entropy still work) or using an ALPS release that still shipsmps_optim.How to reproduce
Save as
parm:exit=139(SIGSEGV) mid-sweep, empty stderrMEASURE_LOCALline and the identical run completes unchanged (exit=0) — the guard only fires when aMEASURE_*parameter is presentThe same crash reproduces with
MEASURE_AVERAGE,MEASURE_CORRELATIONS, andMEASURE_STRUCTURE_FACTOR(the old dmrg-03/dmrg-04 tutorial inputs were public reproducers before the tutorials were removed).Provenance
Diagnosed and guarded in a downstream ALPS modernization fork, where the guard is pinned by an API regression test asserting the non-signal exit code and the actionable stderr text.