Saving data from SPMD loop to client
显示 更早的评论
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.
回答(2 个)
Edric Ellis
2012-7-9
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
2012-7-9
0 个投票
2 个评论
Edric Ellis
2012-7-10
Hi Manuel, You need to do "out_client = out(:);" before closing matlabpool, and then "out_client" will be stored on the client.
Edric Ellis
2012-7-10
For example:
matlabpool local 2
spmd
x = rand();
end
x_client = x(:);
matlabpool close
celldisp(x_client)
类别
在 帮助中心 和 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!