Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: remake does not respect specialization #925

Open
devmotion opened this issue Feb 5, 2025 · 4 comments · May be fixed by #938
Open

Regression: remake does not respect specialization #925

devmotion opened this issue Feb 5, 2025 · 4 comments · May be fixed by #938
Labels
bug Something isn't working

Comments

@devmotion
Copy link
Member

devmotion commented Feb 5, 2025

Describe the bug 🐞

remake(prob; f=f) drops the specialization of the provided function f. This is a regression compared with e.g. SciMLBase 2.38.0.

Expected behavior

The function of the constructed problem should have the same specialization as f.

Minimal Reproducible Example 👇

On the master branch:

julia> using SciMLBase

julia> f = ODEFunction{false,SciMLBase.FullSpecialize}((u, p, t) -> u);

julia> prob = ODEProblem(f, nothing, nothing);

julia> SciMLBase.specialization(prob.f)
SciMLBase.FullSpecialize

julia> prob2 = remake(ODEProblem((u, p, t) -> 2 .* u, nothing, nothing); f = f);

julia> SciMLBase.specialization(prob2.f)
SciMLBase.AutoSpecialize

With [email protected] on the other hand:

julia> using SciMLBase

julia> f = ODEFunction{false,SciMLBase.FullSpecialize}((u, p, t) -> u);

julia> prob = ODEProblem(f, nothing, nothing);

julia> SciMLBase.specialization(prob.f)
SciMLBase.FullSpecialize

julia> prob2 = remake(ODEProblem((u, p, t) -> 2 .* u, nothing, nothing); f = f);

julia> SciMLBase.specialization(prob2.f)
SciMLBase.FullSpecialize

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
julia> using Pkg; Pkg.status()
Project SciMLBase v2.72.2
Status `~/.julia/dev/SciMLBase/Project.toml`
  [47edcb42] ADTypes v1.12.1
  [7d9f7c33] Accessors v0.1.41
  [4fba245c] ArrayInterface v7.18.0
  [38540f10] CommonSolve v0.2.4
  [187b0558] ConstructionBase v1.5.8
  [ffbed154] DocStringExtensions v0.9.3
  [4e289a0a] EnumX v1.0.4
⌅ [6b7a57c9] Expronicon v0.8.5
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [82899510] IteratorInterfaceExtensions v1.0.0
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.29.0
  [189a3867] Reexport v1.2.2
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [c0aeaf25] SciMLOperators v0.3.12
  [53ae85a6] SciMLStructures v1.6.1
  [1e83bf80] StaticArraysCore v1.4.3
  [10745b16] Statistics v1.11.1
  [2efcf032] SymbolicIndexingInterface v0.3.37
  [8ba89e20] Distributed v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [de0858da] Printf v1.11.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
julia> using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Project SciMLBase v2.72.2
Status `~/.julia/dev/SciMLBase/Manifest.toml`
  [47edcb42] ADTypes v1.12.1
  [7d9f7c33] Accessors v0.1.41
  [79e6a3ab] Adapt v4.1.1
  [4fba245c] ArrayInterface v7.18.0
  [38540f10] CommonSolve v0.2.4
  [a33af91c] CompositionsBase v0.1.2
  [187b0558] ConstructionBase v1.5.8
  [9a962f9c] DataAPI v1.16.0
  [e2d170a0] DataValueInterfaces v1.0.0
  [ffbed154] DocStringExtensions v0.9.3
  [4e289a0a] EnumX v1.0.4
  [e2ba6199] ExprTools v0.1.10
⌅ [6b7a57c9] Expronicon v0.8.5
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [46192b85] GPUArraysCore v0.2.0
  [3587e190] InverseFunctions v0.1.17
  [82899510] IteratorInterfaceExtensions v1.0.0
  [d8e11817] MLStyle v0.4.17
  [1914dd2f] MacroTools v0.5.15
  [bac558e1] OrderedCollections v1.8.0
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.29.0
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [c0aeaf25] SciMLOperators v0.3.12
  [53ae85a6] SciMLStructures v1.6.1
  [1e83bf80] StaticArraysCore v1.4.3
  [10745b16] Statistics v1.11.1
  [2efcf032] SymbolicIndexingInterface v0.3.37
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.0
  [0dad84c5] ArgTools v1.1.2
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [8ba89e20] Distributed v1.11.0
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching v1.11.0
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.11.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization v1.11.0
  [6462fe0b] Sockets v1.11.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.6.0+0
  [e37daf67] LibGit2_jll v1.7.2+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.6+0
  [14a3606d] MozillaCACerts_jll v2023.12.12
  [4536629a] OpenBLAS_jll v0.3.27+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.11.0+0
  [8e850ede] nghttp2_jll v1.59.0+0
  [3f19e933] p7zip_jll v17.4.0+2
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M2 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 6 default, 0 interactive, 3 GC (on 6 virtual cores)
Environment:
  JULIA_PKG_USE_CLI_GIT = true
  JULIA_PKG_PRESERVE_TIERED_INSTALLED = true
  JULIA_EDITOR = code
@devmotion devmotion added the bug Something isn't working label Feb 5, 2025
@devmotion devmotion changed the title remake does not respect specialization Regression: remake does not respect specialization Feb 5, 2025
@devmotion
Copy link
Member Author

It seems this was broken by #891: Prior to that PR, if f::AbstractODEFunction was provided it was forwarded to the constructor (and hence its specialization was respected) whereas after that PR it is remaked and the generic remake for AbstractSciMLFunctions overrides its specialization.

@devmotion
Copy link
Member Author

@ChrisRackauckas is this a bug? Or is there some other way to achieve my desired behaviour? It is crucial for me to ensure that the problem (or rather the ODE function) uses FullSpecialize, and I'm not sure how I can achieve this with the new behaviour of remake if a user provides a problem with AutoSpecialize: Previously, I constructed an ODEFunction with FullSpecialize from the user input, and then used it to remake the user-provided problem; with the new behaviour remake changes the specialization back from FullSpecialize to AutoSpecialize.

@ChrisRackauckas
Copy link
Member

This is a bug

@ChrisRackauckas
Copy link
Member

@AayushSabharwal can you prioritize a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants