Pass command line arguments via sbatch

后端 未结 6 1130
我寻月下人不归
我寻月下人不归 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:09

    Using a wrapper is more convenient. I found this solution from this thread.

    Basically the problem is that the SBATCH directives are seen as comments by the shell and therefore you can't use the passed arguments in them. Instead you can use a here document to feed in your bash script after the arguments are set accordingly.

    In case of your question you can substitute the shell script file with this:

    #!/bin/bash
    sbatch <

    And you run the shell script like this:

    bash [script_name].sh [suffix]
    

    And the outputs will be saved to outFile[suffix].txt and errFile[suffix].txt

提交回复
热议问题