How does the client send data to the workes, when calling parfor?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, let assume I want to use the parfor with my function (in this case, it just computes the routine without retrieving data from the workers, except for the last operation), i.e.:
parfor i=1:n
err = my_fnc(A,B,exp_pts(i));
end
where my_fnc is a time-expensive routine, exp_pts is a vector of n different numbers, A and B are always the same, very large matrices. I would know how the client transfers these data to all the available workers, that's to say: does it transfer data first to the worker 1, after to the worker 2, and so on? If it does, it means that, when working with very large (and dense) data, worker 1 starts working first and it could becomes idle when worker 2 is working, and so on.. (it's like an unbalanced load). Also, with matrices of this type, it's hard for the "true" operational time to overcome the time needed for the transfer of data, then the parfor is not so useful for these data. Do you agree? Thank you in advance.
0 件のコメント
採用された回答
Edric Ellis
2013 年 8 月 20 日
A and B are sent once to each worker at the start of the PARFOR loop. There are certainly cases where the data transfer time dominates the computational time - but if my_fnc is truly time-expensive, this should not be the case. If you have multiple PARFOR loops using the same 'A' and 'B', you could use my Worker Object Wrapper to ensure they are transferred only once.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Parallel for-Loops (parfor) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!