openmpi跨节点报错tcp_peer_send_blocking: send() to socket 9 failed: Broken pipe (32)

本文介绍了一个关于OpenMPI跨节点运行时遇到的问题及解决方案。客户反馈在使用mpirun命令进行跨节点作业时出现了错误,通过添加特定参数来诊断连接问题,并给出了可能的原因及其对应的解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

客户反应作业无法跨节点,运行测试命令如下

mpirun -np 8 -hostfile hostfilt.txt sleep 5
运行后报错如下:

[test02:01719] [[24772,0],1] tcp_peer_send_blocking: send() to socket 9 failed: Broken pipe (32)
--------------------------------------------------------------------------
ORTE was unable to reliably start one or more daemons.
This usually is caused by:

* not finding the required libraries and/or binaries on
  one or more nodes. Please check your PATH and LD_LIBRARY_PATH
  settings, or configure OMPI with --enable-orterun-prefix-by-default

* lack of authority to execute on one or more specified nodes.
  Please verify your allocation and authorities.

* the inability to write startup files into /tmp (--tmpdir/orte_tmpdir_base).
  Please check with your sys admin to determine the correct location to use.

*  compilation of the orted with dynamic libraries when static are required
  (e.g., on Cray). Please check your configure cmd line and consider using
  one of the contrib/platform definitions for your system type.

* an inability to create a connection back to mpirun due to a
  lack of common network interfaces and/or no route found between
  them. Please check network connectivity (including firewalls
  and network routing requirements).
-------------------------------------------------------------------------- 
网上查到的解决方法:

I had this same problem on Cygwin with OpenMPI 1.10.4.

Try adding "-report-uri -" to your mpirun command to see what IP address it's trying to use for connection:

mpirun -report-uri - -np 2 a.exe
It should print out a line that looks something like this:

568328192.0;tcp://192.168.10.103,169.254.247.11,0.0.0.0,0.0.0.0,0.0.0.0:55600
If the first IP address after the "tcp://" is not a current valid address for your machine, that's the problem and things are likely to break (even if the correct IP appears later in the list). Apparently ORTE is not smart enough to order the interfaces based on what is actually enabled and online.

If the wrong IP corresponds to an old/disabled interface, uninstall it (if possible)

Reference: https://stackoverflow.com/questions/34032655/cygwin-error-tcp-peer-send-blocking-send-to-socket

<think>好的,我现在要帮用户解决这个链接错误的问题。首先,用户遇到的错误信息是:“undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32&#39;”,这通常和GLIBCXX版本有关。我需要回忆一下这类错误的常见原因和解决办法。 首先,这个错误是在链接阶段发生的,提示找不到GLIBCXX_3.4.32中的某个符号。可能的情况是,编译时使用的libstdc++版本较新,而运行时的库版本较旧,导致链接器找不到对应的符号。或者可能是不同库之间使用了不兼容的libstdc++版本。 接下来,我需要指导用户检查系统中安装的libstdc++版本。常用的命令是`strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX`,这样可以列出系统当前支持的GLIBCXX版本。如果结果中没有3.4.32,说明系统安装的库版本过低,需要升级。 然后,用户可能需要更新GCC或者安装更新的libstdc++6包。不同的Linux发行版有不同的包管理命令,比如Ubuntu可以使用apt,CentOS用yum等。这时候需要考虑用户的具体系统,可能需要用户提供系统版本信息,或者给出通用的建议。 另外,用户提到错误发生在链接openmpi的libmpi_cxx.so时,这可能意味着MPI库是用新版本的GCC编译的,而用户当前使用的编译器版本较旧。需要检查MPI库的依赖情况,可能需要重新安装与当前GCC版本兼容的MPI库,或者升级GCC以匹配MPI库的要求。 还有一种可能是用户的项目在编译时使用了不同的C++标准库,比如静态链接和动态链接混用,或者指定了错误的库路径。需要检查编译命令,确保链接的库路径正确,并且所有依赖库都使用相同版本的libstdc++。 另外,如果用户自己编译了GCC,可能需要将新安装的libstdc++.so路径添加到LD_LIBRARY_PATH中,或者运行ldconfig更新库缓存。这时候需要提醒用户注意环境变量的设置,避免运行时出现同样的问题。 总结可能的解决步骤:检查libstdc++版本;升级GCC或libstdc++;检查并重新安装MPI库;确保所有库使用一致的版本;设置正确的库路径和环境变量。 在回复用户时,需要分步骤说明,语言尽量清晰,避免使用过于专业的术语,同时给出具体的命令示例,方便用户操作。另外,提醒用户在操作前备份重要数据,防止升级过程中出现意外问题。</think>这个错误信息表明在链接阶段,编译器无法找到 `GLIBCXX_3.4.32` 版本中的 `std::ios_base_library_init()` 符号。这通常是因为你的系统使用的 **C++ 标准库(libstdc++)版本过低**,而编译时依赖的库(如 OpenMPI)需要更高版本的库支持。 --- ### **原因分析** 1. **符号缺失** `std::ios_base_library_init()` 是 C++ 标准库中的一个函数,其符号 `GLIBCXX_3.4.32` 对应较新的 `libstdc++.so` 版本(例如 GCC 12 或更高版本)。你的系统中可能安装了旧版本的 GCC 或 `libstdc++`,导致链接失败。 2. **依赖冲突** OpenMPI 的 `libmpi_cxx.so` 可能是用新版本的 GCC 编译的,而你的项目可能使用了旧版本的 GCC 或链接了旧版本的 `libstdc++`。 --- ### **解决方法** #### 1. **检查当前 `libstdc++` 支持的版本** 运行以下命令,查看系统中已安装的 `libstdc++.so` 支持的符号版本: ```bash strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX ``` 如果输出结果中没有 `GLIBCXX_3.4.32`,说明需要升级 `libstdc++`。 #### 2. **升级 GCC 和 libstdc++** - **Ubuntu/Debian**: ```bash sudo apt update sudo apt install gcc-12 g++-12 libstdc++6 ``` - **CentOS/RHEL**: ```bash sudo yum install devtoolset-12 scl enable devtoolset-12 bash ``` - **手动编译安装 GCC**(若包管理器无新版本): 下载并编译 [GCC 12](https://gcc.gnu.org/),安装后确保更新库路径: ```bash export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH ``` #### 3. **检查 OpenMPI 的编译环境** 确认 OpenMPI 是否与当前 GCC 版本兼容: ```bash mpicxx --version # 查看 OpenMPI 使用的编译器 ``` 如果 OpenMPI 是用新版本 GCC 编译的,而你的项目使用旧版本 GCC,需要重新安装与当前 GCC 匹配的 OpenMPI。 #### 4. **强制链接新版本的 libstdc++** 在编译命令中显式指定新版本的 `libstdc++` 路径(例如 GCC 12 的库): ```bash g++ your_program.cpp -o output -L/usr/local/lib64 -lstdc++ ``` #### 5. **更新动态库缓存** 升级后运行以下命令,确保系统找到新库: ```bash sudo ldconfig ``` --- ### **注意事项** - 如果系统中有多个 GCC 版本,使用 `update-alternatives` 管理默认编译器。 - 谨慎升级生产环境的库,建议在开发环境中验证兼容性。 如果问题仍存在,请提供以下信息进一步排查: ```bash g++ --version # 编译器版本 ldd --version # 链接器版本 mpicxx --version # MPI 编译器信息 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值