parfeval blocks other parfeval?

Hi to all! I need to run a function (it's name is read_channel) in a worker while other workers run other functions. I call parfeval for the function read_channel and, after that, I call parfeval with another function. My problem is that, until the first parfeval doesn't finish, the other parfeval don't start. How can I do? The functions don't need to be synchronized
Thank you all!
data = csvread('data.csv');
first = parfeval(@read_channel,1);
if((strcmp(first.State, 'finished')==1)
out = fetchOutputs(first);
fprintf("output from first");
end
for m=1:2
others(m) = parfeval(@analyze,1,data);
end

2 件のコメント

Edric Ellis
Edric Ellis 2016 年 3 月 30 日
What size parallel pool are you opening? Your subsequent parfeval calls should definitely proceed if you have sufficient workers available.
Paolo Lolo
Paolo Lolo 2016 年 3 月 30 日
編集済み: Paolo Lolo 2016 年 3 月 30 日
Hi! Thank you for your response. I'm opening 4 workers. I disabled spmd and it works, but there is another way to do this? because, if it's possible, I need spmd instead of doing the last for loop but if I run the code it makes the same effect that I comment later.
data = csvread('data.csv');
first = parfeval(@read_channel,1);
if((strcmp(first.State, 'finished')==1)
out = fetchOutputs(first);
fprintf("output from first");
end
spmd(2)
data_out = analyze(data);
end

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel for-Loops (parfor) についてさらに検索

質問済み:

2016 年 3 月 29 日

編集済み:

2016 年 3 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by