一个MPI程序,出现这样的错误,仔细看看后续的提示行,是否出现如下的错误:gethostbyname failed
出现这种错误的原因是hosts文件中没有列入当前主机的hostname先看看主机的hostname是什么,用uname -a查看,比如我的是Linux scdzj 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux则第二个字段scdzj是hostname打开/etc/hosts文件,在127.0.0.1的后面加上hostname,保存退出。这个问题即可解决。
stackoverflow. com/questions/23112515/mpich2-gethostbyname-failed