MATLAB Answers

surrogateopt function's parallel option with a parallel objective function

6 ビュー (過去 30 日間)
Andrea Longobardi
Andrea Longobardi 2019 年 7 月 25 日
回答済み: Steve Grikschat 2019 年 8 月 5 日
Hi,
I've a parallel black-box objectuve function that returns me a probability, which I want to minimize. So I'm using the surrogateopt function to run this minimization problem. surrogateopt has an option "Parallel":Cattura.PNG
I'm running my experiments on a 32-core CPU. The parallel block-box function computes 20 times (parsim() function) a value (0 or 1) and then it returns the average of that value.
My question is: if I'd set 'UseParallel' to true and I'd run the optimization process with a parpool made of, say, 2 workers, how many workers will I have computing the parallel objective function at the same time?
Observing the execution time it takes to compute one probability with these settings it seems to me that there are only 2 workers, each one computing serially the 20 values needed by the objective function. It is like Matlab doesn't allow "nested parallelization" (parallel pools).
Setting instead "UseParallel" to false will have the effect of having 20 workers per time computing one value of the objective function.
Am I right?

採用された回答

Steve Grikschat
Steve Grikschat 2019 年 8 月 5 日
Hi Andrea,
Your observation is correct.
Parallel Computing Toolbox only supports 1-level of parallelism.
When you set UseParallel for surrogateopt to "true", it will schedule (asynchronously) evaluations of the objective function on the workers in the parpool. It aims for as close to full utilization as possible.
At the same time, the parsim command in the objective is now serial (as described in the doc link).

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by