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!