Skip to content

Make 32-bit GBM Monte-Carlo test deterministic (seed the solve) - #101

Merged
ChrisRackauckas merged 1 commit into
masterfrom
agent/x86-gbm-seed
Nov 2, 2026
Merged

ChrisRackauckas merged 1 commit into
masterfrom
agent/x86-gbm-seed

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

The 32-bit GBM Monte-Carlo check ran 20k trajectories with no fixed seed, so its SSE (testerr) varied run to run and occasionally exceeded the 15.0 bound (28.34 in the CI run below). This change passes seed = 12345 to the ensemble solve on 32-bit only, making testerr bit-identical across runs while leaving the 64-bit path and the sources untouched.

Fail-before (unfixed code, x86 Julia 1.13.3, same 20k-trajectory block, 6 runs):

WORD_SIZE=32 ntraj=20000 testerr=2.206954754436723
WORD_SIZE=32 ntraj=20000 testerr=1.6600254180938545
WORD_SIZE=32 ntraj=20000 testerr=0.40103153588168355
WORD_SIZE=32 ntraj=20000 testerr=0.7657682352202329
WORD_SIZE=32 ntraj=20000 testerr=1.1569427086355502
WORD_SIZE=32 ntraj=20000 testerr=1.5398439754270343

Values vary every run (no two equal). I could not draw a red (> 15.0) sample locally in 6 tries (range 0.40-2.21); the red sample is the CI run https://github.com/SciML/DiffEqFinancial.jl/actions/runs/41034390961 (master, lane Core julia 1 / ubuntu-latest / x86, Julia 1.13.3 i686): 28.336282316416803 < 15.0 failed.

Pass-after (fixed code, GROUP=Core julia +1.13.3~x86 --project=. -e 'using Pkg; Pkg.test()', 3 consecutive runs, all green):

Run 1: Core/analytical_tests.jl | 42 42 | Core/core_tests.jl | 1 1 | Core/interface_tests.jl | 17 17 | Core/precompile_workload.jl | 3 3 | Testing DiffEqFinancial tests passed
Run 2: Core/analytical_tests.jl | 42 42 | Core/core_tests.jl | 1 1 | Core/interface_tests.jl | 17 17 | Core/precompile_workload.jl | 3 3 | Testing DiffEqFinancial tests passed
Run 3: Core/analytical_tests.jl | 42 42 | Core/core_tests.jl | 1 1 | Core/interface_tests.jl | 17 17 | Core/precompile_workload.jl | 3 3 | Testing DiffEqFinancial tests passed

Determinism proof (exact fixed block: 20k traj, seed = 12345, x86 Julia 1.13.3; the suite itself does not print testerr):

seeded run 1 (1 thread): WORD_SIZE=32 ntraj=20000 testerr=2.3669735626875714
seeded run 2 (1 thread): WORD_SIZE=32 ntraj=20000 testerr=2.3669735626875714
seeded run 3 (1 thread): WORD_SIZE=32 ntraj=20000 testerr=2.3669735626875714
seeded run 4 (8 threads): WORD_SIZE=32 ntraj=20000 testerr=2.3669735626875714

Same value to the last digit on every run, independent of thread count (SciMLBase pre-generates per-trajectory seeds from the master seed), and well under the unchanged 15.0 bound.

Not verified here: the full 64-bit suite (the 1M-trajectory branch is intentionally untouched — the seed applies only when Sys.WORD_SIZE == 32, so no x64 re-run was done) and the QA group. This is a test-only determinism change; no source behavior changes. Hygiene: typos clean over the diff; the runic binary on this box is the unrelated "Runic parallel-development" CLI (no formatter command), so no formatter run was possible — the edit follows the surrounding style.

🤖 Generated with opencode (model: opencode-go/muse-spark-1.3-contributor)
local session ses_e73a90d38ffe1Tz6MoJOF1yTDs (no session URL)

Seed the 32-bit EnsembleProblem solve with seed=12345 so testerr is
reproducible to the last digit. 64-bit path untouched.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Agent-Harness: opencode CLI
Agent-Model: opencode-go/muse-spark-1.3-contributor
Agent-Session: local session ses_e73a90d38ffe1Tz6MoJOF1yTDs (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Codex CLI 0.164.0 / gpt-6.1-sol), session 01a19657-37be-7341-b81a-4aac7bc86df7, reviewed head 14ad886

  • Verdict: MERGE
  • Risk: low (L2: the only functional edit supplies a fixed seed to the 32-bit test ensemble; the 64-bit branch and numerical assertion are unchanged)
  • Round / slot: 1 / 1
  • Blocking priorities: none

Review written by the reviewer named above in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.

Summary: Seeds the existing 32-bit geometric Brownian motion ensemble test while preserving its analytic reference, trajectory count, and error bound. The affected x86 CI test passes, and the diff has no blocking defects.

Blast radius: The 20,000-trajectory branch in test/core_tests.jl:30; no exported API, solver implementation, dependency, or workflow changes.

Evidence: Complete diff and surrounding code inspected; blind rating recorded and hashed before reading author context. Inspected master x86 CI failure, 28.336282316416803 < 15.0, and PR x86 CI success, Core/core_tests.jl | 1 1. Both used Julia 1.13.3, SciMLBase 3.58.0, and StochasticDiffEq 7.2.0. All reported PR checks passed. No local Julia runs.

Blocking findings

None.

Non-blocking findings

None.

What I ran

  • gh pr view 101 --repo SciML/DiffEqFinancial.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid (exit 0): open draft, live head matches the target, base is the SHA above.
  • In the source checkout: git status --short (exit 0, clean); git fetch origin '+refs/pull/101/head:refs/remotes/pr/101' master; git checkout --detach pr/101; git rev-parse HEAD origin/master; git merge-base origin/master HEAD; git diff --stat origin/master...HEAD; git diff origin/master...HEAD (all exit 0). Merge-base equals Base. Diff: one test file, seven insertions and one deletion.
  • Read test/core_tests.jl, Project.toml, test/runtests.jl, test/test_groups.toml, .github/workflows/Tests.yml, and the GBM constructor in src/problems.jl:128. The independent oracle remains S0 * exp.(r * tsteps); no tolerance, coverage, or numerical implementation was changed. Repository instruction-file search found no AGENTS.md or CLAUDE.md.
  • sha256sum INITIAL.md > INITIAL.sha256 (exit 0), before author context. codex --version (exit 0): codex-cli 0.164.0.
  • gh pr view 101 --repo SciML/DiffEqFinancial.jl --json title,body,statusCheckRollup,commits; gh pr checks 101 --repo SciML/DiffEqFinancial.jl (exit 0): all reported checks passed, including Core x86, ordinary Core, LTS, QA, downgrade, format, documentation, and benchmarks. No linked issue requiring inspection was present.
  • gh run list --repo SciML/DiffEqFinancial.jl --branch master --event push --limit 5 --json databaseId,headSha,status,conclusion,url (exit 0): the latest test run is the failure at Base, master run 41034390961.
  • XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 41034390961 --repo SciML/DiffEqFinancial.jl --log-failed (exit 0): x86 Core failed at test/core_tests.jl:34 on base, Evaluated: 28.336282316416803 < 15.0; 0 passed, 1 failed, 0 errored, 0 broken.
  • XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 41042552696 --repo SciML/DiffEqFinancial.jl --job 124018746763 --log (exit 0): PR x86 Core job checks out the merge of the reviewed head into Base and reports Core/core_tests.jl | 1 1, followed by DiffEqFinancial tests passed. Both inspected CI logs identify Julia 1.13.3 and the same relevant dependency versions. Initial log-fetch attempts failed because the default CLI cache was read-only; using the workspace cache succeeded.
  • git log -1 --no-merges --format=%B (exit 0): author harness and model taken only from the newest non-merge commit trailers.
  • Julia executions: zero. No new regression assertion is added by this PR; the existing statistical assertion fails before and passes after in inspected CI. I did not establish failing-before/passing-after through my own Julia runs. This is test stabilization under L2, rather than a production behavior fix under L6, ML1, or ML2.

What I did not verify

I did not execute Julia locally, run either revision's test file, reproduce the intermittent base failure myself, or independently repeat the seeded solve to establish bitwise reproducibility across runs or thread counts. Native 32-bit execution is supported here by the inspected x86 CI job; the local host is aarch64. I did not run a full package suite, downstream suites, or GPU, AD, MPI, or tracing tests; none of those paths is changed. The PR remains a draft, so the MERGE verdict assesses its technical contents rather than changing its publication state.

🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74

@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as ready for review November 2, 2026 02:01
@ChrisRackauckas
ChrisRackauckas merged commit 2c6f414 into master Nov 2, 2026
14 checks passed
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