Move the DMRG checkpoint logic out of dmtk (#262)?
Maintainers usually reply within 3 days
@marcusr2ML is already working on this.
Since Oct 28, 2026.
Assessment
This issue has not been assessed yet.
Description
For discussion, about #262 (DMRG checkpoints). This would be a refactor with no change in behavior. It is not a request to change #262 now.
What #262 does
dmrg keeps its sweep files (block_*, rho_*, gs_*, system.dat) in <task>.checkpoint/ and commits them after every sweep iteration, so a failed run can be resumed. Lines added at a97c5dcbf:
| file | lines | in dmtk? |
|---|---|---|
dmrg/checkpoint_cache.h (new) |
+439 | no |
dmrg/dmrg.h |
+95 | no |
dmrg/dmtk/filelist.h |
+179 | yes |
dmrg/dmtk/system.h |
+43 | yes |
| tests, CHANGELOG | the rest | no |
About 220 lines go into dmtk. Most of them are in FileList, which grows from a temp-file registry into the checkpoint store: open_entry, commit, the progress file format, staged and committed bookkeeping, sync_path and write_atomically.
The qualm
Most of that is file handling, not DMRG, and it would be easier to maintain outside dmtk. dmtk would keep only what it alone can do:
system.h: separate read and write file names, six one-word changes (get_filenamebecomesget_write_filename/get_read_filenameinwrite_*/read_*for gs, rho and block). This cannot move out. dmtk overwrites its files in place, and the checkpoint relies on writes going to<name>.new.<gen>and being renamed at commit.filelist.h: a hook, meaning a small interface (read name, write name, cleanup) whose default does whatFileListdoes on master.
Everything else in the filelist.h changes (about 160 lines) would move to checkpoint_cache.h.
Two changes in #262 could be separate PRs either way:
- the
System::resume()fix (withSTART_SWEEP, only the first sweep starts atSTART_DIR/START_ITER), already listed under "Fixed"; write_failed: dmtk currently prints "Could not open file" and continues with an empty block.
For
- dmtk changes shrink from about 220 lines to about 25, so what was changed in dmtk is visible at a glance.
- All checkpoint logic is in one file. Reviewing, changing or removing the feature means
checkpoint_cache.hplus the hook. FileListstays a temp-file registry.
Against
- Lifetimes around a global.
dmtk::tmp_filesis a global, and the checkpointCacheis owned by the task. With a hook, the global calls into an object owned byCache. That object has to stay alive and attached until the lasttmp_files.cleanup(), including on the failure path inDMRGTask::run(dmrg.h:624-629at a97c5dcbf:checkpoint.failed(); dmtk::tmp_files.cleanup();). TodayFileListowns all of this state, so the order cannot go wrong. After the refactor it can. - Behavior must be identical. For example, reads within an iteration must see that iteration's staged writes.
dmrg_checkpoint_cache.cmakecovers kill, resume and corrupted entries end to end.dmrg_temporary_files.cpptestsFileListdirectly and would have to be rewritten. - Boilerplate. An abstract interface and a default implementation add about 20-30 lines. That is less than what leaves dmtk, but it is new indirection.
- Dominant language
- C++
- Stars
- 32
- Forks
- 10
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ALPSim/ALPS
-
Parallel Ising example: operator precedence makes the heat-bath energy difference wrongPossibly taken @skilledwolf claimed this 1 day ago. Openarea:tutorials bug scientific-correctness
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ALPSim/ALPS#313 · 1 assignee ·
Maintainers usually reply within 3 days
-
area:parapack bug scientific-correctness
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
area:lattice bug
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Read parameter files straight into the solver input structsPossibly taken @Ooolab claimed this today. Open
ALPSim/ALPS#317 · 1 assignee ·
Maintainers usually reply within 3 days
-
alps/parapack/mpi.h: message sizes are truncated to int without a check; MPI errors are now fatal (CHANGELOG)Possibly taken @skilledwolf claimed this 1 day ago. Openarea:parapack compatibility-change enhancement
Difficulty 3/5 1-2 days Newbie friendliness 57/100
ALPSim/ALPS#315 · 1 assignee ·
Maintainers usually reply within 3 days
Similar issues
-
libc++ test-suite
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
llvm/llvm-project#239851 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug :bug:
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
comp-documentation
Difficulty 1/5 Under an hour Newbie friendliness 84/100
ClickHouse/ClickHouse#129829 ·
Maintainers usually reply within 1 day
-
feature request Python
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days