PBS的配置

2024-03-24 10:48
文章标签 配置 pbs

本文主要是介绍PBS的配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

PBS的配置

http://grid.tsinghua.edu.cn/home/liulk/wiki/computer/pbsconfig.html 

内容提纲:

安装前的要求

安装

PBS的配置

起动PBS.

创建队列.

PBS Script samples

 

安装前的要求

如果是单机跑跑pbs, 那么什么都不要求. 如果你想在机群上pbs,那么再进行pbs安装之前你需要保证一些其他的软件都能工作.

  • NFS 这个是为了在机群之间共享一个目录, 使得个个机器都能访问.
  • Nis 这是是为了在机群上实现统一的用户认证.

安装

pbs的安装比较简单, 应该说是一个标准的linux的tarball安装方式. 安装过程主要有如下几步:

  • 下载pbs的源码包 OpenPBS-2.3.12sc2.tar。
  • 解压缩软件包
    $tar zxvpf OpenPBS-2.3.12sc2.tar
    
  • 进入相应的目录, 配置,make
    $cd SPBS-1.0.0
    $./configure --enable-docs --disable-gui
    $make
    
    注意上面的选项
     --enable-docs 指定要编译文档--disable-gui 指定去掉图形界面. 因为图形界面要求需要tck支持, 而且似乎必须是tcl-8.0的版本, 高了会出错--enable-scp  先使用scp,再使用rcp进行数据的复制.
  • 切换成root用户, 安装.
    $su
    #make install
    
    默认情况下, PBS会安装再/usr/spoole/PBS目录下. 该目录在./configure 的时候指定 --prefix=/you/want/dir来更改. 建议对于初次安装的人采用默认的设置.

PBS的配置

一般来说, PBS系统必须有一个server和至少一个mom, server负责作业的提交, mom接受server的控制,负责作业的执行. 假设pbs的根目录为 $PBS_HOME. server节点为CGSP48, mom节点为CGSP48和CGSP47,也就是CGSP48既作为共享server也作为mom, 而CGSP47只作为mom.

  1. 配置server_name 编辑所有的节点的 $PBS_HOME/server_name,在里面写入选定的server的主机名. 例如
    CGSP48
    
  2. 配置节点. 在CGSP48的 $PBS_HOME/server_priv目录下建立nodes文件.
    touch nodes
    
    在nodes文件写入你所有mom节点的名称:
    CGSP48 np=2
    CGSP47 np=3
    
    其中的np代表的是虚拟处理器的个数. 实际上也就是该节点最多可以同时跑多少个任务.
  3. 配置mom节点,使其接受sever节点的控制. 编辑每个mom节点的 $PBS_HOME/mom_priv目录下的config文件(没有就自己建立). 写入如下信息
    $logevent 0x1ff
    $clienthost CGSP48
    
    其中:
    $logevent 指定的日志的级别, 基本上不用修改. 默认就很好了
    $clienthost 指定的server的地址
    

起动PBS.

pbs起动最好按如下顺序. mom, sever, sched. 而且必须以root身份起动. 命令如下:

# /usr/local/sbin/pbs_mom
# /usr/local/sbin/pbs_server -t create
# /usr/local/sbin/pbs_sched

其中, -t create 在第一次起动的时候要用, 用于创建一些初始化必要的环境. 以后起动就不在需要了.

创建队列.

PBS中的队列分为两种类型, 执行队列和路由队列. 下面是一个创建队列的脚本.

# 
# Create and define queue verylong 
# 
create queue verylong 
set queue verylong queue_type = Execution 
set queue verylong Priority = 40 
set queue verylong max_running = 10 
set queue verylong resources_max.cput = 72:00:00 
set queue verylong resources_min.cput = 12:00:01 
set queue verylong resources_default.cput = 72:00:00 
set queue verylong enabled = True 
set queue verylong started = True 
# 
# Create and define queue long 
# 
create queue long 
set queue long queue_type = Execution 
set queue long Priority = 60 
set queue long max_running = 10 
set queue long resources_max.cput = 12:00:00 
set queue long resources_min.cput = 02:00:01 
set queue long resources_default.cput = 12:00:00 
set queue long enabled = True 
set queue long started = True 
# 
# Create and define queue medium 
# 
create queue medium 
set queue medium queue_type = Execution 
set queue medium Priority = 80 
set queue medium max_running = 10 
set queue medium resources_max.cput = 02:00:00 
set queue medium resources_min.cput = 00:20:01 
set queue medium resources_default.cput = 02:00:00 
set queue medium enabled = True 
set queue medium started = True 
# 
# Create and define queue small 
# 
create queue small 
set queue small queue_type = Execution 
set queue small Priority = 100 
set queue small max_running = 10 
set queue small resources_max.cput = 00:20:00 
set queue small resources_default.cput = 00:20:00 
set queue small enabled = True 
set queue small started = True                   
# 
# Create and define queue default 
# 
create queue default 
set queue default queue_type = Route 
set queue default max_running = 10 
set queue default route_destinations = small 
set queue default route_destinations += medium 
set queue default route_destinations += long 
set queue default route_destinations += verylong 
set queue default enabled = True 
set queue default started = True 
# 
# Set server attributes. 
# 
set server scheduling = True 
set server max_user_run = 6 
set server acl_host_enable = True 
set server acl_hosts = * 
set server default_queue = default 
set server log_events = 63 
set server mail_from = adm 
set server query_other_jobs = True 
set server resources_default.cput = 01:00:00 
set server resources_default.neednodes = 1 
set server resources_default.nodect = 1 
set server resources_default.nodes = 1 
set server scheduler_iteration = 60 
set server default_node = 1#shared

该脚本定义了verylong long medium small 四个作业队列 和 一个default路由队列. 里面的几个比较重要的属性:

 enabled 指示作业队列可用. 也就是可以往里面添加新的作业了.actived 指示作业队列处于活动状态, 可以参与调度了. 好象是这个样子的. 反正两个都设置为true就可以了.sever的scheduling属性指示server开始调度. 这个属性非常的重要.为了这个属性, 我浪费了一个晚上. 因为只要该属性没有设置,那么服务器中的所有的作业就一直处于Q状态.

到此为止PBS的配置基本就完成了. 当然. PBS还有很多的参数可以设置. 但那就不是这个基本配置想给大家的. 大家自己去查PBS的手册把.

PBS Script samples

#LJRS -S /bin/bash
#LJRS -o script.out
#LJRS -j oe
#LJRS -q dpool
#LJRS -l nodes=8:ppn=1      (nodes:计算节点数,ppn:计算节点CPU数)
#LJRS -l walltime=48:00:00  (用户估计的最大计算时间,超时系统会自动中断作业)limit -s unlimited
TMPFILE=`whoami`_mpich_gm.tmp
sed 's/c/g/g' $LJRS_NODEFILE > /tmp/$TMPFILE
GM_NODEFILE=/tmp/$TMPFILE
echo Working directory is $LJRS_O_WORKDIR
cd $LJRS_O_WORKDIR
echo Runing on host `hostname`
echo Starting Time is `date`
echo Directory is `pwd`
echo This jobs runs on the following processors:
echo `cat $GM_NODEFILE`
NPROCS=`wc -l < $GM_NODEFILE`
echo This job has allocated $NPROCS nodes## User Parallel Program ###########mpirun -v -machinefile $GM_NODEFILE -np $NPROCS ~/my_parallel.exe > out (修改为用户的并行作业执行命令)####################################rm -f /tmp/$TMPFILE
echo Ending Time is `date`
##########################################################################
#
# Script for submitting parallel Gaussian 03 jobs to the cluster.
#
###########################################################################
# To use this script, first make the following changes:
#
#  1. Add the G03 .com filename to "jobname=", but leave out the suffix .com.
#      Example:  jobname=input
#  2. Add the same filename to #LJRS -o with the suffix .err.
#      Example:  #LJRS -o water03.err
#  3. Specify the number of nodes(nodes = x) and processors per node
#      (ppn = y) needed for the job. Note that each job should typically use
#      both processors on each node(i.e., ppn = 2). Therefore, set nodes equal
#      to the total number of processors divided by 2.
#      Example: If the job needs 16 processors total, then:
#                #LJRS -l nodes=8:ppn=2
#     Note that the appropriate number of processors must be requested in
#      the .com file. In the above example, %nprocl=16 must be specified
#      before the job command line(i.e., the line beginning with "#").
#      (Note: Either the command nprocl or nproclinda can be used.)
#      If only one processor is required, then %nprocl does not need to be
#      specified. In the .g03 file, one processor is specified as:
#                #LJRS -l nodes=4:ppn=2
#  4. Set the maximum length of time the job will use.
#      Example:  #LJRS -l walltime=24:00:00
#  5. Make sure the input (.com) and submitting script (.g03) files are in
#      the same directory.
#
#  Submit the script using "qsub input.g03".
###########################################################################
# Lines that begin with #LJRS are PBS directives (not comments).
# True comments begin with "# " (i,e., # followed by a space).
############################################################################LJRS -S /bin/bash
#LJRS -o water333.err
#LJRS -j oe
#LJRS -q dpool
#LJRS -l nodes=4:ppn=2        (与input.com文件保持一致)
#LJRS -l walltime=860:00:00  (用户估计的最大计算时间,超时系统会自动中断作业)
#LJRS -Vcat "$LJRS_NODEFILE"#############################################################################
#  -S: shell the job will run under
#  -o: name of the queue error filename
#  -j: merges stdout and stderr to the same file
#  -l: resources required by the job: number of nodes and processors per node
#  -l: resources required by the job: maximun job time length
############################################################################## Define variable "jobname".jobname=input                  (g03输入文件名,不包括.com扩展名)
username=`whoami`ulimit -s unlimited# Make a directory in scr and copy .com and .g03 file to there.GAUSS_RUNDIR=/scratch/${username}
if [ ! -a $GAUSS_RUNDIR ]; thenecho "Scratch directory $GAUSS_RUNDIR created."mkdir -p $GAUSS_RUNDIR
ficp $LJRS_O_WORKDIR/${jobname}.* $GAUSS_RUNDIRORIG_LJRS_O_WORKDIR=${LJRS_O_WORKDIR}
LJRS_O_WORKDIR=${GAUSS_RUNDIR}
cd $LJRS_O_WORKDIR# Setup for Gaussian 03:
# =======================
# Make a scratch directory if it doesn't already exist.GAUSS_SCRDIR=/scratch/${username}/${jobname}
if [ ! -a $GAUSS_SCRDIR ]; thenecho "Scratch directory $GAUSS_SCRDIR created."mkdir -p $GAUSS_SCRDIR
fi
export GAUSS_SCRDIR
echo "Using $GAUSS_SCRDIR for temporary Gaussian 03 files."# Define the location where Gaussian was installed and run
# a setup script, g03.profile.g03root=/export/local/g03
source $g03root/g03/bsd/g03.profile
#source /export/local/g03/g03/bsd/g03.profile# Define PATH to include location of LINDAPATH=$PATH:/export/local/g03/g03/linda7.1/intel-linux2.4/bin# Define node list#echo $LJRS_NODEFILE $LJRS_JOBID > /tmp/g03log
sed 's/c/g/g' $LJRS_NODEFILE > $GAUSS_SCRDIR/tsnet.nodes
#cat /tmp/$2 > $LJRS_NODEFILEG03_NODEFILE="$GAUSS_SCRDIR/tsnet.nodes"GAUSS_LFLAGS="-mp 2 -nodefile $G03_NODEFILE"# Export variable listexport PATH g03root GAUSS_LFLAGSecho pbs nodefile:cat $G03_NODEFILE#Run a Gaussian command file, water03.com, redirecting output
#to a file, water03.logecho "Starting Gaussian run at" `date`time g03l < $GAUSS_RUNDIR/${jobname}.com >$GAUSS_RUNDIR/${jobname}.logecho "Finished Gaussian run at" `date`LJRS_O_WORKDIR=${ORIG_LJRS_O_WORKDIR}echo $LJRS_O_WORKDIRmv $GAUSS_RUNDIR/${jobname}.* $LJRS_O_WORKDIR
mv $GAUSS_RUNDIR/*.chk $LJRS_O_WORKDIR
echo "$GAUSS_SCRDIR"rm -Rf $GAUSS_SCRDIR

这篇关于PBS的配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/841369

相关文章

mybatis映射器配置小结

《mybatis映射器配置小结》本文详解MyBatis映射器配置,重点讲解字段映射的三种解决方案(别名、自动驼峰映射、resultMap),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定... 目录select中字段的映射问题使用SQL语句中的别名功能使用mapUnderscoreToCame

Linux下MySQL数据库定时备份脚本与Crontab配置教学

《Linux下MySQL数据库定时备份脚本与Crontab配置教学》在生产环境中,数据库是核心资产之一,定期备份数据库可以有效防止意外数据丢失,本文将分享一份MySQL定时备份脚本,并讲解如何通过cr... 目录备份脚本详解脚本功能说明授权与可执行权限使用 Crontab 定时执行编辑 Crontab添加定

Java使用jar命令配置服务器端口的完整指南

《Java使用jar命令配置服务器端口的完整指南》本文将详细介绍如何使用java-jar命令启动应用,并重点讲解如何配置服务器端口,同时提供一个实用的Web工具来简化这一过程,希望对大家有所帮助... 目录1. Java Jar文件简介1.1 什么是Jar文件1.2 创建可执行Jar文件2. 使用java

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

Vite 打包目录结构自定义配置小结

《Vite打包目录结构自定义配置小结》在Vite工程开发中,默认打包后的dist目录资源常集中在asset目录下,不利于资源管理,本文基于Rollup配置原理,本文就来介绍一下通过Vite配置自定义... 目录一、实现原理二、具体配置步骤1. 基础配置文件2. 配置说明(1)js 资源分离(2)非 JS 资

MySQL8 密码强度评估与配置详解

《MySQL8密码强度评估与配置详解》MySQL8默认启用密码强度插件,实施MEDIUM策略(长度8、含数字/字母/特殊字符),支持动态调整与配置文件设置,推荐使用STRONG策略并定期更新密码以提... 目录一、mysql 8 密码强度评估机制1.核心插件:validate_password2.密码策略级

ShardingProxy读写分离之原理、配置与实践过程

《ShardingProxy读写分离之原理、配置与实践过程》ShardingProxy是ApacheShardingSphere的数据库中间件,通过三层架构实现读写分离,解决高并发场景下数据库性能瓶... 目录一、ShardingProxy技术定位与读写分离核心价值1.1 技术定位1.2 读写分离核心价值二

QT Creator配置Kit的实现示例

《QTCreator配置Kit的实现示例》本文主要介绍了使用Qt5.12.12与VS2022时,因MSVC编译器版本不匹配及WindowsSDK缺失导致配置错误的问题解决,感兴趣的可以了解一下... 目录0、背景:qt5.12.12+vs2022一、症状:二、原因:(可以跳过,直奔后面的解决方法)三、解决方

SpringBoot路径映射配置的实现步骤

《SpringBoot路径映射配置的实现步骤》本文介绍了如何在SpringBoot项目中配置路径映射,使得除static目录外的资源可被访问,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一... 目录SpringBoot路径映射补:springboot 配置虚拟路径映射 @RequestMapp

Nginx中配置使用非默认80端口进行服务的完整指南

《Nginx中配置使用非默认80端口进行服务的完整指南》在实际生产环境中,我们经常需要将Nginx配置在其他端口上运行,本文将详细介绍如何在Nginx中配置使用非默认端口进行服务,希望对大家有所帮助... 目录一、为什么需要使用非默认端口二、配置Nginx使用非默认端口的基本方法2.1 修改listen指令