提交LSF任务 控制最大数量

集群管理 0 2846 毛桃 收藏

为了避免批量任务堵塞LSF集群,可以使用以下方法来控制每次提交的任务数量:

手动控制并发任务数: 在脚本中,可以使用循环来提交每个任务,并在每次循环中检查当前运行的任务数。

例如,可以使用jobs命令来检查当前运行的作业数,并在并发任务数达到一定阈值时等待一段时间。


以下是一个示例:

#!/bin/tcsh
 
# define variables
set VCS_HOME=/path/to/vcs/installation/directory
set DESIGN_DIR=/path/to/design/directory
set TEST_DIR=/path/to/test/directory
set LSF_LOG_DIR=/path/to/lsf/log/directory
set MAX_JOBS=10
 
# create simulation directory
mkdir sim_dir
cd sim_dir
 
# copy design files
cp $DESIGN_DIR/*.v .
cp $DESIGN_DIR/*.sv .
cp $DESIGN_DIR/*.h .
 
# compile design files
$VCS_HOME/bin/vlogan +define+SIMULATION -sverilog *.v *.sv
 
# compile testbench files
$VCS_HOME/bin/vlogan -sverilog -f $TEST_DIR/tb.f
 
# submit simulation jobs to LSF
foreach testcase ( $TEST_DIR/*.sh )
  # wait until the number of running jobs is less than MAX_JOBS
  while ( `jobs | wc -l` >= $MAX_JOBS )
    sleep 1s
  end
  # submit the job
  bsub -o $LSF_LOG_DIR/%J.log -J sim_$testcase $testcase &
end
 
# wait for all jobs to complete
wait


相关推荐:

网友留言:

您需要 登录账户 后才能发表评论

我要评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
验证码