test_projection_and_cold_runs_can_disagree fails on GH200: the projected ladder lands in the exact triplet

Open Beginner friendly
#153 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
hpc, testing

Research direction

Start with tests/test_project_ladder.py::ProjectionIsNotEquivalentToIndependentRuns::test_projection_and_cold_runs_can_disagree and run the issue’s just test command to reproduce the platform-dependent assertion. Review setUpClass, the proposed FCI root calculation, and the class docstring, then update the test to verify that the ramp matches an exact FCI root and spin value without assuming the singlet sector. Done means the test passes on GH200 while preserving the checks that the cold run reaches the septet and the ramp reaches a lower eigenstate.

Written by the indexing model from the issue text.

Description

bug

🤖 AI text below 🤖

What happened, and what did you expect?

tests/test_project_ladder.py::ProjectionIsNotEquivalentToIndependentRuns::test_projection_and_cold_runs_can_disagree fails on JUPITER (GH200, aarch64). It fails every time, and it is the only failure in the suite:

>       self.assertAlmostEqual(e_ramp, self.exact, delta=1e-9)
E       AssertionError: -107.43018699420406 != -107.43702368448281 within 1e-09 delta (0.006836690278746005 difference)

The 16 → 64 projected ladder converges to the exact lowest triplet (S² = 2), not the singlet ground state. The cold run still lands in the septet as expected. FCI spectrum of the cell (Sz = 0):

E (Ha) S² which run lands here
-107.4370236845 0 ramp, as the test expects
-107.4301869942 2 ramp, on this machine
-107.4161313907 6
-107.3828892179 12 cold run (both machines)

The first two checks in the test (cold and ramp differ by more than 1 mHa, and the ramp is the lower of the two) still pass. Only e_ramp == exact and ramp_s2 < 1e-6 fail.

This is not threading or a random initial state. The test already pins pyscf to one thread when it builds the Hamiltonian. It does not pin scipy's OpenBLAS (pthreads, 64 threads here). Even so:

  • Four runs with default threads and four with OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 produced the same integrals hash and the same triplet, to the last bit.
  • The engine's start is deterministic (the block-H warmup, and noise from a fixed hash seed). The triplet is already chosen at M = 16, and the projection only keeps it.

The cell sits on a basin boundary at the level of floating-point rounding. Nudging h1e by symmetric random noise flips the outcome:

perturbation of h1e M = 16 → M = 64
none triplet → triplet
1e-14 (three different nudges) near-singlet → exact singlet
1e-12 near-singlet → exact singlet
1e-10 triplet → triplet

So whether the test passes depends on the last bits of the integrals that pyscf and BLAS produce on a given platform. Pinning threads makes them reproducible on one machine but not across machines.

A different bond length doesn't help. I scanned R = 1.8 to 2.6 Å (STO-3G, CAS(6,6)), with ten perturbations from 1e-14 to 1e-8 for each R:

  • Every R from 1.9 up has the same knife edge for the ramp: singlet or triplet, and at 2.3 Å once a quintet.
  • At 1.8 Å the cold run no longer gets trapped.
  • The cold run's septet trap is robust at every R from 1.9 up.
How to reproduce it

On a GH200 node, main at 9c815d0 (exa-dmrg 0.1.0b1, Python 3.11.18, numpy 2.4.6, scipy 1.17.1 with scipy-openblas, pyscf 2.15.1, CUDA 13.0, driver 610.57.04):

just test "tests/test_project_ladder.py::ProjectionIsNotEquivalentToIndependentRuns::test_projection_and_cold_runs_can_disagree"

To see the knife edge, add 1e-14 symmetric noise to ham["h1e"] before _session(ham): the test then passes.

Severity

Low - minor issue. The engine is not wrong: both runs converge to exact eigenstates. The test's assumption that the projected ladder reaches the singlet ground state does not hold across platforms.

Proposed fix

Keep the cell. Assert what holds in both basins, and what the class docstring says is the point: the two runs converge to different exact eigenstates, and projection is not equivalent to independent runs. Don't assert which spin sector the ramp picks.

  • In setUpClass, compute the lowest few FCI roots with their S² (fci.direct_spin1.FCI().kernel(..., nroots=4) and fci.spin_op.spin_square0).
  • Keep the cold run's checks: it lands on the septet root (cold_s2 > 1, and e_cold equals that root within 1e-8).
  • Replace assertAlmostEqual(e_ramp, self.exact, delta=1e-9) and assertLess(ramp_s2, 1e-6) with:
    • e_ramp equals one of the FCI roots within 1e-8, and ramp_s2 matches that root's S²: an exact eigenstate, not a stuck intermediate;
    • that root is lower than the cold run's root (this is already checked as e_ramp < e_cold).
  • Update the class docstring. "A projected ladder from M=16 reaches exact CI" becomes "reaches a lower exact eigenstate (the singlet ground state, or the lowest triplet, depending on the last bits of the integrals)".

Sketch:

@classmethod
def setUpClass(cls):
    cls.ham = _hamiltonian("N 0 0 0; N 0 0 2.0", "sto-3g", 6, 6)
    solver = fci.direct_spin1.FCI()
    e, cs = solver.kernel(cls.ham["h1e"], cls.ham["eri"], cls.ham["ncas"],
                          cls.ham["nelecas"], ecore=cls.ham["ecore"], nroots=4)
    cls.roots = [(float(ei), fci.spin_op.spin_square0(c, cls.ham["ncas"], cls.ham["nelecas"])[0])
                 for ei, c in zip(e, cs)]

def _root(self, e, s2):
    match = [r for r in self.roots if abs(r[0] - e) < 1e-8 and abs(r[1] - s2) < 1e-4]
    self.assertTrue(match, "E = %.10f, <S^2> = %.4f is not an exact FCI root" % (e, s2))
    return match[0]

The DMRG measure_s2() values agree with the FCI ones to better than 1e-10 here (2.0000000000, 11.99999999996), so a 1e-4 tolerance on S² is generous.

Another option would be to make the integrals bit-identical across platforms, for example by rounding h1e/eri. That doesn't work: rounding moves the boundary instead of removing it, and the 1e-10 row above shows the outcome flips back and forth at every scale.

Dominant language
C++
Stars
3
Forks
0
Avg merge
2d 1h
Merged PRs (30d)
29

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Algorithmiq/exa-dmrg

All issues in Algorithmiq/exa-dmrg

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.