slurm似乎发起了比要求更多的任务

时间:2015-01-13 14:21:03

标签: parallel-processing slurm sbatch

我无法理解SLURM从sbatch脚本启动作业的方式。似乎SLURM忽略了--ntasks参数并立即启动了我的批处理文件中的所有srun任务。下面是一个示例,在StackOverflow上使用this answer的代码稍作修改:

$ salloc --ntasks=1 --ntasks-per-core=1
salloc: Granted job allocation 1172
$ srun -n 1 sleep 10 & time srun -n 1 echo ok
[1] 5023
srun: cluster configuration lacks support for cpu binding
srun: cluster configuration lacks support for cpu binding
ok

real    0m0.052s
user    0m0.004s
sys 0m0.012s

因此,在我的设置中,srun echo命令正在立即运行,而我希望它在srun sleep 10命令完成后运行。

我正在使用SLURM 2.6.5在我的个人工作站上安排和提交具有8个内核的作业,我自己安装了它 - 所以完全有可能配置被堵塞。以下是slurm.conf文件中的一些相关部分:

# SCHEDULING
SchedulerType=sched/backfill
SelectType=select/cons_res
SelectTypeParameters=CR_CPU
# COMPUTE NODES
NodeName=Tom NodeAddr=localhost CPUs=7 RealMemory=28100 State=UNKNOWN
PartitionName=Tom Nodes=Tom Default=YES MaxTime=INFINITE State=UP

以下是运行printenv | grep SLURM

salloc --ntasks=1的输出
SLURM_NODELIST=Tom
SLURM_NODE_ALIASES=(null)
SLURM_MEM_PER_CPU=4100
SLURM_NNODES=1
SLURM_JOBID=1185
SLURM_NTASKS=1
SLURM_TASKS_PER_NODE=1
SLURM_JOB_ID=1185
SLURM_SUBMIT_DIR=/home/tom/
SLURM_NPROCS=1
SLURM_JOB_NODELIST=Tom
SLURM_JOB_CPUS_PER_NODE=1
SLURM_SUBMIT_HOST=Tom
SLURM_JOB_NUM_NODES=1

我很感激任何意见或建议。如果需要更多信息,请告诉我。

感谢阅读,

汤姆

在玩了更多

后更新

我取得了一些进展,但我仍然没有得到我想要的行为。

如果我使用--exclusive我可以echo步骤等待sleep步骤:

salloc --ntasks=1
salloc: Granted job allocation 2387
srun -n 1 --exclusive sleep 10 & time srun -n 1 --exclusive echo ok
[1] 16602
ok
[1]+  Done                    srun -n 1 --exclusive sleep 10

real    0m10.094s
user    0m0.017s
sys 0m0.037s

salloc --ntasks=2
salloc: Granted job allocation 2388
srun -n 1 --exclusive sleep 10 & time srun -n 1 --exclusive echo ok
[1] 16683
ok

real    0m0.067s
user    0m0.005s
sys 0m0.020s

但如果我正在运行一个多步骤的工作,每个步骤需要多个处理器,我仍然不知道如何正确地做到这一点,例如。

salloc --ntasks=6
salloc: Granted job allocation 2389
srun -n 2 --exclusive stress -c 2 &
srun -n 2 --exclusive stress -c 2 &
srun -n 2 --exclusive stress -c 2 &

会给我12个stress个进程,

也是如此
salloc --ntasks=6
salloc: Granted job allocation 2390
srun -n 1 --exclusive stress -c 2 &
srun -n 1 --exclusive stress -c 2 &
srun -n 1 --exclusive stress -c 2 &
srun -n 1 --exclusive stress -c 2 &
srun -n 1 --exclusive stress -c 2 &
srun -n 1 --exclusive stress -c 2 &

那么,如果我希望我的sbatch脚本需要6个处理器并一次启动三个步骤,每个都有2个处理器,我该怎么办?使用srun --exclusive -n 1 -c 2 stress -c 2是否正确?

1 个答案:

答案 0 :(得分:2)

我认为缺少的部分是--exclusive--cpus-per-task参数。我得到了我正在寻找

的行为
salloc --ntasks=6
salloc: Granted job allocation 2457
srun --exclusive --ntasks=1 --cpus-per-task=2 stress -c 2 &
srun --exclusive --ntasks=1 --cpus-per-task=2 stress -c 2 &
srun --exclusive --ntasks=1 --cpus-per-task=2 stress -c 2 &
srun --exclusive --ntasks=1 --cpus-per-task=2 stress -c 2 &

这将启动6个stress进程;第4个stress命令在结束时等待它。

这可能很明显但需要一段时间才能搞清楚!

相关问题