How many workers for fmincon with UseParallel?

3 visualizaciones (últimos 30 días)
Fredrik P
Fredrik P el 1 de Mzo. de 2024
Comentada: Fredrik P el 1 de Mzo. de 2024
I'm solving a biggish problem where the function takes a while to compute and want to throw as many workers as possible on the problem.
  1. Is the reason to set UseParallel to true when solving a problem with fmincon that it can potentially speed up the evaluation of the problem's gradient?
  2. Say my problem has 100 variables. Could I then theoretically improve performance with up to 100 workers? Or does fmincon never use that many parallel processes?
  1 comentario
Bruno Luong
Bruno Luong el 1 de Mzo. de 2024
"Is the reason to set UseParallel to true when solving a problem with fmincon that it can potentially speed up the evaluation of the problem's gradient?"
Only if you don't provide the gradient then fmincon estimates the gradient using finite differnce, each component of the gradient can be estimated in parallel and UseParallel is set to TRUE.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 1 de Mzo. de 2024
Editada: Matt J el 1 de Mzo. de 2024
Is the reason to set UseParallel to true when solving a problem with fmincon that it can potentially speed up the evaluation of the problem's gradient?
Yes.
Say my problem has 100 variables. Could I then theoretically improve performance with up to 100 workers? Or does fmincon never use that many parallel processes?
Theoretically. The number of workers can be set by you using parpool, if you have the Parallel Computing Toolbox, or fmincon will call parpool with default settings. How many workers you can create in a pool depends on your Matlab version and the resources available to your computer.
  3 comentarios
Matt J
Matt J el 1 de Mzo. de 2024
If it's a cluster, you'll also have to consider the time for transmitting data to the cluster nodes. If the work done by each node is much less than the communication time, you may not benefit much.
Fredrik P
Fredrik P el 1 de Mzo. de 2024
Good point, but I don’t think that should be a problem here…

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by