计算化学公社

标题: 请问slurm作业系统能否内建批处理循环呢? [打印本页]

作者
Author:
sun35mr    时间: 2023-1-6 20:27
标题: 请问slurm作业系统能否内建批处理循环呢?
请问slurm作业系统能否内建批处理循环呢?我写的脚本是这样的,本想一次运行文件夹下的所有 .gjf文件,但是报错,说识别不了 *.gjf。请问是哪里写错了呢?谢谢大家

#!/bin/bash
#SBATCH -J GaussianTest
#SBATCH -p batch
#SBATCH -o log.out
#SBATCH -e log.err
#SBATCH -t 5:00:00
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -c 28

export g16root=/home/sunh/Soft
export GAUSS_SCRDIR=$g16root/g16/tmp
. $g16root/g16/bsd/g16.profile
export PATH=$PATH:$g16root/g16

cd $PBS_O_WORKDIR
for i in *.gjf
do g16 $i
done

作者
Author:
monk1077    时间: 2023-1-6 20:36
语法错误
作者
Author:
sun35mr    时间: 2023-1-6 20:37
monk1077 发表于 2023-1-6 20:36
语法错误

请问是哪里出错了呢?谢谢了
作者
Author:
monk1077    时间: 2023-1-6 20:39
for循环问题呀
作者
Author:
sun35mr    时间: 2023-1-6 20:44
monk1077 发表于 2023-1-6 20:39
for循环问题呀

这个循环我在shell下运行倒是没问题,确实不太了解shell和脚本里面的运行原理,请问您知道正确该怎么写吗?
作者
Author:
bluewhale    时间: 2023-1-6 20:52
The SLURM "--array" option allows many copies of the same script to be queued all at once.
You can use the $SLURM_ARRAY_TASK_ID to differenciate between the different jobs in the array.
作者
Author:
sun35mr    时间: 2023-1-6 21:20
解决了,$PBS_O_WORKDIR是TORQUE的命令,换成slurm的$SLURM_SUBMIT_DIR就可以了
下面是完整的脚本

#!/bin/bash
#SBATCH -J GaussianTest
#SBATCH -p batch
#SBATCH -o log.out
#SBATCH -e log.err
#SBATCH -t 5:00:00
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -c 28

export g16root=/home/sunh/Soft
export GAUSS_SCRDIR=$g16root/g16/tmp
. $g16root/g16/bsd/g16.profile
export PATH=$PATH:$g16root/g16

cd $SLURM_SUBMIT_DIR
for i in *.gjf
do g16 $i
done





欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3