LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jim Lasc (jimlasc_at_[hidden])
Date: 2005-08-09 09:29:24


I made some easy code to connect a server to a client.
It works perfectly as I expected when I use a "hardcoded" name (which I
receive from the server).
However, when I use exactly the same code (except the MPI_Lookup_name in the
client) it doesn't works anymore.
All I do is comment out A or B.
am I doing something wrong ?
------------------------------------------
 
#define TAG 22

int main( int argc, char **argv )
{
MPI_Comm server;
char port_name[MPI_MAX_PORT_NAME];

MPI_Init( &argc, &argv );
// MPI_Lookup_name("konijn",MPI_INFO_NULL,port_name);/* A */
strcpy(port_name,"port=4114 description=\"PC_nr01
www.slotch.com<http://www.slotch.com/>
127.0.0.1 <http://127.0.0.1/> \" " );/* B */

MPI_Comm_connect( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &server );
int nummtje=5;
MPI_Send( &nummtje, 1, MPI_INT, 0, TAG, server );

MPI_Comm_disconnect( &server );
MPI_Finalize();
return 0;
}
-------------------------------------------------
int main( int argc, char **argv )
{
MPI_Comm client;
MPI_Status status;
char port_name[MPI_MAX_PORT_NAME];
int size, again;

MPI_Init( &argc, &argv );
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size != 1) {printf("Server too big");fflush(stdout);}
MPI_Open_port(MPI_INFO_NULL, port_name);
MPI_Publish_name("konijn",MPI_INFO_NULL,port_name);
printf("server available at -%s-\n",port_name); fflush(stdout);

int dest=0;

MPI_Comm_accept( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD,&client );
MPI_Recv( &dest, 1, MPI_INT,MPI_ANY_SOURCE, MPI_ANY_TAG, client, &status );
printf("\n%d ontvangen",dest);fflush(stdout);
MPI_Unpublish_name("konijn",MPI_INFO_NULL,port_name);
MPI_Finalize();
}

------------------------------------------
job aborted:
rank: node: exit code[: error message]
0: PC_nr01: 13: Fatal error in MPI_Comm_connect: Other MPI error, error
stack:
MPI_Comm_connect(118): MPI_Comm_connect(port="aV@", MPI_INFO_NULL, root=0,
MPI_COMM_WORLD, newcomm=0x0012FF74) failed
MPID_Comm_connect(28):
MPIDI_CH3_Comm_connect(76):
MPIDI_CH3I_Connect_to_root(1395): no space for the host description