Tips to speedup lsqnonlin ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tips to speedup lsqnonlin ?

Info
My code runs hundreds of iterations of lsqnonlin and some iterations can take a minute or more to finish. Are there any general tips to make it run faster? The same code in Matlab is around 40% faster.

I am wondering if there is anything worth trying with parallelizing? My machine has 40 cpus but octave is only using one cpu.


Reply | Threaded
Open this post in threaded view
|

Re: Tips to speedup lsqnonlin ?

Olaf Till-2
On Mon, Nov 19, 2018 at 07:14:19PM +0000, Info wrote:
> My code runs hundreds of iterations of lsqnonlin and some iterations can take a minute or more to finish. Are there any general tips to make it run faster? The same code in Matlab is around 40% faster.
>
> I am wondering if there is anything worth trying with parallelizing? My machine has 40 cpus but octave is only using one cpu.

Giving it an explicit Jacobian function (which doesn't use finite
differencing) usually will make it faster.

You can experiment with FinDiffRelStep and TypicalX.

Setting FinDiffType to "forward" can make it faster in some cases.

lsqnonlin wraps nonlin_residmin. nonlin_residmin can parallelize
automatic Jacobioan computation by finite differences; an option has
to be set for this and the 'parallel' package has to be installed. If
you are on Windows, however, the parallel package can't be installed.

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tips to speedup lsqnonlin ?

Info
Thanks, I am using linux and have installed the parallel package. Would you have an example for how to set the option in lsqnonlin to do the parallel calculations:

> lsqnonlin wraps nonlin_residmin. nonlin_residmin can parallelize
> automatic Jacobioan computation by finite differences; an option has
> to be set for this and the 'parallel' package has to be installed.