Parallel toolbox using parfor loop

1 回表示 (過去 30 日間)
abdullah alzaqebah
abdullah alzaqebah 2018 年 4 月 2 日
hello all i have the following part of my code: parpool(8);
tm00=tic;
parfor i=1:1:size(sss0,2)
maxflows((sss0{1,i}(1,:)),(sss0{1,i}(2,:)),(sss0{1,i}(3,:)),source,sink);
end
tm01=toc(tm00)
the variable sss0 is a cell array represents a graph in each cell, i am using parallel to speed up the computation, i want to compute the maximum flow for each graph from source to sink. maxflows is a function that i was create it to adjust parameter then use maxflow built in function to calculate it. when i use 8 workers i get longer time from using 1 worker
any suggestions

回答 (1 件)

Matt J
Matt J 2018 年 4 月 2 日
編集済み: Matt J 2018 年 4 月 4 日
Typically, this is because the processing task is too simple to make the costs of parallelizing the execution worthwhile. If maxflows is doing very little work, for example, the cost of broadcasting the data to the parallel workers could dominate whatever maxflows is doing.
  5 件のコメント
abdullah alzaqebah
abdullah alzaqebah 2018 年 4 月 4 日
i use the built in function maxflow in the matlab
abdullah alzaqebah
abdullah alzaqebah 2018 年 4 月 4 日
this is the maxflow code
https://www.mathworks.com/matlabcentral/fileexchange/65167-ford-fulkerson-algorithm-for-max-flow-problem

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by