How does the client send data to the workes, when calling parfor?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Edric Ellis
il 20 Ago 2013
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Parallel for-Loops (parfor) in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!