PBS(Portable BatchSystem)简介
PBS(Portable Batch System)最初由NASA的Ames研究中心开发,主要为了提供一个能满足异构计算网络需要的软件包,用于灵活的批处理,特别是满足高性能计算的需要,如集群系统、超级计算机和大规模并行系统。PBS的主要特点有:代码开放,免费获取;支持批处理、交互式作业和串行、多种并行作业,如MPI、PVM、HPF、MPL;PBS是功能最为齐全, 历史最悠久, 支持最广泛的本地集群调度器之一。 PBS的目前包括openPBS, PBS Pro和Torque三个主要分支. 其中OpenPBS是最早的PBS系统, 目前已经没有太多后续开发,PBS pro是PBS的商业版本, 功能最为丰富. Torque是Clustering公司接过了OpenPBS, 并给与后续支持的一个开源版本.
PBS的应用不同于一般的直接运行:mpirun –np number ./executable_file
直接运行上句,则只能在单个节点上进行并行计算。如果要在多个节点上并行执行则要写machinefile或p4pgfile,两种文件的具体写法参考张林波等《并行计算导论》。运行命令分别为:
mpirun–machinefile filename
mpirun–p4pg filename
应用PBS提交任务则会形成任务队列,依次执行,有效分配资源,避免资源竞争。否则CPU时间片会轮流分配给各个人的任务,从而影响所有人的正常作业。
torque PBS 的安装配置及使用
torque PBS 提供对批处理作业和分散的计算节点(Compute nodes)的控制。
安装Torque组件:在一个节点上(head node)安装pbs_server【服务器—主节点】,所有计算节点上安装pbs_mom,所有计算节点和提交节点上安装PBS客户端【什么叫pbs客户端?】。至少做最基本的配置,使Torque系统跑起来,也就是使pbs_server能知道该和哪些机器通话。
在pbs_server上创建一个作业提交队列【什么叫作业提交队列?】。
在集群的所有节点上指定一个cluster name作为property【指定同一的集群名称?】。这可以用qmgr命令做到。比如:
qmgr -c "set node node properties=cluster-name"。
确保作业可以提交到节点上去。这可以通过使用qsub命令做到。比如:
echo "sleep 30" | qsub -l nodes=3。
一、Torque安装(在master管理结点上【又称为主节点、服务器?】)
1. 解压安装包
tar -zxvf torque-2.3.0.tar.gz
2. 进入到解压后的文件夹
./configure –prefix=/usr/torque --with-default-server=keylab2
make
make install
3. 打包,<user>必须是个普通用户【为什么必须是普通用户,针对普通用户产生的包,可用于所有普通用户】
1) [root@master torque-2.3.0]#./torque.setup yexq
2) [root@master torque-2.3.0]# make packages
把产生的tpackages , torque-package-clients-linux-x86-64.sh, torque-package-mom-linux-x86-64.sh拷贝到所有节点。
3) 客户端安装【提交任务的机器上安装,一般到主节点上提交任务】
在keylab2上执行
[root@master torque-2.3.0]# ./torque-package-server-linux-x86_64.sh --install
[root@master torque-2.3.0]# ./torque-package-clients-linux-x86_64.sh--install
[root@master torque-2.3.0]# ./torque-package-mom-linux-x86_64.sh --install
4)加入运算节点、修改/etc/hosts文件
编辑/var/spool/torque/server_priv/nodes (需要自己建立)加入如下内容
keylab2 np=24
修改/etc/hosts文件
[root@keylab2 vasp]# cat /etc/hosts
192.168.1.100 keylab1
192.168.1.102 keylab2
root@xiaoqiugood:~# cat /etc/hosts
#
# hosts This file describes a number ofhostname-to-address
# mappings for the TCP/IPsubsystem. It is mostly
# used at boot time, when no nameservers are running.
# On small systems, this file canbe used instead of a
# "named" nameserver. Just add the names, addresses
# and any aliases to this file...
#
# By the way, Arnt Gulbrandsen<agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name ofthe machine. It causes problems
# for some (stupid) programs, irc andreputedly talk. :^)
#
# For loopbacking.
127.0.0.1 localhost
127.0.0.1 xiaoqiugood.xiaoqiugood.orgxiaoqiugood
# End of hosts.
修改服务器上的/etc/hosts文件,确保由主机名字到IP地址的正确翻译。
127.0.0.1 localhost localhost.localdomain 保留localhost域名供没有连网时使用
192.168.0.254 server1.example.com server1
192.168.0.1 station1.example.com station1
192.168.0.2 station2.example.com station2
4)-I 配置 服务器名、mom进程配置文件
a)设置服务器名(主节点的名字):编辑/var/spool/torque/server_name文件,填写本机机器名(如keylab2)
b)设置MOM进程配置文件:编辑 /var/spool/torque/mom_priv/config文件,写入如下内容
$logevent0×1ff
$clienthost keylab2
4) –II环境变量设置及首次启动PBS(注意顺序)
LD_LIBRARY_PATH=/usr/torque/lib:$LD_LIBRARY_PATH
PATH=/usr/torque/bin: /usr/torque/sbin:$PATH
a) 启动mom进程:(任意路径下)执行命令 pbs_mom
b)启动调度器进程:执行命令 pbs_sched
root@keylab2 torque]# pbs_sched
pbs_sched: LOG_ERROR::Address already inuse (98) in main, bind
c)启动OpenPBS服务器进程,创建pbs数据库
执行命令 pbs_server -t create
其参数 -t create 只在首次启动server进程时才需要
pbs_server: network: Address already in use
PBS_Server: LOG_ERROR::PBS_Server,init_network failed dis
4)-III 设置成开机自启动
[root@keylab2 vasp]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* allthe other init scripts.
# You can put your own initialization stuffin here if you don't
# want to do the full