Do you have multiple IP interfaces on a single machine on the same IP subnet, perchance?
If so, don't do that. :-) Put each of your IP addresses in a different IP subnet. On Apr 3, 2012, at 10:30 PM, Rohan Deshpande wrote: > Hi, > > I am running a MPI program using cluster and tcp communication. > > To run I am using: mpirun --prefix /usr/local/ --mca btl tcp,self --hostfile > slaves -np 6 scatter > > > I am getting following output: > > Process 0 on host host1 has elements 0 1 2 3 > Process 1 on host host1 has elements 4 5 6 7 > Process 2 on host host1 has elements 8 9 10 11 > Process 3 on host host1 has elements 12 13 14 15 > [slave1][[24708,1],5][btl_tcp_endpoint.c:486:mca_btl_tcp_endpoint_recv_connect_ack] > received unexpected process identifier [[24708,1],4] > > When trying to communicate with slave1 i get received unexpected process > identifier error. > > My PATH and LD_LIBRARY_PATH are correctly set in .bashrc file. > > > > Source code - > > > #include <stdlib.h> > #include <stdio.h> > #include "mpi.h" > #define MAXPROC 8 /* Max number of procsses */ > #define LENGTH 24 /* length of buffer */ > > int main(int argc, char* argv[]) { > int i, j, np, me; > const int nametag = 40; /* Tag value for sending name */ > const int datatag = 45; /* Tag value for sending data */ > const int root = 0; /* Root process in scatter */ > MPI_Status status; /* Status object for receive */ > > char myname[MPI_MAX_PROCESSOR_NAME]; /* Local host name string */ > char hostname[MAXPROC][MPI_MAX_PROCESSOR_NAME]; /* Received host names */ > int namelen; > > int x[LENGTH]; /* Send buffer */ > int y[LENGTH]; /* Receive buffer */ > > MPI_Init(&argc, &argv); /* Initialize MPI */ > MPI_Comm_size(MPI_COMM_WORLD, &np); /* Get nr of processes */ > MPI_Comm_rank(MPI_COMM_WORLD, &me); /* Get own identifier */ > > MPI_Get_processor_name(myname, &namelen); /* Get host name */ > myname[namelen++] = (char)0; /* Terminating null byte */ > > /* Check that we have an even number of processes and at most MAXPROC */ > if (np>MAXPROC || np%2 != 0) { > if (me == 0) { > printf("You have to use an even number of processes (at most %d)\n", > MAXPROC); > } > MPI_Finalize(); > exit(0); > } > > if (me == 0) { /* Process 0 does this */ > > /* Initialize the array x with values 0 .. LENGTH-1 */ > for (i=0; i<LENGTH; i++) { > x[i] = i; > } > > printf("Process %d on host %s is distributing array x to all %d > processes\n\n", > me, myname, np); > > /* Scatter the array x to all proceses, place it in y */ > MPI_Scatter(x, LENGTH/np, MPI_INT, y, LENGTH/np, MPI_INT, root, > MPI_COMM_WORLD); > > /* Print out own portion of the scattered array */ > printf("Process %d on host %s has elements", me, myname); > for (i=0; i<LENGTH/np; i++) { > printf(" %d", y[i]); > } > printf("\n"); > > /* Receive messages with hostname and the scattered data */ > /* from all other processes */ > for (i=1; i<np; i++) { > MPI_Recv (hostname[i], namelen, MPI_CHAR, i, nametag, MPI_COMM_WORLD, > &status); > MPI_Recv (y, LENGTH/np, MPI_INT, i, datatag, MPI_COMM_WORLD, &status); > printf("Process %d on host %s has elements", i, hostname[i]); > for (j=0; j<LENGTH/np; j++) { > printf(" %d", y[j]); > } > printf("\n"); > } > > printf("Ready\n"); > > > } else { /* all other processes do this */ > > /* Receive the scattered array from process 0, place it in array y */ > MPI_Scatter(x, LENGTH/np, MPI_INT, y, LENGTH/np, MPI_INT, root, \ > MPI_COMM_WORLD); > /* Send own name back to process 0 */ > MPI_Send (myname, namelen, MPI_CHAR, 0, nametag, MPI_COMM_WORLD); > /* Send the received array back to process 0 */ > MPI_Send (y, LENGTH/np, MPI_INT, 0, datatag, MPI_COMM_WORLD); > > } > > MPI_Finalize(); > exit(0); > } > > Any idea what could be wrong? > > > Thanks > > > > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/