フィルターのクリア

How to access the local part of a distributed matrix separately for each Pid

2 ビュー (過去 30 日間)
Ayush Porwal
Ayush Porwal 2019 年 10 月 30 日
コメント済み: Walter Roberson 2019 年 10 月 30 日
I want to make a 5 by 5 distributed matrix in such a way that each column in a ith row has a value i. In pMatlab library, I tried implementing the following code.
PARALLEL = 1;
Map = 1;
if PARALLEL
Map = map([Np 1], {}, 0:Np-1);
end
A = zeros(5,5,Map);
Aloc = local(A);
for Pid = 0:Np-1
if Pid == 0
for i = 1:size(Aloc,1)
Aloc(i,:) = i;
end
end
if Pid == 1
j = 4;
for i = 1:size(Aloc,1)
Aloc(i,:) = j;
end
j = j+1;
end
end
A = put_local(A,Aloc);
A
However, it seems that the for loop from 0:Np-1 isn't able to access the local part of that Pid. Please help. How can we achive the same thing using PCT?

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 10 月 30 日
編集済み: Walter Roberson 2019 年 10 月 30 日
You overwrite all of Aloc for two different pids, 0 and 1. You can only overwrite all of an array inside parallel workers if it is a local array rather than an output array.
  5 件のコメント
Ayush Porwal
Ayush Porwal 2019 年 10 月 30 日
Hi Walter
Thanks, I understand the code provided above. Have you worked using pMatlab library by MIT lincoln labs? parfor variable isn't available in that so I am stuck.
Walter Roberson
Walter Roberson 2019 年 10 月 30 日
Ah, no, I had never seen pMatlab before.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by