Effacer les filtres
Effacer les filtres

Does parfor inside lsqnonlin with UseParallel=True work properly?

3 vues (au cours des 30 derniers jours)
Sunham Kim
Sunham Kim le 3 Oct 2023
Commenté : Sunham Kim le 3 Oct 2023
Hello,
I'm solving a system of 150 nonlinear equations using lsqnonlin. The system is an outcome of a bulky (parallelized) optimization, which involves large vectors. (Large = 1 mil. elements) I'm wondering if my parfor loops in the optimization work properly with -UseParallel- enabled lsqnonlin.
I know parfor cannot be nested in another parallel structure. According to the lsqnonlin documentation, -UseParallel- governs the gradient calculation, and turning it on does not mean the solver plays with multiple guesses simultaneously, as multistart does. I guess then my parfor should work well, but not sure. I can play with a toy code of course, but I want to get a clear-cut answer.
Thanks!

Réponse acceptée

Walter Roberson
Walter Roberson le 3 Oct 2023
With that option the function will be invoked with different parameters in order to estimate the gradient. I would expect that for N parameters either N or N+1 function calls would be made within a parfor or similar. If the function uses parfor then the function's parfor will be done in serial.
  1 commentaire
Sunham Kim
Sunham Kim le 3 Oct 2023
I see. That's how it parallelly estimate the gradient. Thank you!

Connectez-vous pour commenter.

Plus de réponses (1)

Bruno Luong
Bruno Luong le 3 Oct 2023
If your function use parfor internally then you should NOT set UseParallel to true.

Catégories

En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by