Pass command line arguments via sbatch

后端 未结 6 1118
我寻月下人不归
我寻月下人不归 2021-01-31 02:44

Suppose that I have the following simple bash script which I want to submit to a batch server through SLURM:

#!/bin/bash

#SBATCH -o \"outFile\"$1\".txt\"
#SBATC         


        
6条回答
  •  再見小時候
    2021-01-31 03:11

    I thought I'd offer some insight because I was also looking for the replacement to the -v option in qsub, which for sbatch can be accomplished using the --export option. I found a nice site here that shows a list of conversions from Torque to Slurm, and it made the transition much smoother.

    You can specify the environment variable ahead of time in your bash script:

    $ var_name='1'
    $ sbatch -D `pwd` exampleJob.sh --export=var_name
    

    Or define it directly within the sbatch command just like qsub allowed:

    $ sbatch -D `pwd` exampleJob.sh --export=var_name='1'
    

    Whether this works in the # preprocessors of exampleJob.sh is also another question, but I assume that it should give the same functionality found in Torque.

提交回复
热议问题