在切换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/