我们有一个4*64核的小型高性能计算机,它安装了SLURM。在
节点包括:
sinfo -N -l
Mon Oct 3 08:58:12 2016
NODELIST NODES PARTITION STATE CPUS S:C:T MEMORY TMP_DISK WEIGHT FEATURES REASON
dlab-node1 1 dlab* idle 64 2:16:2 257847 0 1 (null) none
dlab-node2 1 dlab* idle 64 2:16:2 257847 0 1 (null) none
dlab-node3 1 dlab* idle 64 2:16:2 257847 0 1 (null) none
dlab-node4 1 dlab* idle 64 2:16:2 257847 0 1 (null) none
为了测试SLURM,我用python编写了一个带有多处理功能的小脚本:
^{pr2}$我使用下面的批处理sh
脚本来运行SLURM
#!/bin/bash
#
#SBATCH -p dlab # partition (queue)
#SBATCH -N 2 # number of nodes
#SBATCH -n 64 # number of cores
#SBATCH --mem 250 # memory pool for all cores
#SBATCH -t 0-2:00 # time (D-HH:MM)
#SBATCH -o slurm.%N.%j.out # STDOUT
#SBATCH -e slurm.%N.%j.err # STDERR
python3 asd.py
正如我预期的那样,这将打印128
256
次到STDOUT文件。在
但是,如果我多次运行这个程序,我得到的行数是非常不同的(它们都包含128
,这是正确的)
第一次我得到了144行,第二次我得到了256行(这是正确的),第三次我得到了184行。在
有什么问题吗?我是应该调查SLURM配置中的某些内容,还是python multiprocessing
中有什么问题?在
从sbatch手册页:
正如突出显示的那样,变量将只返回在运行脚本的节点中分配的cpu数量。如果您想要一个同构的分配,您应该指定
ntasks-per-node=32
另外,请记住,多处理不会在多个节点中生成进程。如果你想跨越多个节点,你有一个很好的文档here
相关问题 更多 >
编程相关推荐