gpt4 book ai didi

bash - 引用 LSF 作业数组中的作业索引

转载 作者:行者123 更新时间:2023-11-29 09:41:12 30 4
gpt4 key购买 nike

我正在尝试将作业数组中的作业索引作为参数传递给另一个 bash 脚本。

numSims=3 
numTreatments=6 # uses numTreatments top rows of parameters.csv
maxFail=10
j=1
while [ $j -le $numSims ];
do
bsub -q someQueue -J "mySim[1-$numTreatments]%2" ./another_script.sh $LSB_JOBINDEX $j $maxFail
let j=j+1
done

这里的最终想法是为每个 1,...,numTreatments,numSims 作业(模拟)提交。我想同时运行两个作业 (%2)。输出的形式为 XX_indexNumber_simNumber,其中 indexNumber 从 1,...,numTreatments 开始,simNumber 从 1,...,numSims 开始。

理想情况下,作为此脚本的一部分提交的所有内容都应具有相同的作业 ID。这还没有正确设置,因为所有具有相同 j 的作业都被分配了一个不同的作业 ID。 我的直接问题是 another_script.sh 没有将 $LSB_JOBINDEX 识别为输入——它将 $j$maxFail 视为输入第一个也是只有两个传递的参数。 当我用一些其他变量代替 $LSB_JOBINDEX 时,没有问题。我做错了什么?


编辑 - 我试过的一些东西:"$LSB_JOBINDEX"${LSB_JOBINDEX}%I,和 I=$LSB_JOBINDEX; bsub ... $I $j $maxFail

最佳答案

来自 this link :

The definition above will launch not just one batch job, but 100 batch jobs where the subjob specific environment variable $LSB_JOBINDEX gets values form 1 to 100. This variable can then be utilized in the actual job launching commands so that each subtask gets processed.

在您的例子中,这意味着变量 $LSB_JOBINDEX 可从脚本 another_script.sh 中获得。您无需将其作为参数传递,只需在脚本中访问 $LSB_JOBINDEX

关于bash - 引用 LSF 作业数组中的作业索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11212923/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com