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

create API for tstop aliasing system #1077

Open
isaacsas opened this issue Aug 31, 2024 · 9 comments
Open

create API for tstop aliasing system #1077

isaacsas opened this issue Aug 31, 2024 · 9 comments
Assignees

Comments

@isaacsas
Copy link
Member

Per discussions @ChrisRackauckas and I had around SciML/JumpProcesses.jl#442 it would be nice to be able to have users tell us we can alias their tstops vector in JumpProcesses so we don't need to allocate a new vector for each call to solve.

@ChrisRackauckas
Copy link
Member

My plan is to create a keyword argument alias which then has a struct ODEAliases <: AbstractAliasSpecifier etc., that holds booleans/nothing for each thing that can be aliased. nothing for default behavior, true/false for forced aliasing, de-aliasing. This can then be rolled out for every problem type uniformly, and include booleans to cover the keyword arguments.

@ChrisRackauckas
Copy link
Member

@jClugstor does this specification make sense?

@ChrisRackauckas
Copy link
Member

You'll find:

alias_u0: allows the solver to alias the initial condition array that is contained in the problem struct. Defaults to false.

in DiffEq

alias_A::Bool: Whether to alias the matrix A or use a copy by default. When true, algorithms like LU-factorization can be faster by reusing the memory via lu!, but care must be taken as the original input will be modified. Default is true if the algorithm is known not to modify A, otherwise is false.
alias_b::Bool: Whether to alias the matrix b or use a copy by default. When true, algorithms can write and change b upon usage. Care must be taken as the original input will be modified. Default is true if the algorithm is known not to modify b, otherwise false.

in LinearSolve. Etc. All of that should get folded into just these more general structs, and the old way should get deprecated to just setting values of the struct.

@jClugstor
Copy link

I think I get it. alias should be a keyword of ODEProblem, LinearProblem, etc. that would be of type e.g. ODEAliases and LinearAliases respectively. And each concrete subtype of AbstractAliasSpecifier should hold boolean values that correspond to the parts of their corresponding problems that can be aliased.

@ChrisRackauckas
Copy link
Member

Yes exactly.

@jClugstor
Copy link

Should the types ODEAliases and LinearAliases etc. be defined in SciMLBase?

@ChrisRackauckas
Copy link
Member

yes

@jClugstor
Copy link

I'm thinking that the problem types will need a new field to hold the AbstractAliasSpecifiers, does that sound right?

@ChrisRackauckas
Copy link
Member

I don't think so, they will just be a new common kwarg to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants