简体   繁体   English

确定群集上的批处理作业中的MATLAB并行池大小

[英]determining matlab parallel pool size in a batch job on a cluster

I want to verify that my cluster is configured correctly, and I thought issuing the command below will run the following script and output the poolsize into a text file as well as where my screen output is directed (by the batch management environment). 我想验证集群是否配置正确,并且我想通过下面的命令将运行以下脚本,并将poolsize输出到文本文件中,以及将屏幕输出定向到的位置(通过批处理管理环境)。 Instead I only see output at the end, with nothing in the error file either. 相反,我只看到最后的输出,错误文件中也没有任何内容。 How shall I get this done? 我该如何完成?

Command: 命令:

matlab -nosplash -nodesktop < test.m

Script: 脚本:

clear;
delete(gcp);
parpool;
poolsize = poolobj.NumWorkers
save poolsize.txt poolsize -ascii
exit();
poolobj = gcp('nocreate'); % If no pool, do not create new one.
if isempty(poolobj)
    poolsize = 0;
else
    poolsize = poolobj.NumWorkers
end
save poolsizefile poolsize;
poolsize
exit();

(The second half never worked, so I even stopped trying, thus the first exit.) (后半部分从未使用过,因此我什至停止尝试,因此退出了第一个出口。)

Output: 输出:

>> >> Starting parallel pool (parpool) using the 'local' profile ... Warning: Found 1 pre-existing communicating job(s) created by pool that are
running, and 3 communicating job(s) that are pending or queued. You can use
'delete(myCluster.Jobs)' to remove all jobs created with profile local. To
create 'myCluster' use 'myCluster = parcluster('local')'. 

Firstly, I would suggest using the -r option to MATLAB to run your script as there are some occasional weirdnesses when piping input as you're doing, eg 首先,我建议对MATLAB使用-r选项来运行脚本,因为在进行输入时,有时会出现一些奇怪的现象,例如

matlab -nodisplay -r test

Then, I would change line 2 to state 然后,我将第2行更改为state

delete(gcp('nocreate'))

to ensure you don't create a pool simply to delete it. 以确保您不会创建仅用于删除池的池。 Then, the next bit should be 然后,下一位

poolobj = parpool;
poolsize = poolobj.NumWorkers;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM