Sbatch: pass job name as input argument

后端 未结 1 1265
灰色年华
灰色年华 2021-02-14 19:07

I have the following script to submit job with slurm:

#!/bin/sh
#!/bin/bash
#SBATCH -J $3 #job_name 
#SBATCH -n 1 #Number of processors
#SBATCH -p CA 

nwchem $1         


        
1条回答
  •  渐次进展
    2021-02-14 19:30

    The SBATCH directives are seen as comments by the shell and it does not perform variable substitution on $3. There are several courses of action:

    Option 1: pass the -J argument on the command line:

    sbatch -J thejobname submission_script.sh input.data output.res
    

    Option 2: pass the script through stdin replacing the position arguments ($1, $2, etc. by named ones)

    IN=input.data OUT=output.res NAME=thejobname 

    Option 3: write a wrapper

    #!/bin/bash
    sbatch < $2
    EOT
    

    and use it like this:

    submit.sh input.data output.red thejobname
    

    Also note that the second shebang (#!/bin/bash) is useless and ignored by the (parent) shell.

    0 讨论(0)
提交回复
热议问题