目录

VMware+CentOS7安装单节点PBS Pro

misaraty 更新 | 2022-01-23
前言
想在虚拟机VMware+CentOS-7-x86_64-Minimal-1810环境下安装PBS,但torque有主机名等问题,最后我选择同类的PBS Pro

安装

注意
切换到root身份安装PBS Pro
1
unzip pbspro_19.1.1.centos7.zip
  • 解压之后得到一些rpm包,安装server
1
yum install pbspro-server-19.1.1-0.x86_64.rpm -y
  • 启动PBS服务,
1
2
/etc/init.d/pbs start #启动服务
/etc/init.d/pbs restart #重启,若下面的qmgr -c报错,运行此命令;否则,跳过此处。
  • 创建节点和队列,
1
2
3
4
5
6
qmgr -c "create node localhost"
qmgr -c 'create queue m1'
qmgr -c 'set server default_queue = m1'
qmgr -c 'set queue m1 queue_type = execution'
qmgr -c 'set queue m1 enabled = true'
qmgr -c 'set queue m1 started = true'

测试

注意
切换到非root身份提交PBS任务。

简单测试

1
2
echo 'sleep 30' | qsub
qstat

复杂些测试

测试脚本

  • job.sh
1
2
3
4
5
6
7
#!/bin/bash
#PBS -l nodes=localhost:ppn=2
#PBS -N test
#PBS -o stand.log
#PBS -e stand.err
cd $PBS_O_WORKDIR
julia test.jl > log
  • test.jl
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# export JULIA_NUM_THREADS=2  #mac/linux
# set JULIA_NUM_THREADS=2  #windows
function f_para01(n)
    s::Float64 = 0.0
    for i = 1:n
        s += exp(rand())
    end
    s /= n
    return s
end
@time f_para01(10000000000)

提交任务

1
qsub job.sh

查看任务

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[m@localhost julia_test]$ qstat
Job id            Name             User              Time Use S Queue
----------------  ---------------- ----------------  -------- - -----
17.localhost      test             m                 00:00:00 R m1 
[m@localhost julia_test]$ qstat -a
localhost: 
                                                            Req'd  Req'd   Elap
Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time
--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----
17.localhost    m        m1       test        26129   1   2    --    --  R 00:00
[m@localhost julia_test]$ pbsnodes -a
localhost
     Mom = localhost
     ntype = PBS
     state = job-busy
     pcpus = 2
     jobs = 17.localhost/0, 17.localhost/1
     resources_available.arch = linux
     resources_available.host = localhost
     resources_available.mem = 3861520kb
     resources_available.ncpus = 2
     resources_available.vnode = localhost
     resources_assigned.accelerator_memory = 0kb
     resources_assigned.hbmem = 0kb
     resources_assigned.mem = 0kb
     resources_assigned.naccelerators = 0
     resources_assigned.ncpus = 2
     resources_assigned.vmem = 0kb
     resv_enable = True
     sharing = default_shared
     last_state_change_time = Wed May 15 21:29:46 2019
     last_used_time = Wed May 15 21:17:45 2019

运行结果

1
2
[m@localhost julia_test]$ ls
job.sh  log  stand.err  stand.log  test.jl

这样我们就可以在VMware虚拟机中提交PBS任务了。