How many workers for fmincon with UseParallel?
3 次查看(过去 30 天)
显示 更早的评论
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.
- 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?
- 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 个评论
Bruno Luong
2024-3-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?"
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.
采纳的回答
Matt J
2024-3-1
编辑:Matt J
2024-3-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?
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 个评论
Matt J
2024-3-1
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!