如何对 linux 中具有特定(范围)模式的所有文件执行作业提交脚本
How to execute a job-submitting script for all the files with a specific (range of) pattern in linux
我正在超级计算服务器上的 CentOS 7.7 上做一些计算。假设我有一个包含以下文件的文件夹 "tmp_folder":
input1.traj, input2.traj, input3.traj, ..., input_5000.traj, random1.traj, random2.traj, ..., random1000.traj
现在我想为文件名从 "input_78" 到 "input_151" 的 74 个文件执行 SLURM 作业提交脚本。提交单个作业(78)的脚本如下:
module load GPAW
gpaw sbatch -- --job-name=job_78 -e error_78.err -o output_78.out -n 16 -N 1 -p xeon16 -t 80:00:00 --mail-type=END,FAIL --mail-user=xxxxx@xxx.xx calc.py tmp_folder//input78.traj
其中 GPAW 只是一个用于计算的计算工具,"calc.py" 是用于 运行 计算的主要 Python 脚本,"inputxx.traj" 文件是输入轨迹文件。
我如何为那些特定的 74 个文件执行此脚本?如果有人不知道 SLURM 是什么也没关系。基本上我想做的就是不断修改作业提交脚本,将“78"s with "79”、“80”等替换为“151”。值得注意的是,我不想弄乱脚本的其他部分,例如 walltime 和节点数。如果可能的话,我更希望使用 Python 脚本来解决问题,但欢迎提出任何建议。
下面是一些简单的bash,在for循环中使用从78到151的序列
for i in {78..151}
do
module load GPAW
gpaw sbatch -- --job-name=job_$i -e error_$i.err -o output_$i.out -n 16 -N 1 -p xeon16 -t 80:00:00 --mail-type=END,FAIL --mail-user=xxxxx@xxx.xx calc.py tmp_folder//input$i.traj
done
我正在超级计算服务器上的 CentOS 7.7 上做一些计算。假设我有一个包含以下文件的文件夹 "tmp_folder":
input1.traj, input2.traj, input3.traj, ..., input_5000.traj, random1.traj, random2.traj, ..., random1000.traj
现在我想为文件名从 "input_78" 到 "input_151" 的 74 个文件执行 SLURM 作业提交脚本。提交单个作业(78)的脚本如下:
module load GPAW
gpaw sbatch -- --job-name=job_78 -e error_78.err -o output_78.out -n 16 -N 1 -p xeon16 -t 80:00:00 --mail-type=END,FAIL --mail-user=xxxxx@xxx.xx calc.py tmp_folder//input78.traj
其中 GPAW 只是一个用于计算的计算工具,"calc.py" 是用于 运行 计算的主要 Python 脚本,"inputxx.traj" 文件是输入轨迹文件。
我如何为那些特定的 74 个文件执行此脚本?如果有人不知道 SLURM 是什么也没关系。基本上我想做的就是不断修改作业提交脚本,将“78"s with "79”、“80”等替换为“151”。值得注意的是,我不想弄乱脚本的其他部分,例如 walltime 和节点数。如果可能的话,我更希望使用 Python 脚本来解决问题,但欢迎提出任何建议。
下面是一些简单的bash,在for循环中使用从78到151的序列
for i in {78..151}
do
module load GPAW
gpaw sbatch -- --job-name=job_$i -e error_$i.err -o output_$i.out -n 16 -N 1 -p xeon16 -t 80:00:00 --mail-type=END,FAIL --mail-user=xxxxx@xxx.xx calc.py tmp_folder//input$i.traj
done