考虑第一个 script_0.sh
:
# script_0.sh
foo
bar
baz
我可以像这样通过 LSF 运行这个脚本,例如:
bsub -q myqueue -J myjob_0 -o path/to/log_0.out -e path/to/log_0.err -- /bin/sh ./script_0.sh
现在考虑第二个非常相似的脚本:
# script_1.sh
#BSUB -q myqueue
#BSUB -J myjob_1
#BSUB -o path/to/log_1.out
#BSUB -e path/to/log_1.err
foo
bar
baz
我也可以通过 LSF 运行这个脚本,如上所示(之后适当地更改命令行选项),但是,此外,我可以这样做:
bsub < script_1.sh
在第二种形式中,bsub
通过解析以 #BSUB 开头的行
。
据我了解,如果我们排除注释和空行,上述所有形式都需要运行完全相同的命令(foo
等),因为这两个脚本是相同的。
与第一种形式相比,第二种形式的优点/缺点是什么?特别是,这两种形式是否可以实现另一种形式难以或不可能实现的作业调度策略?
Consider first script_0.sh
:
# script_0.sh
foo
bar
baz
I can run this script via LSF like this, for example:
bsub -q myqueue -J myjob_0 -o path/to/log_0.out -e path/to/log_0.err -- /bin/sh ./script_0.sh
Now consider a second, very similar script:
# script_1.sh
#BSUB -q myqueue
#BSUB -J myjob_1
#BSUB -o path/to/log_1.out
#BSUB -e path/to/log_1.err
foo
bar
baz
I can also run this script, via LSF, as shown above (after changing the command-line options appropriately), but, in addition, I can do it like this:
bsub < script_1.sh
In this second form, bsub
figures out the options to use by parsing the lines beginning with #BSUB
.
As far as I understand, all the forms described above would entail running exactly the same commands (foo
, etc.), since the two scripts are identical, if we exclude comments and blank lines.
What are the pros/cons of this second form vis-à-vis the first form? In particular, does either form make possible job scheduling strategies that are difficult or impossible to implement with the other form?
发布评论