使用不同的运行时参数发送多个qsub作业

时间:2017-03-27 08:24:01

标签: bash cluster-computing qsub

昨晚,我发送了大量具有qsub相同可执行文件但具有不同输入参数的作业。大部分工作都在排队,等待其他工作完成。今天早上,我意识到队列中的所有作业都使用了输入文件的最后一个实例。

解决此问题的标准方法是什么?我应该每个作业有一个输入文件并编译我的代码,以便它读取正确的一个?或者是否有更好/更强大的解决方案?

1 个答案:

答案 0 :(得分:1)

你可以创建一个主PBS脚本,它循环不同的输入参数,并行或顺序执行:

这只会为每个作业(executable)提供不同的输入数字IN,您应该根据需要将其更改为循环输入一个或多个输入参数。

# PBS -l mppwidth=2048

NIN=10 # number of input parameters

for IN in `seq -w 1 $NIN`; do
   cd "sub_job_${IN}"
   executable $IN # runs jobs sequentially (you might have to prefix this with aprun)
done

或并行:

# PBS -l mppwidth=2048
# ^^ these should now be shared among the jobs.

NIN=10 # number of input parameters

for IN in `seq -w 1 $NIN`; do
   cd "sub_job_${IN}"
   executable $IN & # runs the job in the background, you might 
                    # have to prefix this with `aprun -n .. -N ..` or something
                    # so that each job only uses a portion of the total
                    # requested CPUs.
done
wait # wait for all jobs to finish