Skip to content

Share the grid arrays when copying a NoiseGrid - #337

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
singhharsh1708:noisegrid-share-grid-on-copy
Sep 26, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
singhharsh1708:noisegrid-share-grid-on-copy

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Copying a NoiseGrid no longer duplicates its t, W and Z arrays. StochasticDiffEqCore copies prob.noise in __init and copies the result back at the end of __solve, so every solve on a stored grid paid for the whole grid twice: a 16-step RandomEM solve on a 2^16-point grid took 520 us and now takes 7.9 us, and 2.9 ms against 9.9 us with vector-valued points.

A solve only reads the grid: reinit!, the interpolation and the step functions write the step state alone. So the new copy! shares the arrays and copies curW, dW, curZ, dZ and cur_time. SciMLSensitivity's checkpointing builds its forward-noise grid from slices of sol.W and never writes into one. The visible change is that editing a grid's arrays by hand after copying it now shows up in the copy.

AI Disclosure: Claude assisted with this change.

@ChrisRackauckas
ChrisRackauckas merged commit 0aab909 into SciML:master Sep 26, 2026
19 checks passed
ChrisRackauckas referenced this pull request Sep 26, 2026
Agent-Harness: Claude Code
Agent-Model: claude-opus-5-5[1m]
Agent-Session: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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