pbs 查看隊(duì)列計(jì)算核限制

超算上一般都是使用PBS的作業(yè)管理系統(tǒng)對(duì)提交的作業(yè)進(jìn)行資源分配和利用的管理.

隊(duì)列計(jì)算核限制問題

在使用超算的過程中,因?yàn)椴恢狸?duì)列的核數(shù)限制(主要還是不太懂pbs工作的原理),如何知道提交的計(jì)算資源是否超過了隊(duì)列的限制?


我今天使用學(xué)校的超算free隊(duì)列進(jìn)行測(cè)試。

測(cè)試

官方宣稱隊(duì)列最多只能進(jìn)行2個(gè)節(jié)點(diǎn),每個(gè)節(jié)點(diǎn)只能進(jìn)行2個(gè)核的計(jì)算.
下面使用超算mpi環(huán)境安裝和使用使用到的簡(jiǎn)單的測(cè)試代碼.

先使用官方宣稱的資源進(jìn)行測(cè)試:2個(gè)節(jié)點(diǎn),每個(gè)節(jié)點(diǎn)2個(gè)計(jì)算核.
對(duì)應(yīng)的pbs(free.pbs)文件如下:

2節(jié)點(diǎn)2核

#PBS -N test
#PBS -l nodes=2:ppn=2
#PBS -j oe
#PBS -q free
#PBS -l walltime=0:05:0

cd $PBS_O_WORKDIR 
JOBID=`echo $PBS_JOBID | awk -F. '{print $1}'`
echo This job id is $JOBID | tee job_info.log
echo Working directory is $PBS_O_WORKDIR | tee -a job_info.log
echo Start time is `date` | tee -a job_info.log 
echo This job runs on the following nodes: | tee -a job_info.log
echo `cat $PBS_NODEFILE | sort | uniq` | tee -a job_info.log
NPROCS=`cat $PBS_NODEFILE | wc -l`
NNODES=`uniq $PBS_NODEFILE | wc -l`
PPROCS=$(($NPROCS/$NNODES))
echo This job has allocated $NNODES nodes, $NPROCS processors.| tee -a job_info.log

uniq $PBS_NODEFILE | sort | sed s/$/i:$PPROCS/ > $PBS_O_WORKDIR/hostfile

#source your profile
MPIRUN="mpiexec -np $NPROCS -f $PBS_O_WORKDIR/hostfile -env I_MPI_DEVICE=rdma"
JOBCMD="./a.out"
{ time $MPIRUN $JOBCMD; } >$PBS_O_WORKDIR/output_$JOBID.log 2>&1

echo End time is `date`| tee -a job_info.log
rm -f  $PBS_O_WORKDIR/hostfile
pkill -P $$
exit 0

之后提交進(jìn)行計(jì)算

*****@login5:[/public/home/********/code/temp]ls
a.out  free.pbs  main.c  
# 提交
*****@login5:[/public/home/********/code/temp]qsub free.pbs 
360237.admin-ha
# 提交成功 查看作業(yè)信息
*****@login5:[/public/home/********/code/temp]qstat -a
360237.admin-ha         zh****g    free             test              30894     2      4    --   00:05:00 C       -- 
# 計(jì)算完成 查看計(jì)算結(jié)果
*****@login5:[/public/home/********/code/temp]ls
a.out  free.pbs  job_info.log  main.c  output_360237.log  test.o360237
# 輸出結(jié)果
*****@login5:[/public/home/********/code/temp]cat output_360237.log 
hello world from process 0 of size 4   -- name c1137 .
hello world from process 1 of size 4   -- name c1137 .
hello world from process 2 of size 4   -- name c1138 .
hello world from process 3 of size 4   -- name c1138 .

real    0m0.865s
user    0m0.043s
sys 0m0.028s

上述操作完成后,說明使用2個(gè)節(jié)點(diǎn)的2核計(jì)算是成功的.

3節(jié)點(diǎn)2核

嘗試使用3個(gè)節(jié)點(diǎn),每個(gè)節(jié)點(diǎn)2個(gè)計(jì)算核.
只需要將之前的free.pbs文件的第二行修改為:

#PBS -l nodes=3:ppn=2

進(jìn)行提交計(jì)算:

# 提交計(jì)算
*****@login5:[/public/home/********/code/temp]qsub free.pbs 
360245.admin-ha
# 提交成功 查看隊(duì)列情況
# 數(shù)據(jù)表示意思分別是
# 作業(yè)id號(hào)    用戶名(隱私用**)   提交的隊(duì)列名稱   作業(yè)名稱(在pbs文件中指定)    ---   3代表3個(gè)節(jié)點(diǎn)    6代表一共3*2個(gè)計(jì)算核   時(shí)間限制5分鐘   目前作業(yè)運(yùn)行情況Q(等待),R(正在執(zhí)行)
*****@login5:[/public/home/********/code/temp]qstat -a
360245.admin-ha         zh****g    free             test                --      3      6    --   00:05:00 Q       --

發(fā)現(xiàn)提交的隊(duì)列一直屬于等待狀態(tài)(Q),故刪除該隊(duì)列.

*****@login5:[/public/home/********/code/temp]qdel 360245

上述發(fā)現(xiàn)學(xué)校官方的數(shù)據(jù)不太準(zhǔn)確,不是說好這個(gè)隊(duì)列只支持2個(gè)節(jié)點(diǎn),每個(gè)節(jié)點(diǎn),最大限制是2個(gè)核嗎?
暫時(shí)先不管之后再解決這個(gè)問題.

在進(jìn)行如下測(cè)試:

2節(jié)點(diǎn)5核

同樣修改對(duì)應(yīng)的free.pbs文件

#PBS -l nodes=2:ppn=5

進(jìn)行如下操作:

*****@login5:[/public/home/********/code/temp]qsub free.pbs 
qsub: submit error (Job exceeds queue resource limits MSG=cannot satisfy queue max procct requirement)

提交作業(yè)不成功,說明該隊(duì)列對(duì)核數(shù)進(jìn)行了限制.此時(shí)提交的2*5=10計(jì)算核超過了該隊(duì)列的上限.


上述測(cè)試證實(shí)了當(dāng)提交的計(jì)算核超過該隊(duì)列支持的最大上限時(shí),是不能提交作業(yè)成功的,直接提示作業(yè)錯(cuò)誤.

如何查看隊(duì)列的最大核數(shù)呢?

# 查看超算上一共有多少個(gè)隊(duì)列 
# 對(duì)應(yīng)的參數(shù)分別代表的含義
# 隊(duì)列名稱(Queue)  最大同時(shí)執(zhí)行作業(yè)數(shù)(Max)   當(dāng)前總共提交的作業(yè)數(shù)(Tot)  (Ena)(Str) 應(yīng)該代表該隊(duì)列是否激活  當(dāng)前隊(duì)列下等待的作業(yè)數(shù)(Que) 當(dāng)前隊(duì)列下正在執(zhí)行的作業(yè)數(shù)(Run)
*****@login5:[/public/home/********/code/temp]qstat -Q  
Queue              Max    Tot   Ena   Str   Que   Run   Hld   Wat   Trn   Ext T   Cpt
----------------   ---   ----    --    --   ---   ---   ---   ---   ---   --- -   ---
gpu_test           200      0   yes   yes     0     0     0     0     0     0 E     0
mic_phy1           200      0    no    no     0     0     0     0     0     0 E     0
long               150    163   yes   yes    65    98     0     0     0     0 E     0
low                200      0   yes   yes     0     0     0     0     0     0 E     0
blades             300    274   yes   yes   206    67     0     0     0     0 E     1
fat4t                0      0    no    no     0     0     0     0     0     0 E     0
fat1t                0     75   yes   yes    56    19     0     0     0     0 E     0
free                20      1   yes   yes     0     0     0     0     0     0 E     1
gpu536             200      5   yes   yes     2     1     0     0     0     0 E     2
single              20      0   yes   yes     0     0     0     0     0     0 E     0
short               40     42   yes   yes    31    11     0     0     0     0 E     0
yxma_256           200      0    no    no     0     0     0     0     0     0 E     0
mic_asc            200      0   yes   yes     0     0     0     0     0     0 E     0
lzz_973            200      0   yes   yes     0     0     0     0     0     0 E     0
defaultApp           0      0   yes   yes     0     0     0     0     0     0 E     0
little               0     93   yes   yes    57    35     0     0     0     0 E     1
c536                 0      7   yes   yes     4     3     0     0     0     0 E     0
f536                 0      4   yes   yes     1     3     0     0     0     0 E     0
c561                 0      4   yes   yes     0     4     0     0     0     0 E     0

此時(shí)看到了熟悉的free隊(duì)列,查看free隊(duì)列詳細(xì)的信息.

*****@login5:[/public/home/********/code/temp]qstat -Qf free
Queue: free
    queue_type = Execution
    max_user_queuable = 5
    total_jobs = 0
    state_count = Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 Comp
    lete:0 
    max_running = 20
    acl_host_enable = False
    acl_hosts = c1138,c1137
    acl_user_enable = False
    resources_max.procct = 8
    resources_max.walltime = 00:20:00
    resources_default.walltime = 00:20:00
    mtime = 1544882636
    resources_assigned.nodect = 0
    max_user_run = 10
    enabled = True
    started = True

其中:

    resources_max.procct = 8 # 表示該隊(duì)列最大支持8個(gè)計(jì)算核

當(dāng)沒有這條語句命令(resources_max.procct)的話,應(yīng)該默認(rèn)下該隊(duì)列對(duì)計(jì)算核是不給限制的.

所以當(dāng)我設(shè)置1個(gè)節(jié)點(diǎn)8個(gè)計(jì)算核提交成功,1個(gè)節(jié)點(diǎn)9個(gè)計(jì)算核則提交失敗.


解釋為什么官方說2個(gè)節(jié)點(diǎn).

查看我們之前程序的輸出結(jié)果:

hello world from process 0 of size 4   -- name c1137 .
hello world from process 1 of size 4   -- name c1137 .
hello world from process 2 of size 4   -- name c1138 .
hello world from process 3 of size 4   -- name c1138 .

恰好是該隊(duì)列指定的2個(gè)節(jié)點(diǎn)名稱.

 acl_hosts = c1138,c1137

解釋為什么使用3個(gè)節(jié)點(diǎn)提交計(jì)算也能成功.

原因猜想的,該隊(duì)列沒有對(duì)節(jié)點(diǎn)進(jìn)行限制,但指定了特定的節(jié)點(diǎn)( acl_hosts = c1138,c1137),意思可能是當(dāng)該隊(duì)列提交任務(wù)時(shí),優(yōu)先使用這些節(jié)點(diǎn)進(jìn)行計(jì)算,當(dāng)節(jié)點(diǎn)數(shù)不夠時(shí),再去找其他空余的節(jié)點(diǎn)進(jìn)行操作.


pbs具體的使用還是得看幫助文檔,無奈幫助文檔太長(zhǎng),而且是英文的,看不下去,所有只能自己摸索下去,文中對(duì)有些概念的理解可能有誤,官方為主.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容