[英]SLURM How to start a script once per node
I have a Big Cluster available through SLURM.我有一个可通过 SLURM 获得的大集群。 I want to start my script eg
./calc
on every requested node with a specified amount of cores.我想在每个请求的节点上启动我的脚本,例如
./calc
,并具有指定数量的核心。 So for example on 2 nodes, 16 cores each.例如,在 2 个节点上,每个节点 16 个内核。
I start with sbatch
script我从
sbatch
脚本开始
#SBATCH -N 2
#SBATCH --ntasks-per-node=16
srun -N 1 ./calc 2 &
srun -N 1 ./clac 2 &
wait
It doesn't work as intended though.虽然它没有按预期工作。 I tried many configurations of
--ntask
--nodes
--cpus-per-task
but nothing worked and I'm very lost.我尝试了许多
--ntask
--nodes
--cpus-per-task
配置,但没有任何效果,我很迷茫。
I also don't understand the difference between task and CPUs in SLURM我也不明白 SLURM 中任务和 CPU 之间的区别
In your example, you ask slurm to launch 16 tasks per node, on 2 nodes.在您的示例中,您要求 slurm 在 2 个节点上每个节点启动 16 个任务。 At the end of the job, slurm will probably runs 8x(srun)x2 nodes tasks.
在作业结束时,slurm 可能会运行 8x(srun)x2 个节点任务。
For your needs, you don't need to specify that you want 2 nodes specifically instead of the jobs have to run on 2 two different nodes.根据您的需要,您无需专门指定要 2 个节点,而不是作业必须在 2 个两个不同的节点上运行。 For your example, run the following sbatch:
对于您的示例,运行以下 sbatch:
#!/bin/bash
#SBATCH --ntasks=2
#SBATCH --cpus-per-task=16
#SBATCH --hint=nomultithread
srun <my program>
In this example, slurm will run 2 times the program with 16 cores.在这个例子中,slurm 将运行 2 次 16 核的程序。 The nomultithread is optional and depends the cluster configuration.
nomultithread 是可选的,取决于集群配置。 If the hyper-threading is activated, this will be 16 virtual cpus.
如果超线程被激活,这将是 16 个虚拟 CPU。
I found this to be a working solution.我发现这是一个可行的解决方案。 It turned out the most important thing was to define all parameters
nodes
tasks
cpus
原来最重要的是定义所有参数
nodes
tasks
cpus
#!/bin/bash
#SBATCH -N 2
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=16
srun -N 1 -n 1 -c 16 ./calc 2 &
srun -N 1 -n 1 -c 16 ./calc 2 &
wait
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.