【发布时间】:2015-02-12 12:44:44
【问题描述】:
假设我们在 MATLAB 中有这段代码:
parpool('local',2) % Create a parallel pool
W = ones(6,6);
W = distributed(W); % Distribute to the workers
spmd
T = W*2; % Calculation performed on workers, in parallel
% T and W are both codistributed arrays here
end
T % View results in client.
whos % T and W are both distributed arrays here
delete(gcp) % Stop pool
我在文档中看到普通数组和分布式数组之间的区别是:当我们使用分布式数组时,这些数组直接发送给工作人员,客户端上没有任何数组。所以我们无法在客户端访问这些数组?这只是差异吗?
如果我们去掉
W = distributed(W);这一行,代码的结构和输出有什么区别?使用分布式数组的目的是什么?distributed和codistributed有什么区别。正如我在文档中所读到的,我们只能在spmd块中使用codistributed。真的吗?
【问题讨论】:
-
这个问题对我来说似乎有点太宽泛了......
标签: matlab parallel-processing parfor