使用 Slurm 时是否可以在调试模式 (bash -x) 下启动 bash 脚本?
Is it possible to start a bash script in debug mode (bash -x) when using Slurm?
当 运行在本地机器上运行 bash 脚本时,可以在调试模式下使用 bash -x script.sh
到 运行 它。
是否可以使用 sbatch script.sh
指定参数以便 运行 脚本在集群上处于调试模式?
我在 sbatch 的手册页中找不到这种调试模式的提示。
根据用户 Poshi 的建议,我在脚本的开头添加了选项 set -x
,现在 bash 脚本处于调试模式 运行。
#!/bin/bash
set -x
#SBATCH --nodes=1
#SBATCH --ntasks-per-node 1
#SBATCH --mem=1GB
#SBATCH --partition normal
#SBATCH --time=00:01:00
#SBATCH --mail-type=FAIL,TIME_LIMIT
HELLO="hello there"
echo $HELLO
slurm 输出文件现在看起来像这样:
cat *out
+ HELLO='hello there'
+ echo hello there
hello there
当 运行在本地机器上运行 bash 脚本时,可以在调试模式下使用 bash -x script.sh
到 运行 它。
是否可以使用 sbatch script.sh
指定参数以便 运行 脚本在集群上处于调试模式?
我在 sbatch 的手册页中找不到这种调试模式的提示。
根据用户 Poshi 的建议,我在脚本的开头添加了选项 set -x
,现在 bash 脚本处于调试模式 运行。
#!/bin/bash
set -x
#SBATCH --nodes=1
#SBATCH --ntasks-per-node 1
#SBATCH --mem=1GB
#SBATCH --partition normal
#SBATCH --time=00:01:00
#SBATCH --mail-type=FAIL,TIME_LIMIT
HELLO="hello there"
echo $HELLO
slurm 输出文件现在看起来像这样:
cat *out
+ HELLO='hello there'
+ echo hello there
hello there