计算化学公社

 找回密码 Forget password
 注册 Register
Views: 1395|回复 Reply: 3
打印 Print 上一主题 Last thread 下一主题 Next thread

[任务提交/队列管理] 求助:LSF提交任务脚本使用变量作为Jobname提交

[复制链接 Copy URL]

9

帖子

0

威望

416

eV
积分
425

Level 3 能力者

跳转到指定楼层 Go to specific reply
楼主
本帖最后由 伞阳 于 2022-8-27 18:45 编辑

这是一般的LSF脚本:
  1. #!/bin/bash
  2. #BSUB -J myjobname          ##任务名称
  3. #BSUB -q bladeQ
  4. #BSUB -n 28
  5. #BSUB -o out%J.txt            ##标准输出stdout
  6. #BSUB -e error%J.txt          ##标准错误stderr
  7. #BSUB -R "span[hosts=1]"
  8. ...
复制代码

我希望stdout和stderr两个文件名和任务名称一致,而不是使用%J(作业编号)标记该输出:out1444.txt, error1444.txt。希望这两个文件跟随我的任务文件名,比如myjobname_out1444.txt/myjobname_error1444.txt。我查了手册,只查到%T,%X,%I,但都不是我想要的任务名称,好像有环境变量是$LSB_JOBNAME(不确定)。

我的想法是提交任务前定义一个变量Jobname=myjobname,然后在后面使用,像这样:
  1. #!/bin/bash
  2. Jobname=myjobname

  3. #BSUB -J $Jobname                            ##任务名称
  4. #BSUB -q bladeQ
  5. #BSUB -n 28
  6. #BSUB -o $Jobname_out%J.txt            ##标准输出stdout
  7. #BSUB -e $Jobname_error%J.txt          ##标准错误stderr
  8. #BSUB -R "span[hosts=1]"
  9. ...
复制代码

但是#BSUB又是注释行,这样是不能调用的,请问有什么办法可以解决呢?或者有类似%J能调用任务名称的我忽略了,或者有其他办法吗?
谢谢解答!


2407

帖子

1

威望

5950

eV
积分
8377

Level 6 (一方通行)

2#
发表于 Post on 2022-8-27 17:32:26 | 只看该作者 Only view this author
Set a label in your script first.

For loop
For each job
Replace the label to create your script for the job
Submit the script.
If you like, delete the scripts after submit.
Done

High-Performance Computing for You
为您专属定制的高性能计算解决方案

更多讯息,请访问:
https://labitc.top
http://tophpc.top:8080
电邮: ask@hpc4you.top

9

帖子

0

威望

416

eV
积分
425

Level 3 能力者

3#
 楼主 Author| 发表于 Post on 2022-8-27 18:31:35 | 只看该作者 Only view this author
abin 发表于 2022-8-27 17:32
Set a label in your script first.

For loop

呃,我没看明白,这怎么还搞起英文了?

2407

帖子

1

威望

5950

eV
积分
8377

Level 6 (一方通行)

4#
发表于 Post on 2022-8-27 19:20:02 | 只看该作者 Only view this author
伞阳 发表于 2022-8-27 18:31
呃,我没看明白,这怎么还搞起英文了?

It is easy to type.

Pls check out this link 【Run g09 | 直接运行g09-哔哩哔哩】 https://b23.tv/PqhrKcP

You can create a demo script,
use sed to replace the target
or use $1 to transfer the input file name.

High-Performance Computing for You
为您专属定制的高性能计算解决方案

更多讯息,请访问:
https://labitc.top
http://tophpc.top:8080
电邮: ask@hpc4you.top

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-14 06:49 , Processed in 0.140023 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list