RDMA开发中,需要注册Memory Rigon,需要比较大的内存区域,如果不把Ubuntu20.04系统默认的max locked memory从默认的65536改为unlimited,将会报出这个错误:Couldn't allocate MR
解决办法如下(感谢chatGPT老师哈哈)
To set the maximum locked memory from 65536 to unlimited on Ubuntu 20.04, you can follow these steps:
1.Open a terminal window by pressing Ctrl + Alt + T or by searching for "Terminal" in the application launcher.
2.Edit the /etc/security/limits.conf file using a text editor such as nano or vi. For example, run the following command to open the file with nano:
sudo nano /etc/security/limits.conf
3.Scroll down to the end of the file and add the following lines:
-
hard memlock unlimited
-
soft memlock unlimited
These lines will set the maximum locked memory (memlock) to unlimited for all users (*).
4.Save the changes in nano by pressing Ctrl + O, then press Enter to confirm the filename. Exit nano by pressing Ctrl + X.
5.Next, edit the /etc/systemd/user.conf.d/override.conf file by running the following command:
sudo nano /etc/systemd/user.conf.d/override.conf
6.Add the following line to the file:
DefaultLimitMEMLOCK=infinity
This line sets the default memory lock limit to infinity.
7.Save the changes and exit nano as mentioned in step 4.
8.Finally, restart your system or log out and log back in for the changes to take effect.
After completing these steps, the maximum locked memory should be set to unlimited (infinity) for all users on your Ubuntu 20.04 system.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」