Openmpi使用Infiniband中” only allow registering part of your physical memory“问题

来源:互联网 发布:php 5.3.2.tar.gz下载 编辑:程序博客网 时间:2024/06/05 03:55

在使用OpenMPI和Infiniband的过程中,出现了以下的错误,相信有些同事也会出现相同的问题,经过研究,解决了该问题,这里把相关的解决方法贴出来和大家分享。问题描述如图:



大概意思是,机器有256GB的内存,但是却只有32GB的内存可以使用。内存使用被限制了,可能会妨碍性能的发挥,也可能crash!

通过它给的链接,发现如下信息:

OpenFabrics network vendors provide Linux kernel module parameters controlling the size of the size of the memory translation table (MTT) used to map virtual addresses to physical address. The size of this table controls the amount of physical memory that can be registered for use with OpenFabrics devices. In general, two parameters are provided to control the size of this table:

  • log_num_mtt (on some older hardware, the parameter may be num_mtt, not log_num_mtt): number of memory translation tables
  • log_mtts_per_seg:

The amount of memory that can be registered is calculated using this formula:

In newer hardware:    max_reg_mem = (2^log_num_mtt) * (2^log_mtts_per_seg) * PAGE_SIZEIn older hardware:     max_reg_mem = num_mtt * (2^log_mtts_per_seg) * PAGE_SIZE


上面的大概意思是,内存的使用有两个参数,一个是log_num_mtt,一个是log_mtts_per_seg;max_reg_mem也就是可以使用的最大内存大小就是通过这两个值算出来的。

PAGE_SIZE,可以这样查询:$:getconf PAGESIZE

当前的log_num_mtt,可以这样查询:$:cat /sys/module/mlx4_core/parameters/log_num_mtt
当前的log_mtts_per_seg可以这样查询:$:cat /sys/module/mlx4_core/parameters/log_mtts_per_seg

那如何修改log_num_mtt值然后达到自己的要求呢?可以通过修改/etc/modprobe.d/mlx4_en.conf文件,在末尾添加如下语句

options mlx4_core log_num_mtt=23

值的大小通过自己的需要而定,我们这里有256GB的内存,所以是2^23*2^3*4KB=256GB

然后重启openibd服务就可以了,有opensmd服务开启的要先关闭opensmd服务再重启哦!

然后就可以发现cat /sys/module/mlx4_core/parameters/log_num_mtt 值变成23了,运行程序也正常了。



原创粉丝点击