Setting SGE for running an executable with different input files on different nodes

北慕城南 提交于 2019-12-11 09:33:08

问题


I used to work with a cluster using SLURM scheduler, but now I am more or less forced to switch to a SGE-based cluster, and I'm trying to get a hang of it. The thing I was working on SLURM system involves running an executable using N input files, and set a SLURM configuration file in this fashion,

slurmConf.conf SLURM configuration file
    0   /path/to/exec /path/to/input1
    1   /path/to/exec /path/to/input2
    2   /path/to/exec /path/to/input3
    3   /path/to/exec /path/to/input4
    4   /path/to/exec /path/to/input5
    5   /path/to/exec /path/to/input6
    6   /path/to/exec /path/to/input7
    7   /path/to/exec /path/to/input8
    8   /path/to/exec /path/to/input9
    9   /path/to/exec /path/to/input10

And my working submission script in SLURM contains this line;

srun -n $SLURM_NNODES --multi-prog $slconf
$slconf refers to a path to that configuration file

This setup worked as I wanted - to run the executable with 10 different inputs at the same time with 10 nodes. Now that I just transitioned to SGE system, I want to do the same thing but I tried to read the manual and found nothing quite like SLURM. Could you please give me some light on how to achieve the same thing on SGE system?

Thank you very much!


回答1:


You could use the "job array" feature of the Grid Engine.

Create a shell script sge_job.sh

#!/bin/sh
#
# sge_job.sh -- SGE job description script
#
#$ -t 1-10
/path/to/exec /path/to/input$SGE_TASK_ID

And submit this script to SGE with qsub.

qsub sge_job.sh



回答2:


Dmitri Chubarov's answer is excellent, and the most robust way to proceed as it places less load on the submit node when submitting many jobs (>1000). Alternatively, you can wrap qsub in a for loop:

for i in {1..10}
do
    echo "/path/to/exec /path/to/input${i}" | qsub
done

I sometimes use the above when whatever varies as input is not easily captured as a range of integers.

Example:

for f in `ls /some/path/input*`
do
    echo "/path/to/exec ${f}" | qsub
done


来源:https://stackoverflow.com/questions/28200302/setting-sge-for-running-an-executable-with-different-input-files-on-different-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!