【问题标题】:Capture a sbatch file output捕获 sbatch 文件输出
【发布时间】:2016-09-08 22:23:11
【问题描述】:

我希望能够在 bash 文件中运行命令并将其保存在 somefile.txt 中

我正在按以下方式运行我的脚本:

  • sbatch file.sh 在这个文件中我有一个终端命令

【问题讨论】:

    标签: bash terminal output sbatch


    【解决方案1】:

    目标:使用 sbatch 启动作业时捕获特定终端命令的输出

    目前的工作解决方案:

    1. 创建一个执行您要执行的任务的 python 函数
    2. 调用 bash 文件中的函数
    3. 生成输出文件

    例子:

    #!/bin/bash
    
    #SBATCH --job-name application1
    #SBATCH --partition=TSA
    #SBATCH --nodelist=node52
    
    module load openmpi/1.10.2/gcc/4.9.3
    
    mpirun  -np 1  NASA.IS
    
    # I have placed the python call at the end because I want to capture 
    # the time it took for the application to run and save it to a file
    # I was able to code everything inside the python file and generate the
    # corresponding data
    
    python outputCollector.py
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-13
      • 2013-03-28
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 2018-07-07
      • 1970-01-01
      相关资源
      最近更新 更多