Skip to content

Commit 1770b06

Browse files
authored
Merge branch 'master' into qqy/mirk_for_mp
2 parents 0380167 + d327817 commit 1770b06

10 files changed

Lines changed: 29 additions & 24 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Random = "1.10"
6060
ReTestItems = "1.29"
6161
RecursiveArrayTools = "3.31.2"
6262
Reexport = "1.2"
63-
SciMLBase = "2.138.0"
63+
SciMLBase = "2.152.1"
6464
Sparspak = "0.3.11"
6565
StaticArrays = "1.9.8"
6666
Test = "1.10"

lib/BoundaryValueDiffEqAscher/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Random = "1.10"
3636
ReTestItems = "1.23.1"
3737
RecursiveArrayTools = "3.27.0"
3838
Reexport = "1.2"
39-
SciMLBase = "2.130.0"
39+
SciMLBase = "2.152.1"
4040
Setfield = "1.1.1"
4141
StaticArrays = "1.9.8"
4242
Test = "1.10"

lib/BoundaryValueDiffEqCore/Project.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1313
Integrals = "de52edbc-65ea-441a-8357-d3a637375a31"
1414
LineSearch = "87fe0de2-c867-4266-b59a-2f0a94fc965b"
1515
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
16-
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1716
NonlinearSolveBase = "be0214bd-f91f-a760-ac4e-3421ce2b2da0"
1817
NonlinearSolveFirstOrder = "5959db7a-ea39-4486-b5fe-2dd0bf03d60d"
1918
OptimizationBase = "bca83a33-5cc9-4baa-983d-23429ab6bcbb"
@@ -40,14 +39,13 @@ Integrals = "4.7.1, 5"
4039
InteractiveUtils = "<0.0.1, 1"
4140
LineSearch = "0.1.4"
4241
LinearAlgebra = "1.10"
43-
Logging = "1.10"
4442
NonlinearSolveBase = "2.11.2"
4543
NonlinearSolveFirstOrder = "1.2, 2"
4644
OptimizationBase = "3.2.0, 4, 5"
47-
PreallocationTools = "0.4, 1"
45+
PreallocationTools = "1.2"
4846
RecursiveArrayTools = "3.27.0"
4947
Reexport = "1.2"
50-
SciMLBase = "2.138.0"
48+
SciMLBase = "2.152.1"
5149
SciMLLogging = "1.8.0"
5250
SciMLStructures = "1.7.0"
5351
Setfield = "1"

lib/BoundaryValueDiffEqCore/src/BoundaryValueDiffEqCore.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ using ConcreteStructs: @concrete
88
using DiffEqBase: DiffEqBase, solve
99
using ForwardDiff: ForwardDiff, pickchunksize
1010
using Integrals: Integrals, IntegralProblem
11-
using Logging: Logging
1211
using LinearAlgebra
1312
using LineSearch: BackTracking
1413
using NonlinearSolveFirstOrder: NonlinearSolvePolyAlgorithm

lib/BoundaryValueDiffEqCore/src/types.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,15 @@ end
171171
end
172172

173173
function __maybe_allocate_diffcache(x, chunksize, jac_alg)
174-
return __needs_diffcache(jac_alg) ? DiffCache(x, chunksize) : x
174+
return __needs_diffcache(jac_alg) ?
175+
DiffCache(x, chunksize; warn_on_resize = false) : x
175176
end
176-
__maybe_allocate_diffcache(x::DiffCache, chunksize) = DiffCache(zero(x.du), chunksize)
177-
178-
## get_tmp shows a warning as it should on cache expansion, this behavior however is
179-
## expected for adaptive BVP solvers so we write our own `get_tmp` and drop the warning logs
180-
181-
@inline function get_tmp(dc, u)
182-
return Logging.with_logger(Logging.NullLogger()) do
183-
PreallocationTools.get_tmp(dc, u)
184-
end
177+
function __maybe_allocate_diffcache(x::DiffCache, chunksize)
178+
return DiffCache(zero(x.du), chunksize; warn_on_resize = false)
185179
end
186180

181+
@inline get_tmp(dc, u) = dc
182+
187183
# DiffCache
188184
struct DiffCacheNeeded end
189185
struct NoDiffCacheNeeded end

lib/BoundaryValueDiffEqFIRK/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Random = "1.10"
5353
ReTestItems = "1.23.1"
5454
RecursiveArrayTools = "3.27.0"
5555
Reexport = "1.2"
56-
SciMLBase = "2.138.0"
56+
SciMLBase = "2.152.1"
5757
SciMLStructures = "1.7.0"
5858
Setfield = "1.1.1"
5959
SparseArrays = "1.10"

lib/BoundaryValueDiffEqMIRK/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Random = "1.10"
5353
ReTestItems = "1.23.1"
5454
RecursiveArrayTools = "3.27.0"
5555
Reexport = "1.2"
56-
SciMLBase = "2.138.0"
56+
SciMLBase = "2.152.1"
5757
SciMLStructures = "1.7.0"
5858
Setfield = "1.1.1"
5959
SparseArrays = "1.10"

lib/BoundaryValueDiffEqMIRKN/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Random = "1.10"
4848
ReTestItems = "1.23.1"
4949
RecursiveArrayTools = "3.27.0"
5050
Reexport = "1.2"
51-
SciMLBase = "2.130.0"
51+
SciMLBase = "2.152.1"
5252
Setfield = "1.1.1"
5353
SparseArrays = "1.10"
5454
StaticArrays = "1.9.8"

lib/BoundaryValueDiffEqShooting/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Random = "1.10"
5151
ReTestItems = "1.23.1"
5252
RecursiveArrayTools = "3.27.0"
5353
Reexport = "1.2"
54-
SciMLBase = "2.130.0"
54+
SciMLBase = "2.152.1"
5555
Setfield = "1.1.1"
5656
SparseArrays = "1.10"
5757
StaticArrays = "1.9.8"

test/misc/type_stability_tests.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@testitem "Type Stability" begin
2-
using LinearAlgebra, BoundaryValueDiffEq, OrdinaryDiffEqTsit5
2+
using LinearAlgebra, BoundaryValueDiffEq, OrdinaryDiffEqTsit5, SciMLBase
33

44
f(u, p, t) = [p[1] * u[1] - p[2] * u[1] * u[2], p[3] * u[1] * u[2] - p[4] * u[2]]
55
function f!(du, u, p, t)
@@ -24,10 +24,22 @@
2424

2525
jac_alg = BVPJacobianAlgorithm(AutoForwardDiff(; chunksize = 2))
2626

27+
# BVProblem constructor type stability (issue #454)
28+
# Explicit {iip} constructors should be type-stable
29+
@testset "BVProblem Constructor" begin
30+
@inferred BVProblem{true}(f!, bc!, u0, tspan, p)
31+
@inferred BVProblem{false}(f, bc, u0, tspan, p)
32+
33+
# __init should be type-stable with properly typed problems
34+
prob_iip = BVProblem{true}(f!, bc!, u0, tspan, p)
35+
@inferred SciMLBase.__init(prob_iip, MIRK5(; jac_alg); dt = 0.2)
36+
end
37+
2738
# Multi-Point BVP
39+
# nlls is properly inferred as false for StandardBVProblem without bcresid_prototype
2840
@testset "Multi-Point BVP" begin
29-
mpbvp_iip = BVProblem(f!, bc!, u0, tspan, p; nlls = Val(false))
30-
mpbvp_oop = BVProblem(f, bc, u0, tspan, p; nlls = Val(false))
41+
mpbvp_iip = BVProblem(f!, bc!, u0, tspan, p)
42+
mpbvp_oop = BVProblem(f, bc, u0, tspan, p)
3143

3244
# Shooting methods have deep type instability from NonlinearSolve/OrdinaryDiffEq
3345
# that requires further investigation. The solvers work correctly but return type

0 commit comments

Comments
 (0)