Skip to content

docs: correct outdated and misleading API docstrings (backport #60) - #61

Merged
Jim Garrison (garrison) merged 1 commit into
stable/1.7from
mergify/bp/stable/1.7/pr-60
Oct 14, 2026
Merged

Jim Garrison (garrison) merged 1 commit into
stable/1.7from
mergify/bp/stable/1.7/pr-60

Conversation

@mergify

@mergify mergify Bot commented Oct 14, 2026

Copy link
Copy Markdown

A scan of everything the docs site renders (the landing page, the three API pages and the 22 docstrings they pull in) turned up statements that are out of date or misleading. Each was checked against the code. This fixes them. Docstrings and one table row only; no code changes.

Wrong

  • gpu-omp was missing from the device lists. tpb_diag, tpb_diag_from_files and gdb_diag documented device as ('cpu', 'gpu', or None), and get_backend as 'cpu', 'gpu', 'auto', or None. All four pass device to get_backend, which accepts 'gpu-omp' and its aliases. gdb_diag now also says that 'gpu-omp' runs GDB on the host, since SBD has no OpenMP-offload GDB code.
  • get_backend(None) does not mean "the default". It resolves to _default_device or 'auto', so before anything has initialized it is 'auto', which prefers Thrust. Meanwhile the first tpb_diag or gdb_diag call initializes with 'cpu'. The docstring now says this and recommends calling init() to avoid depending on call order.
  • The bit_length row limited the odd-value hazard to GDB's heatbath expansion. Upstream's own diag also gives a wrong plain-diagonalization energy at --bit_length 31 on its bundled Fe4S4 data (GDB app: odd --bit_length gives a different energy or a crash (Fe4S4). Is an even value expected? r-ccs-cms/sbd#104), so the row now covers all GDB use with multi-word determinants.

Misleading or incomplete

  • tpb_diag_from_files takes one determinant file and uses it for both alpha and beta (bdet = adet upstream); the docstring now says so, and points to tpb_diag for different lists.
  • init now lists gdb_diag among the calls that take a per-call device.
  • get_backend said passing device is how you switch between CPU and GPU in one process. That holds except for the CPU backend together with gpu-omp, the combination the 1.7 release notes warn about; it now says so.
  • assemble_rdms cited a private repository for SBD's RDM layout. It now cites upstream SBD's docs/user-guide.md, which documents exactly that layout, and no longer refers to code "below".
  • from_strings, get_backend and DeviceConfig.gpu_omp linked to from_string, makestring and has_backend_conflict, none of which is on the API page, so they rendered as plain text. They are now literals, which adds no API surface.
  • DeviceConfig's usage example called the undocumented apply() on a TPB_SBD object named sbd_config, a name that means a dict elsewhere. It now passes the config to solve_sci_batch(device_config=...).

Minor

  • TPB_SBD, GDB_SBD, LoadFCIDump and LoadAlphaDets get real docstrings. LoadAlphaDets documents its arguments, and that it neither sorts nor deduplicates.
  • DeviceConfig.auto drops development history and a reference to a private function.
  • The from_strings examples use bit_length 62 instead of 63; the new outputs were checked by running them and round-tripping through makestring.

sphinx-build -W -T --keep-going, the command tox -e docs runs, succeeds with no warnings, and every new passage appears on the rendered pages. Labelled for backport, because the site deploys from stable/1.7.

🤖 Generated with Claude Code


This is an automatic backport of pull request #60 done by [Mergify](https://mergify.com).

* docs: correct outdated and misleading API docstrings

- tpb_diag, tpb_diag_from_files, gdb_diag and get_backend list 'gpu-omp' and
  the aliases; gdb_diag says gpu-omp runs GDB on the host.
- get_backend says what None resolves to ('auto' before any init, 'cpu' once
  a diag call has initialized) and that cpu + gpu-omp must not share a process.
- init lists gdb_diag among the per-call device overrides.
- tpb_diag_from_files says its one file supplies both alpha and beta.
- TPB_SBD, GDB_SBD, LoadFCIDump and LoadAlphaDets get real docstrings.
- assemble_rdms cites upstream SBD's docs/user-guide.md, not a private repo.
- DeviceConfig's example passes the config to solve_sci_batch instead of the
  undocumented apply(); auto() drops development history.
- References to functions not on the API page become literals, so they no
  longer render as dead links; from_strings examples use bit_length 62.
- The bit_length row covers odd values in all GDB use, not only the heatbath
  expansion: upstream's own diag gives a wrong plain-diagonalization energy at
  31 on Fe4S4 (r-ccs-cms/sbd#104).

Docstrings and one table row only; no code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: LoadAlphaDets sorts and removes duplicates

Upstream's LoadAlphaDets ends with an unconditional sort_bitarray
(makedeterminants.h:190), so the result is sorted and distinct, not in file
order, and needs no further sort. Also note that only .txt and .bin are read:
any other extension returns an empty list without an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b3bf3fa)
@garrison
Jim Garrison (garrison) merged commit c234aea into stable/1.7 Oct 14, 2026
17 checks passed
@garrison
Jim Garrison (garrison) deleted the mergify/bp/stable/1.7/pr-60 branch October 14, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants