Sbatch中的Sbatch提交脚本是否真的需要SRUN命令来运行预期的命令,还是可以直接运行它们?

发布于 2025-01-25 15:06:57 字数 836 浏览 0 评论 0原文

我正在浏览给定的示例脚本,但它使用SRUN来运行命令。我对此表示怀疑。我可以在我的sbatch提交脚本中直接运行我想要的命令,例如,例如

bash main.sh

python main.py

例如。提交脚本我得到了main_submit_to_slurm.sh

#!/bin/bash
#SBATCH --job-name="example"
#SBATCH --output="example.%j.%N.out"
#SBATCH --partition=x86
#SBATCH --time=1:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=32
#SBATCH --sockets-per-node=1
#SBATCH --cores-per-socket=16
#SBATCH --threads-per-core=2
#SBATCH --mem-per-cpu=4000
#SBATCH --gres=gpu:a100:1
#SBATCH --export=ALL

cd ~

echo STARTING `date`

srun hostname  # does this really need srun?

# which is correct?
# python -u main.py # OPTION 1
# srun python -u main.py  #OPTION 2
``

do we really need to have srun inside an sbatch submission file?

I was going through an example script given but it uses srun to run the command. I am skeptical is that is really needed. Can I just run the command I want directly without srun in my sbatch submission script e.g. just

bash main.sh

or

python main.py

e.g. submission script I was given main_submit_to_slurm.sh:

#!/bin/bash
#SBATCH --job-name="example"
#SBATCH --output="example.%j.%N.out"
#SBATCH --partition=x86
#SBATCH --time=1:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=32
#SBATCH --sockets-per-node=1
#SBATCH --cores-per-socket=16
#SBATCH --threads-per-core=2
#SBATCH --mem-per-cpu=4000
#SBATCH --gres=gpu:a100:1
#SBATCH --export=ALL

cd ~

echo STARTING `date`

srun hostname  # does this really need srun?

# which is correct?
# python -u main.py # OPTION 1
# srun python -u main.py  #OPTION 2
``

do we really need to have srun inside an sbatch submission file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文