Add warn_on_resize option to DiffCache#161
Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom Mar 25, 2026
Merged
Conversation
Add a `warn_on_resize` keyword argument (default `true`) to `DiffCache` constructors that controls whether a warning is emitted when the cache is automatically enlarged during `get_tmp`. This is useful for adaptive solvers (e.g. BVP solvers) where cache expansion is expected behavior and the warning is noise. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChrisRackauckas
approved these changes
Mar 25, 2026
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
warn_on_resize::Boolfield toDiffCacheand a corresponding keyword argument (defaulttrue) to all constructorswarn_on_resize = false, the warning inenlargediffcache!is suppressedzeroandcopypreserve thewarn_on_resizesettingMotivation
Adaptive BVP solvers (and other adaptive algorithms) expect cache expansion as normal behavior. Currently, downstream packages have to wrap
get_tmpcalls inLogging.with_logger(Logging.NullLogger())to suppress the warning, which adds overhead and obscures the code:With this PR, they can simply construct the cache with warnings disabled:
Usage
Test plan
warn_on_resizefield is set correctly on constructionwarn_on_resize = falsesuppresses warning during cache enlargement (@test_nowarn)zeroandcopypreserve thewarn_on_resizesetting🤖 Generated with Claude Code