MATLAB并行工具箱虽然没有进行深入研究,但是parfor的易用性和威力还是很诱人的。
但是2015a版的在win7系统(我试了好几台电脑)上parpool起不来,
报如下错误
>>
parpool Starting parallel pool (parpool) using the
'local' profile ... Error using parpool (line
103)Failed to start a parallel pool. (For information in addition
to the causing error, validate the profile'local' in the Cluster
Profile Manager.)Caused by:Error using
parallel.internal.pool.InteractiveClient>iThrowWithCause
(line 667)Failed to initialize the interactive session.Error using
parallel.internal.pool.InteractiveClient>iThrowIfBadParallelJobStatus
(line 768)The interactive communicating job failed with no
message.
同样的安装文件在win8.1上安装就没有任何问题。
后来用matlab自带的工具测试了一下原来是spmd功能打不开,如下图
后来看parpool的帮助,可以利用如下参数在win7上启动parpool
>>
parpool('SpmdEnabled',false)Starting parallel pool (parpool) using
the 'local' profile ... connected to 2 workers.ans
= Pool with
properties: Connected: trueNumWorkers: 2Cluster:
localAttachedFiles: {}IdleTimeout: 30 minute(s) (30 minutes
remaining)SpmdEnabled: false
这样的话parpool就能顺利打开,parfor能用,但是spmd就不能用了。
权宜之计,要么就装别的版本matlab,要么就装win8.
还有一个更好的选择,装即将到来的win10。。。
--------分割线-------------
用google搜了一下发现了更好的解决办法
distcomp.feature( 'LocalUseMpiexec', false )
命令行输入上面的命令,parpool就可以正常启动了。
把它添加到startup.m里面就可以一劳永逸了。