In-place editing of (co)distributed arrays?
조회 수: 2 (최근 30일)
이전 댓글 표시
If I have a large distributed array A, and I do some in-place operation to it inside an SPMD block, here's what I would write:
spmd
A_codistr = getCodistributor(A);
local_A = getLocalPart(A);
local_A = some_inplace_operation(local_A);
A = codistributed.build(local_A, A_codistr);
end
However, is it true that this would create a copy of local_A on each machine, because the reference to A still exists when you call getLocalPart on it? Is the MATLAB PCT smart enough to recognize that I am simply doing in-place operations on the local parts of A?
If not, what would be a good way to ensure that normal in-place operation in MATLAB can be done on local parts of distributed arrays?
댓글 수: 0
답변 (1개)
Jill Reese
2012년 7월 2일
This is the right way to perform an in-place operation with codistributed arrays. You should also make sure that the implementation of some_inplace_operation uses in-place optimization like so:
function local_A = some_inplace_operation(local_A)
% do stuff with A and overwrite the input
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Distributed Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!