Hi all,

I have installed MPICH2 in a Mac 10.9.2 using homebrew. The installation process went OK, no problems were reported. Then I created a small hello world example just to test the MPI:

#include <stdio.h>
#include "mpi.h"

int main (argc, argv)
     int argc;
     char *argv[];
{
  int rank, size;

  

  MPI_Init (&argc, &argv);/* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);/* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);/* get number of processes */

  

  printf( "Hello world from process %d of %d\n", rank, size );

  

  MPI_Finalize();
  return 0;
}

compile it ($mpicc -o hello hello.c), all went fine too; and finally run it ($mpiexec -n 2 ./hello). However, that is the problem reported by mpiexec:

$ mpiexec -n 2 ./hello
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(467)..............: 
MPID_Init(177).....................: channel initialization failed
MPIDI_CH3_Init(70).................: 
MPID_nem_init(319).................: 
MPID_nem_tcp_init(171).............: 
MPID_nem_tcp_get_business_card(418): 
MPID_nem_tcp_init(377).............: gethostbyname failed, mac (errno 1)
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(467)..............: 
MPID_Init(177).....................: channel initialization failed
MPIDI_CH3_Init(70).................: 
MPID_nem_init(319).................: 
MPID_nem_tcp_init(171).............: 
MPID_nem_tcp_get_business_card(418): 
MPID_nem_tcp_init(377).............: gethostbyname failed, mac (errno 1)

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 653 RUNNING AT mac
=   EXIT CODE: 1
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================

The version installed:
$ mpichversion 
MPICH Version:    3.1
MPICH Release date: Thu Feb 20 11:41:13 CST 2014
MPICH Device:    ch3:nemesis
MPICH configure: --disable-dependency-tracking --disable-silent-rules --prefix=/usr/local/Cellar/mpich2/3.1 --mandir=/usr/local/Cellar/mpich2/3.1/share/man
MPICH CC: clang    -O2
MPICH CXX: clang++  
MPICH F77: /usr/local/bin/gfortran   -O2
MPICH FC: /usr/local/bin/gfortran  

Does anyone have any idea of why I am getting this error? The hostname command is also working fine, so I do NOT understand this problem. Furthermore, the idea is to run MPICH2 on my mac, not in a cluster so it should be straightforward to pick the hostname. My /etc/hosts shows the following:
$ cat /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
::1             localhost 
fe80::1%lo0 localhost

Any ideas? Any help, suggestions or workarounds would be much appreciated.

Best regards,
Luis