How to replace MATLABPOOL to PARPOOL ?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohamad Afiq
am 2 Apr. 2019
Beantwortet: Sean de Wolski
am 3 Apr. 2019
Hello guys.
I run a Parallel Toolbox coding which is annkmeans.m. In this coding, I found that, it still used the matlabpool command. Since MATLAB has removed this command and replaced with parpool, anyone knows how to change it? (refer: numChunks)
% chunk the data up
numData = size(X,2) ;
if opts.parallel
numChunks = max(matlabpool('size'), 1) ;
data = Composite() ;
dist = Composite() ;
assign = Composite() ;
for i = 1:numChunks
chunk = i:numChunks:numData ;
data{i} = X(:, chunk) ;
dist{i} = inf(1, numel(chunk), class(X)) ;
assign{i} = zeros(1, numel(chunk)) ;
end
else
numChunks = 1 ;
data = X ;
dist = inf(1, numData, class(X)) ;
assign = zeros(1, numData) ;
end
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 3 Apr. 2019
p = gcp;
p.NumWorkers
Will tell you the number of workers in the pool rather than matlabpool('size')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Parallel Computing Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!