matlabpool open n; doesn't work.
显示 更早的评论
Hi,
I'd like to open matlabpool with a variable number of cores, to use the maximum number of cores available. So n would equal features('numCores') here.
But matlabpool open n, matlabpool open features('numCores'), matlabpool open maxNumCompThreads don't work here. matlabpool open seems to accept only numbers and not variables.
I could do something stupid like
if features('numCores') == 4
matlabpool open 4;
elseif features('numCores') == 2
matlabpool open 2;
end
but I'd like to know if something more elegant exists.
Thanks!
采纳的回答
更多回答(2 个)
If you have R2013b or later, you shouldn't be using matlabpool . You should be using parpool , which does take a variable as input directly,
parpool(n)
3 个评论
Martin
2014-5-7
Haseeb Hassan
2018-10-7
Thank you Matt for your useful hint.
Bruno Silva
2020-1-17
Thanks!
Malshikho
2018-5-25
0 个投票
Unfortunately I have Matlab R2010b
1 个评论
Steven Lord
2018-5-25
Then use matlabpool using the syntax described in the accepted answer by Niklas Nylén.
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!