VMware+Centos7安装单节点PBS Pro

想在虚拟机VMware+CentOS-7-x86_64-Minimal-1810环境下安装PBS,torque有主机名等问题,最后我选择同类的PBS Pro。

先以root身份操作。下载PBS Pro v19.1.1,选择pbspro_19.1.1.centos7.zip。

unzip pbspro_19.1.1.centos7.zip

得到一些rpm包,安装server,

yum install pbspro-server-19.1.1-0.x86_64.rpm -y

启动PBS服务,

/etc/init.d/pbs start #启动服务
/etc/init.d/pbs restart #重启,若下面的qmgr -c报错,运行此命令;否则,跳过此处。

创建节点和队列,

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任务。

简单测试,

echo 'sleep 30' | qsub
qstat

复杂点测试,

job.sh,

#!/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,

# 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)

提交任务,

qsub job.sh

查看任务,

[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

运行结束后得到以下文件,

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

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