切换互联网连接后 gethostbyname 失败
gethostbyname fail after switching internet connections
我经常(但不总是)在切换 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 localhost,所以问题不完全是localhost没有解决。
重启总能解决问题,但是我可以对 "reset" 系统做一些简单的事情,让它识别本地主机吗?
我无法访问我 运行 代码中 MPI 初始化例程的详细信息,也没有对 gethostname 进行任何显式调用。
我正在使用 MPICH 3.1.4(2015 年 2 月构建)并且是 运行 OSX 10.10.3
答案很简单 - 这似乎有效。
我编辑了文件 /etc/hosts
(或 /private/etc/hosts
,在 OSX 中)并添加了行
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
我们的 CI 服务器间歇性地遇到了这个问题。似乎将环境变量 MPICH_INTERFACE_HOSTNAME
设置为 localhost
有所帮助。
我经常(但不总是)在切换 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 localhost,所以问题不完全是localhost没有解决。
重启总能解决问题,但是我可以对 "reset" 系统做一些简单的事情,让它识别本地主机吗?
我无法访问我 运行 代码中 MPI 初始化例程的详细信息,也没有对 gethostname 进行任何显式调用。
我正在使用 MPICH 3.1.4(2015 年 2 月构建)并且是 运行 OSX 10.10.3
答案很简单 - 这似乎有效。
我编辑了文件 /etc/hosts
(或 /private/etc/hosts
,在 OSX 中)并添加了行
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
我们的 CI 服务器间歇性地遇到了这个问题。似乎将环境变量 MPICH_INTERFACE_HOSTNAME
设置为 localhost
有所帮助。