-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add tests of various features #2806
Conversation
The tests fail? |
Not too surprised. I will have a look locally (the test log is too large to actually see what is going on) |
Ok, tests pass now (except for one downstream test) |
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.
Thanks for the extremely comprehensive tests. Apart from the specific comments below, I have a couple of overarching requests.
Firstly, these tests don't belong in MTK. They are all testing features implemented in SciMLBase, and should go there alongside the other tests for similar functionality.
- Anything to do with
remake
should be in SciMLBase'smodelingtoolkit_remake.jl
testset - All of the tests for symbolic indexing/interpolation of integrators/solutions/etc should be in a
comprehensive_indexing.jl
testset - Both of the above should be in the
"SymbolicIndexingInterface"
group
That way all of these will be run in MTK downstream, and are tested in the library that implements the features being tested. SciMLBase wants to run these tests because changes in SciMLBase are more likely to break them than ones in MTK. remake
for example is almost entirely a SciMLBase feature, and the only places MTK is likely to break it is remake_buffer
.
Testing save_idxs
is also unnecessary in my opinion. It's not something that's broken, it's a feature we don't support yet.
I would also like to not merge these tests in a state where the broken ones are commented out/marked as @test_broken
. That defeats the purpose of the tests. We should test everything, and merge when it's all fixed.
test/sciml_problem_inputs.jl
Outdated
base_esol = solve(base_eprob, ImplicitEM(); seed, trajectories = 2, saveat = 1.0) | ||
|
||
# Simulates problems for all input types, checking that identical solutions are found. | ||
@test_broken false # first remake in subsequent test yields a `ERROR: type Nothing has no field portion`. |
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.
What's the difference between this SDESystem and the one in https://github.com/SciML/SciMLBase.jl/blob/master/test/downstream/modelingtoolkit_remake.jl? remake
passes there and fails here
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 this ones goes through a couple of additional cases (e.g. observables). not sure why this one errors though, probably something very niche.
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.
this test broken isn't setup right
test/sciml_problem_inputs.jl
Outdated
base_esol = solve(base_eprob, SSAStepper(); seed, trajectories = 2, saveat = 1.0) | ||
|
||
# Simulates problems for all input types, checking that identical solutions are found. | ||
@test_broken false # first remake in subsequent test yields a `ERROR: type Nothing has no field portion`. |
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.
Same for JumpSystems
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.
This on fails, but yes, let's investigate closer.
test/sciml_struct_interfacing.jl
Outdated
@test prob[X] == prob[sys.X] == prob[:X] == 4 | ||
@test prob[XY] == prob[sys.XY] == prob[:XY] == 9 | ||
@test prob[[XY, Y]] == prob[[sys.XY, sys.Y]] == prob[[:XY, :Y]] == [9, 5] | ||
@test_broken prob[(XY, Y)] == prob[(sys.XY, sys.Y)] == prob[(:XY, :Y)] == (9, 5) # https://github.com/SciML/SciMLBase.jl/issues/709 |
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.
Yeah, indexing everywhere should just use getu
.
test/sciml_struct_interfacing.jl
Outdated
|
||
# Test integrator indexing. | ||
let | ||
@test_broken false # NOTE: Multiple problems for `nint` (https://github.com/SciML/SciMLBase.jl/issues/662). |
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.
Does this still fail? The issue is closed.
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.
The issues got closed but then the conversation continued. But I see that there was a PR merged related. I checked fairly recently and this was still broken, but should check again.
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.
Checked, this still fails for nonlinear integrators
test/sciml_struct_interfacing.jl
Outdated
end | ||
|
||
# Test solve's save_idxs argument. | ||
# Currently, `save_idxs` is broken with symbolic stuff (https://github.com/SciML/ModelingToolkit.jl/issues/1761). |
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.
Yeah this is a nontrivial change, requiring updates to integrators, solutions, and a generic reimplementation of SII's index provider interface in SciMLBase.
test/sciml_struct_interfacing.jl
Outdated
|
||
# Handles nonlinear and steady state solutions differently. | ||
let | ||
@test_broken false # Currently a problem for nonlinear solutions and steady state solutions (https://github.com/SciML/SciMLBase.jl/issues/720). |
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.
This is also a case of everything not using getu
.
I should have mentioned: I'll move the tests when I PR to SciMLBase to fix the bugs |
Thanks! |
Yeah, I am a bit uncertain what actually goes where now when the MTK pipeline have been split up in so many different places. To me it is basically tests of the System types that MTK implements. But I agree that if possible it would make sense to move them as far internal as possible. If you point out what and where I could do it, but might be easier for you to do it yourself. |
For the |
Are we sure that the modified version of these that got ported to SciMLBase are actually exhaustive? I.e. regression that I caught with these tests in Catalyst still appear in the ecosystem: #2838 |
I have modified this one, removing the SciMLBase related stuff, and also adding tests that static vectors can be used as input across all problem types. @AayushSabharwal |
Haven't heard anything in a while, can we merge this @AayushSabharwal @ChrisRackauckas ? |
test/sciml_problem_inputs.jl
Outdated
# jprob = remake(base_jprob; u0, p) | ||
# @test base_sol == solve(base_jprob, SSAStepper(); seed, saveat = 1.0) | ||
# eprob = remake(base_eprob; u0, p) | ||
# @test base_esol == solve(eprob, SSAStepper(); seed, trajectories = 2, saveat = 1.0) |
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.
this isn't actually ran
This needs a bit of work. All of the |
So, there are a large number of cases where I do @test_broken false # Does not work for certain inputs, likely related to https://github.com/SciML/ModelingToolkit.jl/issues/2804.
for u0 in u0_alts_vec, p in p_alts_vec
oprob = remake(base_oprob; u0, p)
# @test base_sol == solve(oprob, Tsit5(); saveat = 1.0)
eprob = remake(base_eprob; u0, p)
# @test base_esol == solve(eprob, Tsit5(); trajectories = 2, saveat = 1.0)
end because some of the tests in the loop are broken, and some are not. Then just doing either @test_broken false to record in the test file that there is something going on, so that the case where something is broken is lost. Similar in cases where the full test is commented out (as in some cases something in the build up fails, and sometimes not). |
Then why is it important for this to merge if the test broken isn't actually set to tell us if they are still broken? That's the only point of |
It is meant as a reminder when you run the tests, it tells you that there are some broken tests and where (and links the issue). Do you want me to just remove the |
@ChrisRackauckas I removed the stuff with the broken test, we can add them back later when they work. This should be good now. @AayushSabharwal do you have any last comments? |
Using |
Ok, I have tried to rewrite various tests in Catalyst to work within MTK (a bit more complicated since each system have to be generated directly, and cannot be generated from a single
ReactionSystem
model. These tests are primarily going through vaiours ways to interact with SciML structures, and giving input to problems, across various system types.I have tried to go through all broken tests, and mark issues that are related. Unfortunately there are quite a few, so someone else would probably need to have a second look at each to check the issues are accurate.