[MPICH] Name Publishing

lunasole at interfree.it lunasole at interfree.it
Mon Aug 29 03:01:41 CDT 2005


i used MPICH2 version 1.0.2 on Linux (mpich2-1.0.2p1.tar.gz). i runned the server in background with mpiexec command.
thank's


>I can run these programs with our latest source in CVS without any problem. 
>Which version of MPICH2 are you using? Try version 1.0.2 if you are using an 
>older version. (I didn't check whether this works with 1.0.2).
>
>Are you running the server in the background? If so, you need to do mpiexec -n 1 
>server < /dev/null & 
>
>Rajeev
>
>> -----Original Message----- > From: owner-mpich-discuss at mcs.anl.gov 
>> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of 
>> lunasole at interfree.it
>> Sent: Tuesday, August 02, 2005 2:20 AM
>> To: mpich-discuss at mcs.anl.gov
>> Subject: [MPICH] Name Publishing
>> 
>> 
>> Hi
>> I impemented a simple application Client/Server using Name Publishing.
>>  
>> I launched Server with mpiexec command. The Server associated 
>> a port name with a private name "SERVER".  After I 
>> 
>> launched client on another machine. It looked the port name 
>> up by passing name "SERVER" to MPI_Lookup_name.
>> 
>> with LAM I have no problem for this implementation.
>> with MPICH2 i have the following error message on client side:
>> 
>>         ercole Name_Server]$ mpiexec -n 1 -path 
>> sample_MPICH2_MPI/MPI-2/Name_Server/ client
>> 
>>         Port_name= port#32867$description#ercole$rank 0 in 
>> job 1  ercole_32771   causedcollective abort of all ranks
>> exit status of rank 0: killed by signal 9
>> 
>> What is the problem? 
>> 
>> Thank's. 
>>    Rosalia Salvatore
>> 
>> 
>> Client and Server implementation:
>> 
>> //SERVER
>> #include <stdio.h>
>> #include <mpi.h>
>> 
>> #define NUM_LOOP 200
>> #define MAX_DATA 200
>> #define TIMER_ELAPSED \
>>  ( ( tv2.tv_usec - tv1.tv_usec ) \
>>   + ( ( tv2.tv_sec - tv1.tv_sec) * 1.E6 ) )
>> 
>> int main (int argc, char* argv[])
>> {
>>  int rank, size,again,i;
>>  static int count=0;
>>  MPI_Comm client;
>>  MPI_Status status;
>>  char port_name[MPI_MAX_PORT_NAME];
>>  double buf[MAX_DATA];
>>  int time[NUM_LOOP];
>>  
>>  MPI_Init(&argc,&argv); /* Initialize MPI */
>>  MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get rank */
>>  MPI_Comm_size(MPI_COMM_WORLD,&size); /* Get size of the LAM 
>> universe */
>>  if (size != 1) 
>>  {
>>   printf("Error");
>>   return -1;
>>  }
>>  //printf("CIAO\n");
>>  MPI_Open_port (MPI_INFO_NULL,port_name);
>>  printf("port_name= %s\n", port_name);
>>  MPI_Publish_name("SERVER",MPI_INFO_NULL,port_name);
>>  printf("waiting...\n");
>>  while(1)
>>  {
>>   MPI_Comm_accept (port_name, MPI_INFO_NULL, 0, 
>> MPI_COMM_WORLD, &client);
>>   again=1;
>>   
>>   while (again == 1)
>>   {
>>    printf("\nReceive\n");
>>    
>> MPI_Recv(buf,MAX_DATA,MPI_DOUBLE,MPI_ANY_SOURCE,MPI_ANY_TAG, 
>> client, &status);
>>    MPI_Send(buf, MAX_DATA, MPI_DOUBLE, 0, 2, client);
>>    printf("MPI_TAG =%d\n ", status.MPI_TAG);
>>    
>>    switch(status.MPI_TAG)
>>    {
>>     case 0: 
>>      MPI_Comm_free(&client);
>>      MPI_Close_port(port_name);
>>      MPI_Finalize();
>>      return 0;
>>     
>>     case 1:
>> 					MPI_Comm_disconnect(&client);
>> 					again =0;
>> 					break;
>> 				case 2:
>> 					//for (i=0;i<MAX_DATA;i++)
>> 					//{
>> 					printf("buf[%d]= %f",1,buf[1]);
>> 					//}//end for
>> 					
>> 					break;
>> 				      	
>> 				default: 
>>      MPI_Abort (MPI_COMM_WORLD,1);
>>      break;
>>     
>>    } //end of switch
>>   } //end while again
>> } //infinity 
>> 	
>> }	
>> 
>> 
>> 
>> 
>> // CLIENT
>> #include <stdio.h>
>> #include <mpi.h>
>> #include <sys/time.h>
>> 
>> 
>> #define LOOP 10000
>> #define MAX_DATA 200
>> #define TIMER_ELAPSED \
>>  ( ( tv2.tv_usec - tv1.tv_usec ) \
>>   + ( ( tv2.tv_sec - tv1.tv_sec) * 1.E6 ) )
>>  
>>     
>> int main (int argc, char* argv[])
>> {
>>  int rank, size,i, tag=0, done=1;
>>  MPI_Comm server;
>>  MPI_Status status;
>>  char port_name[MPI_MAX_PORT_NAME];
>>  double buf[MAX_DATA];
>>  double var=0.0;
>>    int time[LOOP];
>>  struct timeval tv1, tv2;
>>  FILE *fp; 
>>  long max=0, min=20000000;
>>  
>>  
>>  MPI_Init(&argc,&argv); /* Initialize MPI */
>>  
>>  MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get rank */
>>  //MPI_Comm_size(MPI_COMM_WORLD,&size); /* Get size of the 
>> LAM universe */ 
>>  
>>  MPI_Lookup_name("SERVER", MPI_INFO_NULL, port_name);
>>  printf("\nMPI_Lookup_name Port_name= %s", port_name);
>>  MPI_Comm_connect (port_name, MPI_INFO_NULL,0, 
>> MPI_COMM_WORLD, &server);
>>   
>>   for (i=0;i<MAX_DATA;i++)
>>  {
>>   buf[i]= i*2.0;
>>   //printf("buf[%d]= %f\t",i,buf[i]);
>>  }
>>  
>>  tag=2;
>>  for(i=0;i<LOOP;i++)
>>  {
>>   gettimeofday(&tv1, NULL);
>>   MPI_Send(buf, MAX_DATA, MPI_DOUBLE, 0, tag, server);
>>   
>> MPI_Recv(buf,MAX_DATA,MPI_DOUBLE,MPI_ANY_SOURCE,MPI_ANY_TAG, 
>> server, &status);
>>   gettimeofday(&tv2, NULL);
>>   time[i]=(int)TIMER_ELAPSED;
>>   printf("\nsend and receive con buf[%d]= %f\n",1,buf[1]);
>>   printf("Client Tempo[%d]= %d\n",i, time[i]);
>>    
>>  } //end for
>>  tag=1; 
>>  MPI_Send(buf, MAX_DATA, MPI_DOUBLE, 0, tag, server);
>> 	printf("\nSend con tag 1\n"); 
>> 		
>> 	MPI_Comm_disconnect(&server);
>> 	MPI_Finalize();
>> 
>> 	/* *************** TIME RESULTS ***************** */
>> 	fp= fopen("Results.txt","w");	
>> 	for(i=0;i<LOOP;i++)
>> 	{
>> 		fprintf(fp,"%d    %ld \n", i+1 ,time[i]);
>> 		var=var+time[i];
>> 		if(time[i]<min) min=time[i];
>>     		if(time[i]>max) max=time[i];	
>> 	}
>> 
>> 	var=var/LOOP-1;
>> 	printf("Tempo del client %d = %f usec\n",rank,var);
>> 		
>>  fprintf(fp,"LATENCY TIME MIN = %ld microsec\n", min);
>>  fprintf(fp,"LATENCY TIME MAX = %ld microsec\n", max);
>>  fprintf(fp,"LATENCY TIME AVERAGE = %f microsec\n", var);
>>  
>>  fclose (fp);
>>  return 0;
>> 	
>> }	
>> 
>> 
>> 
>> --------------------------------------------------------------
>> -----------
>> Visita http://domini.interfree.it, il sito di Interfree dove trovare
>> soluzioni semplici e complete che soddisfano le tue esigenze 
>> in Internet,
>> ecco due esempi di offerte:
>> 
>> -  Registrazione Dominio: un dominio con 1 MB di spazio disco 
>> +  2 caselle
>>    email a soli 18,59 euro
>> -  MioDominio: un dominio con 20 MB di spazio disco + 5 caselle email 
>>    a soli 51,13 euro
>> 
>> Vieni a trovarci!
>> 
>> Lo Staff di Interfree 
>> --------------------------------------------------------------
>> -----------
>> 
>> 
>
>
>

-------------------------------------------------------------------------
Visita http://domini.interfree.it, il sito di Interfree dove trovare
soluzioni semplici e complete che soddisfano le tue esigenze in Internet,
ecco due esempi di offerte:

-  Registrazione Dominio: un dominio con 1 MB di spazio disco +  2 caselle
   email a soli 18,59 euro
-  MioDominio: un dominio con 20 MB di spazio disco + 5 caselle email 
   a soli 51,13 euro

Vieni a trovarci!

Lo Staff di Interfree 
-------------------------------------------------------------------------




More information about the mpich-discuss mailing list