在Matlab的parfor中防止广播变量

时间:2020-05-04 09:42:46

标签: matlab parallel-processing parfor

考虑遵循MATLAB代码段

indices = cell(n,1);
values = rand(m,3);
% indices{...} contains a vector of integers 1,..,m

parfor i = 1:n
  currentIndices = indices{i};
  currentValues = values(currentIndices,:); % each worker needs the complete values-array
end

indices数组表示循环内values数组的哪些行是相关的。但是,每个工作程序都会获得values数组,因此MATLAB会警告将其广播给每个工作程序。有办法避免这种情况吗?

谢谢:)

0 个答案:

没有答案