Is it possible to perform parallel computing with lsqnonlin?

조회 수: 11 (최근 30일)
Igor
Igor 2013년 3월 20일
댓글: Daniel Haxton 2017년 8월 23일
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
Igor
Igor 2016년 11월 3일
Good to know that! Thank you!
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에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by