macos - 切换互联网连接后,gethostbyname失败

标签 macos mpi osx-yosemite

在切换wifi主机后运行MPI作业时,我经常(但并非总是)收到以下错误消息。

Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(498)..............: 
MPID_Init(187).....................: channel initialization failed
MPIDI_CH3_Init(89).................: 
MPID_nem_init(320).................: 
MPID_nem_tcp_init(171).............: 
MPID_nem_tcp_get_business_card(418): 
MPID_nem_tcp_init(377).............: gethostbyname failed, MacBook-Pro.local     (errno 1)

在咖啡店里一切正常,然后当我回家时,出现上述错误。没有其他改变。

我已经检查了/etc/hosts和/private/etc/hosts文件,它们看起来还不错-
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost

我可以ping本地主机,所以问题不完全是本地主机没有解决。

重新启动总是可以解决问题,但是我可以做些简单的事情来“重置”系统,使其识别本地主机吗?

我无法访问正在运行的代码中的MPI初始化例程的详细信息,也没有对gethostname进行任何显式调用。

我正在使用MPICH 3.1.4(内置于2015年2月),并且正在运行OSX 10.10.3

最佳答案

答案很简单-这似乎是可行的。

我编辑了文件/etc/hosts(或OSX中的/private/etc/hosts),并添加了这一行

127.0.0.1   macbook-pro.local

所以现在我的主机文件看起来像:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
127.0.0.1   macbook-pro.local

关于macos - 切换互联网连接后,gethostbyname失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31057694/

相关文章:

graph - 邻里集体-减量经营

Mamp mysql 服务器无法在 Yosemite ios8 上启动

python - python Python : where are the virtual environments stored?

objective-c - 无法通过事件点击在某些应用程序上模拟退格按钮

macos - 如果从主线程外部调用 dispatch_main 会发生什么?

macos - 实现 NSBrowserDelegate 协议(protocol)的问题

linux - 尝试复制输出文件时无限循环路径

mpi - 分解矩阵,以便每个进程使用 MPI 获得矩阵的份额

objective-c - 你如何在 NSWindow 上使用黑暗活力?

linux - 为什么这个 "hello world"golang http 示例在 osx 上变慢