Struggling to distribute a cell array across several parallel workers
1 view (last 30 days)
Show older comments
I have some code, part of which a structure of the form below.
for a = 1:A
for b = 1:B
for c = 1:C
for d = 1:D
for j = 1:2
cellArray = manipulate(cellArray,a,b,c,d,j,params);
end
end
end
end
end
A,B,C and D are constant.
cellArray is a large cell array, each entry of which is a large, multidimensional matrix.
The function 'manipulate' needs to know the loop parameters, a, b, c, d and j, as well as some other fixed parameters, 'params', and modifies only cellArray, simply by adding numbers to elements of its constituent matrices. The loop parameters, a, b, c, d and j specify which subset of the data is used and which subset is to have numbers added to it, with j having a slightly different status to a, b, c and d in that it partitions the cells into two distinct subsets, one of which is read and the other modified for j=1 and vice versa for j=2.
I've squeezed every last bit of performance that I can out of my code, and now I want to parallelize it. My question is, how can I distribute access to cellArray and the other parameters across parallel workers and run 'manipulate' in parallel? I have a mental picture of cellArray as a large pool of data, with the parallel workers as little robots buzzing around the pool, reading what they need and then going in and adding something to the appropriate bit of the pool. I feel like this ought to be possible...or am I just crazy??
7 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!