Saving data from SPMD loop to client
Show older comments
Hi All,
I'm running an smpd loop like
for c=1:NumLabs
all_data{c}.X = rand(100,100);
end
matlabpool NumLabs
smpd (NumLabs)
temp_X = all_data{labindex}.X
out = function(temp_X);
end
matlabpool close
How can I access the data stored in the composite object 'out' after closing the matlab pool? Is it possible to attach 'out' to "all_data{labindex}.out" in a way that its usable after closing the pool?
Thanks, Manuel.
Answers (2)
Edric Ellis
on 9 Jul 2012
After the SPMD block, 'out' is a 'Composite'. By indexing into the Composite, you ring the values back to the client. To bring a single value back, you can do this:
one_value = out{1};
If you want to bring all the values back, you could do something like this:
out_client = out(:);
Manuel
on 9 Jul 2012
0 votes
2 Comments
Edric Ellis
on 10 Jul 2012
Hi Manuel, You need to do "out_client = out(:);" before closing matlabpool, and then "out_client" will be stored on the client.
Edric Ellis
on 10 Jul 2012
For example:
matlabpool local 2
spmd
x = rand();
end
x_client = x(:);
matlabpool close
celldisp(x_client)
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!