Re: NDSolve profiling
- To: mathgroup at smc.vnet.net
- Subject: [mg126979] Re: NDSolve profiling
- From: Narasimham <mathma18 at hotmail.com>
- Date: Thu, 21 Jun 2012 05:21:15 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jrrvgu$4sd$1@smc.vnet.net>
On Jun 20, 12:53 pm, Ben <Benjamin.R.Le... at gmail.com> wrote: > Are there any tricks to profiling/optimising NDSolve? > > A computationally expensive subexpression (involving ProductLog) is repea= ted many times in my ODE, so I'd like to check whether it is only computed = once per evaluation point (and would also like to try other possible optimi= sations like using compile unless that is already redundant). > > My ODE has multiple coupled-components so I've also experimented with con= verting it into vector form. With simpler ODEs I've found this has facilita= ted using compiled functions in NDSolve (and gave an overall speed boost), = but with my current ODE I find that the vector form causes failure. I'm won= dering whether switching from a coupled set of equations to vector form of = the identical ODE/IVP may cause the algorithm pick a different step sequenc= es, or may be more likely to produce catastrophic-cancellation inaccuracies= ? > > Can anybody share relevant insight into the evaluation that goes on behin= d the scenes of ndsolve's equation-processing and iteration, and how to deb= ug or ways to optimise it for speed? > > Thanks, > Ben If the relations are explicitly and logically defined there may be no problems.Sometimes what appears as a narrow deviation may be surprising; but in any case at least a representative code should be posted here to help avoid vagueness,to pinpoint the problem. Narasimham