-
-
Notifications
You must be signed in to change notification settings - Fork 114
Move general utility functions and errors from DiffEqBase to SciMLBase #1098
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
Conversation
|
@ChrisRackauckas this moves the general utility functions used for the solve dispatches to SciMLBase, the extensions needed for those, and most of the errors that were in DiffEqBase before. I have a branch of DiffEqBase that imports and uses these from SciMLBase, which also means that for example |
|
What's the load time impact of this? |
6163dbb to
8d5ec61
Compare
|
I did @time using SciMLBaseCurrent master: This PR: I also looked at loading OrdinaryDiffEq: @time using OrdinaryDiffEqCurrent master: This PR: Any better way to see how this affects load times? |
| RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" | ||
| SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" | ||
| SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226" | ||
| Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh shit, that shouldn't be there... why is static needed? Just noticed this too late. This should not be in SciMLBase!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduce_tup is used for the Dual type checking, anyeltypedual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can that be isolated from the rest of Static?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, I don't see anything in the definition that uses anything besides Base functions. Should I just copy paste this?
@generated function reduce_tup(f::F, inds::Tuple{Vararg{Any, N}}) where {F, N}
q = Expr(:block, Expr(:meta, :inline, :propagate_inbounds))
if N == 1
push!(q.args, :(inds[1]))
return q
end
syms = Vector{Symbol}(undef, N)
i = 0
for n in 1:N
syms[n] = iₙ = Symbol(:i_, (i += 1))
push!(q.args, Expr(:(=), iₙ, Expr(:ref, :inds, n)))
end
W = 1 << (8sizeof(N) - 2 - leading_zeros(N))
while W > 0
_N = length(syms)
for _ in (2W):W:_N
for w in 1:W
new_sym = Symbol(:i_, (i += 1))
push!(q.args, Expr(:(=), new_sym, Expr(:call, :f, syms[w], syms[w + W])))
syms[w] = new_sym
end
deleteat!(syms, (1 + W):(2W))
end
W >>>= 1
end
q
end
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
We want to move the solve dispatches for Nonlinear problems to NonlinearSolveBase from DiffEqBase. In order to do that we need to move some of the things from DiffEqBase to SciMLBase so that NonlinearSolveBase can use them.