我怎样才能让 slurm 为每个节点分配一个任务?

How can I get slurm to assign each node a single task?

我 运行 通过带有 sbatch 的 SLURM 管道处理了大约 400 个文件。当我使用 sbatch ./myscript.sh file_x 对任务进行排队时,所有文件都会排队到同一节点。

我在 sbatch 脚本的开头尝试了 #SBATCH 参数的变体,但没有成功。到目前为止,这是我尝试过的方法:

#!/bin/bash
#SBATCH -N 1
#SBATCH -n 60
#SBATCH -o slurm_out/output_%j.txt
#SBATCH -e slurm_error/error_%j.txt

#!/bin/bash
#SBATCH -n 60
#SBATCH -o slurm_out/output_%j.txt
#SBATCH -e slurm_error/error_%j.txt

#!/bin/bash
#SBATCH -N 1
#SBATCH -o slurm_out/output_%j.txt
#SBATCH -e slurm_error/error_%j.txt

#!/bin/bash
#SBATCH -o slurm_out/output_%j.txt
#SBATCH -e slurm_error/error_%j.txt

正在创建和写入 slurm_out 文件,因此 SBATCH 肯定会获取参数。

关于 -n 选项,文档说默认值为 "one task per node" 但是,情况似乎并非如此:

-n, --ntasks= sbatch does not launch tasks, it requests an allocation of resources and submits a batch script. This option advises the Slurm controller that job steps run within the allocation will launch a maximum of number tasks and to provide for sufficient resources. The default is one task per node, but note that the --cpus-per-task option will change this default.

哪些参数将获得每个节点的单个任务?

您可以简单地尝试 --ntasks-per-node=1。当节点数未指定任务数时,默认值 "one task per node" 适用。在这种情况下,Slurm 将假设它必须生成与请求的节点数一样多的任务。这仍然并不意味着每个任务都会分配一个不同的节点,这取决于您如何在提交脚本中开始计算。

如果您在节点上除了您自己的作业之外不需要其他作业,请添加 --exclusive 参数。