-
-
Notifications
You must be signed in to change notification settings - Fork 49
WIP: Generalize oderkf to eventually replace ode23 #16
Conversation
With fdff7e1 the tolerances in
The remaining difference between |
I don't really see a reason not to merge this. Are we waiting for anything else before we want this in? (Perhaps tagging v0.1?) |
The prospect of having only one function for all embedded RK pairs is indeed really promising and will make our life probably easier. We should discuss if we want to remove the current |
Regarding the optimizations I was wondering to which extent the fact that the Butcher tableau is |
Ok, after merging JuliaLang/julia#14 the performance test gives
which is Ok. However, using a different test, which involves a system of 3 equations (problem B5 in DETEST), I get
(the solutions seem to be ok, e.g. |
This is better. I replaced the generic_matvecmul in
|
Deprecation warnings no more ... |
I think it is almost time for |
This looks good to me. And since Re. perf tests, there has been some discussion before, but I don't know if any real conclusions on how to handle perf testing of packages have been reached. I think they have value, in the very least as some kind of safeguard against performance regressions, but that also means we need a way to automate not only running them, but analyzing the results. I have no idea if there is any infrastructure we could hook into there, or if we have to invent something. However, I think these perf tests do test the right things (albeit maybe not as extensively as we might want in the long run) so they're a good start and I don't think we should throw them away. |
By the way, this takes care of JuliaLang/julia#2 as well, right? |
You might check with @staticfloat to see if you can use the http://speed.julialang.org/ infrastructure (n.b., site is down right now, I've notified him.) |
Partly, support for intermediate points in The performance test is IMO kind of crude, but it should at least give a rough idea about performance regressions. We can easily add others test cases from DETEST as well. I also have a tweaked version which saves the results to an HDF5 file. One can then generate plots comparing different methods... In the long run this needs someone who makes the tests more reliable and extends them in a sensible way. |
@acroy Take a look at JuliaLang/julia#3 for a (very crude) idea on how to design a slightly more robust test framework for this. It's just a start, and it's pretty old, so I doubt that much code from there will be usable (if any at all) but at least it can probably serve up some ideas on how to improve testing. |
@tlycken : Actually, I had seen JuliaLang/julia#3 and I think using types for different kind of test problems is the way to go. Here I just wanted to have some means to detect performance regressions, so I did't investigate this further. My tests have the problem that the timings are still fluctuating somewhat from run to run. I guess I have to make sure that the solver is called sufficiently often to stabilize the timing... |
To stabilize timing, maybe just run the tests ~10 times per problem/solver combination? This will of course make the test run take (much) longer, but I don't think the perf tests are supposed to be run in every test context anyway. |
That is what I am doing now. Each combination of problem and solver runs 10 times plus 1 for JITing. I should probably put the innermost part in a function though. |
Shouldn't the performance tests just wrap the normal tests with proper timing procedures. The only difference is that we want to do multiple iterations, and try to do something intelligent/conscious about GC and JIT time consumption. |
Well, our current tests were rather ad-hoc additions (see JuliaLang/julia#1). Of course they can tell us if our implementation is basically Ok, but they don't probe all aspects of a solver. For example, all our tests are linear ODEs, which are in a way too simple. We also need test problems for which step-size estimation fails in come cases and so on. In order to compare different methods or runs we IMO need additional information like number of integration steps, smallest and largest time-step, ... This is a (GSOC) project on its own, but for now we could certainly merge Anyways, "something intelligent/conscious about GC and JIT time consumption" would be good :-) |
I am actually against merging tests.jl and perf_tests.jl - it'll be a lot easier to decide to run the tests in different contexts if/when we have the infrastructure to automate performance testing if the code is separated. Also, if Pkg starts running tests on install, we don't want the user to have to wait for our performance tests... |
My point was not to merge the performance and correctness tests. My suggestion was to somehow make the normal tests run 1 iteration of the performance tests (or to make the performance tests run multiple iterations of some of the examples in the correctness tests). |
This is what I basically meant by "merging". For the correctness test we probably want to have only problems with a known solution and which don't run forever, i.e., a subset of all tests. The problems are now in a tuple, which could be filtered according to the |
OK, I misunderstood you both. Running the same test problems when testing for correctness and for performance seems like a good idea. |
…elated to JuliaLang/julia#6118).
To make some progress I would suggest the following:
I think the testing should be done properly and deserves its own PR. In principle we could remove |
Great! Merging this will have implications on a bunch of other stuff as well, since it's API-breaking at least for the internal API (and I'm saying this as a good thing - we know we want to do this, and when we've done it it's easier to move forward with other stuff). I haven't done more elaborate testing than running the test suite and having a staring contest with the code to see if anything looks suspicious, but I don't think there are any problems with this. One thing that I did notice and that we might want to consider (but I don't think it's necessary - just want to throw it out there so it's not overlooked): The old |
Also, I did find a way to squeeze out some more performance out of |
Re I guess we could gain even more performance by changing |
Possibly, but that would be quite a disruptive change in the external API, which would also probably be quite confusing for new users, since it differs from the way e.g. MATLAB defines its system function. Maybe it's worth investigating if it can be done using a keyword argument to the solver to indicate if it should use Anyway, I think this is good to merge as is. |
WIP: Generalize oderkf to eventually replace ode23
The function
oderkf
is extended to support embedded RK methods withorder!=5
. Using the Butcher tableau for the Bogacki–Shampine method we can eventually replace the currentode23
. This is WIP since I would like to discuss some optimizations and also wait for #13 to be merged.To monitor potential performance regressions/improvements I have added a very basic "performance test" in
test/perf_test.jl
, which currently givesNote that
ode23
andode23_bs
(based onoderkf
) currently cannot be compared, because of different tolerances.Comments and/or suggestions are most welcome.