PBS脚本

#PBS -N test
#PBS -S /bin/sh
#PBS -o ./_stdout
#PBS -e ./_stderr
#
echo "I ran on:"
cat $PBS_NODEFILE
#
#export GMPICONF=/users/your-user-name/.gmpi/$PBS_JOBID
#
#cd to your execution directory first
cd ~
#
#use mpirun to run my MPI binary with 7 nodes for 1 hour
#mpirun -np 14 ./your-mpi-program
ping -c 10 localhost

PBS Script samples

#!/bin/sh
echo Working directory is $PBS_O_WORKDIR
#cd $PBS_O_WORKDIR
echo Runing on host `hostname`
echo Starting Time is `date`
echo Directory is `pwd`
echo User is `whoami`
bash -c set
## User Parallel Program ###########
ping -c 10 10.0.0.35
echo "finish" > out
scp out grs-a@10.0.2.48:$PBS_O_WORKDIR
#mpirun -v -machinefile $GM_NODEFILE -np $NPROCS ~/my_parallel.exe > out
####################################
echo Ending Time is `date`

一个mpi脚本

#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 -V
cat "$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 ]; then
echo "Scratch directory $GAUSS_RUNDIR created."
mkdir -p $GAUSS_RUNDIR
fi
cp $LJRS_O_WORKDIR/${jobname}.* $GAUSS_RUNDIR
ORIG_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 ]; then
echo "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 LINDA
PATH=$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_NODEFILE
G03_NODEFILE="$GAUSS_SCRDIR/tsnet.nodes"
GAUSS_LFLAGS="-mp 2 -nodefile $G03_NODEFILE"
# Export variable list
export PATH g03root GAUSS_LFLAGS
echo pbs nodefile:
cat $G03_NODEFILE
#Run a Gaussian command file, water03.com, redirecting output
#to a file, water03.log
echo "Starting Gaussian run at" `date`
time g03l < $GAUSS_RUNDIR/${jobname}.com >$GAUSS_RUNDIR/${jobname}.log
echo "Finished Gaussian run at" `date`
LJRS_O_WORKDIR=${ORIG_LJRS_O_WORKDIR}
echo $LJRS_O_WORKDIR
mv $GAUSS_RUNDIR/${jobname}.* $LJRS_O_WORKDIR
mv $GAUSS_RUNDIR/*.chk $LJRS_O_WORKDIR
echo "$GAUSS_SCRDIR"
rm -Rf $GAUSS_SCRDIR

posted on 2008-05-06 22:13  cy163  阅读(0)  评论(0编辑  收藏  举报

导航