Using parfor and parfeval in separate pools

Is it possible, or even desirable, to make separate pools of workers that total to the number of cores on a system to speed up code processing?
Take the pseudo-code as an example for a 20-physical-core server:
parpool(16)
p = gcp();
parpool(4)
q = gcp()
parfor i = start:last % p
func1(q, i)
end
where
function func1(q, i)
for j = 0:i
parfeval(q,func2(j),...)
end
end

 採用された回答

OCDER
OCDER 2018 年 5 月 22 日
編集済み: OCDER 2018 年 5 月 22 日

0 投票

I don't think it'll be beneficial nor possible. I get an error like this, since you can't have multiple pools running. Matlab won't know which pool to distribute which data:
parpool(16)
p = gcp();
parpool(4)
q = gcp()
Error using parpool (line 104)
Found an interactive session. You cannot have multiple interactive sessions
open simultaneously. To terminate the existing session, use 'delete(gcp('nocreate'))'.
This seems like the simplest use of parfor for 20 cores:
parpool(20)
parfor i = start:last % p
B(i) = func2(A(i));
end
If this was for working around the 16-core limit when using parpool, this limit was removed in R2014a. See notes here for R2014a, 1st line: https://www.mathworks.com/help/releases/R2017a/distcomp/release-notes.html?rntext=&startrelease=R2014a&endrelease=R2017a

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel Computing Fundamentals についてさらに検索

製品

リリース

R2017b

タグ

質問済み:

2018 年 5 月 22 日

編集済み:

2018 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by