How not to copy constant large data for every worker in spmd.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone.
I am using a spmd statement as follows
spmd
n1 = 1+sizeClusters*(labindex-1);
n2 = sizeClusters*labindex;
my_output = my_function(Data1(:,n1:n2),Data2);
end
In this statement Data2 happens to be a very large matrix that is copied for each worker resulting in memory issues. Moreover, my_function needs to read all the values in Data2, therefore I cannot split it in portions like I do for Data1.
Such large matrix is constant and never modified into my_function, therefore such copying for each worker is totally unnecessary.
Is there a way to avoid to copy this large matrix and make the workers to (only) read from the same data?
2 Commenti
Matt J
il 20 Ago 2020
The best strategy probably depends on what my_function is doing with Data2. Even if it eventually incorporates all of Data2 into whatever calculation it is doing, there surely has to be some way to break down the calculation into some sequential steps - there is no such thing as a digital computer that reads all data from a large array in perfect simultaneity...
Edric Ellis
il 25 Ago 2020
As Matt says, without any details of the operation of my_function, it's hard to know what's the best strategy here. For example, it might be possible to distribute the contents of Data2, and transfer the bits of Data1 as necessary.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!