Skip to content

Bump to use SciMLBase ImmutableNonlinearProblem #619

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

Merged
merged 3 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/tutorials/nonlinear_solve_gpus.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ end

p = @SVector [@SVector(rand(Float32, 4)) for _ in 1:1024]
u0 = SA[1f0, 2f0, 3f0, 4f0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
u0 = SA[1f0, 2f0, 3f0, 4f0]
u0 = SA[1.0f0, 2.0f0, 3.0f0, 4.0f0]

prob = NonlinearSolveBase.ImmutableNonlinearProblem{false}(p2_f, u0, p)
prob = SciMLBase.ImmutableNonlinearProblem{false}(p2_f, u0, p)
```

!!! note
Expand All @@ -152,7 +152,7 @@ prob = NonlinearSolveBase.ImmutableNonlinearProblem{false}(p2_f, u0, p)
In general, this means that you need to avoid any runtime operations in kernel code,
such as allocating vectors, dynamic dispatch, type instabilities, etc. Thus to make this
work, your `f` function should be non-allocating, your `u0` function should use
StaticArrays, and you must use `NonlinearSolveBase.ImmutableNonlinearProblem`
StaticArrays, and you must use `SciMLBase.ImmutableNonlinearProblem`
(which is exactly the same as NonlinearProblem except it's immutable to satisfy the
requirements of GPU kernels). Also, it's recommended that for most GPUs you use Float32
precision because many GPUs are much slower on 64-bit floating point operations.
Expand Down
2 changes: 1 addition & 1 deletion lib/NonlinearSolveBase/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MaybeInplace = "0.1.4"
Preferences = "1.4"
Printf = "1.10"
RecursiveArrayTools = "3"
SciMLBase = "2.89.1"
SciMLBase = "2.92"
SciMLJacobianOperators = "0.1.1"
SciMLOperators = "0.3.13, 0.4"
SparseArrays = "1.10"
Expand Down
10 changes: 4 additions & 6 deletions lib/NonlinearSolveBase/src/NonlinearSolveBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ using EnzymeCore: EnzymeCore
using MaybeInplace: @bb
using RecursiveArrayTools: AbstractVectorOfArray, ArrayPartition
using SciMLBase: SciMLBase, ReturnCode, AbstractODEIntegrator, AbstractNonlinearProblem,
AbstractNonlinearAlgorithm, AbstractNonlinearFunction,
NonlinearProblem, NonlinearLeastSquaresProblem, StandardNonlinearProblem,
NonlinearFunction, NullParameters, NLStats, LinearProblem,
LinearAliasSpecifier
AbstractNonlinearAlgorithm,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
AbstractNonlinearAlgorithm,
AbstractNonlinearAlgorithm,

NonlinearProblem, NonlinearLeastSquaresProblem,
NonlinearFunction, NLStats, LinearProblem,
LinearAliasSpecifier, ImmutableNonlinearProblem
using SciMLJacobianOperators: JacobianOperator, StatefulJacobianOperator
using SciMLOperators: AbstractSciMLOperator, IdentityOperator
using SymbolicIndexingInterface: SymbolicIndexingInterface
Expand All @@ -36,8 +36,6 @@ include("public.jl")
include("utils.jl")

include("abstract_types.jl")

include("immutable_problem.jl")
include("common_defaults.jl")
include("termination_conditions.jl")

Expand Down
56 changes: 0 additions & 56 deletions lib/NonlinearSolveBase/src/immutable_problem.jl

This file was deleted.

Loading