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

Infinity check on arguments to ODEs #2406

Closed
bbbales2 opened this issue Mar 4, 2021 · 7 comments
Closed

Infinity check on arguments to ODEs #2406

bbbales2 opened this issue Mar 4, 2021 · 7 comments

Comments

@bbbales2
Copy link
Member

bbbales2 commented Mar 4, 2021

Description

Can we remove the infinity checks on the pass-through-arguments for the ODE solvers (these)?

This came up in closures implementation: #2384

We would need to add extra functions to the closures to extract the values of all the variables they capture to check if any were infinite.

Anyway I'm not super convinced of the value of these checks in general, so if we can get rid of them that is another way to solve the coding problem.

@wds15 @yizhang-yiz

Current Version:

v4.0.1

@bbbales2 bbbales2 mentioned this issue Mar 4, 2021
5 tasks
@yizhang-yiz
Copy link
Contributor

Not 100% sure but I agree with you that a manual check_finite may not be necessary as the ODE functor evaluation should be able capture it somewhere downstream. Personally I don't see any risk here.

@wds15
Copy link
Contributor

wds15 commented Mar 4, 2021

Maybe we try what happens if Inf is thrown at the ODE system?

@bbbales2
Copy link
Member Author

bbbales2 commented Mar 4, 2021

Checking every time the functor is called might slow stuff down.

If infs go into the ODE solver and the parameter is actually used, the ODE solver will presumably explode (or the right hand side evaluation will).

I guess it is very slightly more informative to say "input to ODE solver contained an inf" and try to pre-empt that. But then again maybe letting the right hand side explode produces a more informative error message (instead of saying "you passed an inf to the ODE" maybe there will be an error "you passed an inf to X" and it is clearer what was inf).

@bbbales2
Copy link
Member Author

bbbales2 commented Mar 4, 2021

But yeah I'm just rambling -- if nobody has any great attachment to this check, then I would like to try removing it. So since neither of you said "that is super useful for debugging -- please don't remove it", I am even more eager to remove it now.

@wds15
Copy link
Contributor

wds15 commented Mar 4, 2021

I woud not like to gain another check which we execute every time we call the ODE functor! I don't mind passing Inf into that functor and let it explode immediately. So let's try and let it explode is what I am saying.

@bbbales2
Copy link
Member Author

bbbales2 commented Mar 4, 2021

Oh oh, I misread. Excellent! Then let's give this a go and at worse someone can add it back in in 6 months lol.

@yizhang-yiz
Copy link
Contributor

If no one is going to bite the bullet to profile the effect of these checks, I doubt it's worth to remove them and wait for blowbacks. Note that for explicit solvers putting inf & nan won't terminate the solution, the solver will just crunch on, which is arguably more expensive in computing and less intuitive in error message.

I'm closing it for now. Feel free to reopen and start with profiling.

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