Is it possible to perform parallel computing with lsqnonlin?

9 次查看(过去 30 天)
Hello,
Could anybody please tell me if parallel computations are possible with the MATLAB optimization routine "lsqnonlin"? For my applications, this nonlinear optimization function seems to be the best one out of many, but I was disappointed to find out parallel computations were not supported for "lsqnonlin" in R2012a. What about the newest release?
I understand that it might be inherently impossible to make this function work in a parallelized way, but I would like to make sure whether or not the feature is now implemented.
Thank you in advance.

采纳的回答

Jill Reese
Jill Reese 2013-3-21
In the latest release (R2013a), lsqnonlin does not support parallel computations. The most up-to-date information on what optimization routines support parallel computations can be found by looking at the documentation for optimoptions. Optimization routines that support parallel computations will have 'UseParallel' listed as one of their options.

更多回答(1 个)

William Smith
William Smith 2016-11-3
This is now supported (since around 2016a). Pass the { 'UseParallel' , true } flag in the optimoptions.
  2 个评论
Daniel Haxton
Daniel Haxton 2017-8-23
Hello,
I am also wondering if I can use lsqnonlin for parallel computation.
This is what I mean: I have a function that returns a vector that is distributed among workers.
function localvectorpart = parallelfunction(parameters)
it is called within a spmd block. I run my program in a spmd block.
>> spmd; myprogram; end
My vector is distributed among workers and I want to minimize the sum of squares of all the entries in the vector. I would like to pass lsqnonlin a function that returns a distributed or codistributed vector, in some fashion.
Is it true, what it seems to me, that lsqnonlin cannot do this?
[1] I can call it like this,
function myprogram
..
fitparams = lsqnonlin(@(x) gather(codistributed.build(parallelfunction(x),mycodist)), guessparams, ...)
end
[2] but I would prefer to call
function myprogram
..
fitparams = lsqnonlin(@(x) codistributed.build(parallelfunction(x),mycodist), guessparams, ...)
end
[3] or simply
function myprogram
..
fitparams = lsqnonlin(parallelfunction, guessparams, ...)
end
Are [2] or [3] possible? [2] appears impossible because lsqnonlin does not accept functions that return codistributed vectors. [3] does not work regardless of the value of "UseParallel." Is there an option that would enable [3]? Is [1] actually equivalent, just as good? I suppose that gather() in [1] is indeed actually gathering the vectors, performing an allgather, and incurring extra communication. That is why I am asking.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Distributed Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by