[mpich-discuss] Re : MPI process killed and SIGUSR1

Roy, Hirak Hirak_Roy at mentor.com
Mon Oct 27 06:52:18 CDT 2014


Hi Wesley,

Here is my server.c and client.c.
I have explicitly added 'assert(0);' in client.c.
However my receive hangs in server and does not complete.

Could you please enlighten on this more.

Thanks,
Hirak


#include <sys/types.h>
#include <unistd.h>
#include "mpi.h"
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <fcntl.h>


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

  MPI_Init (&argc, &argv);
  MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_RETURN);

  char portname[MPI_MAX_PORT_NAME];
  MPI_Open_port(MPI_INFO_NULL, portname);
  MPI_Publish_name("RandomSession", MPI_INFO_NULL, portname);
  printf ("Successfully published portname : %s\n", portname);
  MPI_Comm newComm ;
  MPI_Comm_accept (portname, MPI_INFO_NULL, 0, MPI_COMM_SELF, &newComm);
  printf ("Successfully connected to client\n");
  MPI_Errhandler_set(newComm, MPI_ERRORS_RETURN);

  printf ("Waiting on receive\n");
  int val = 0 ;
  MPI_Status status;
  int errcode = MPI_Recv(&val, 1, MPI_INT, 0, 99, newComm, &status);
  int errclass ;
  MPI_Error_class(errcode, &errclass);
  if (errclass == MPI_SUCCESS) {
    printf ("Received a message with tag 99\n");
    MPI_Comm_disconnect (&newComm);
    printf ("Disconnected client\n");
  } else {
    printf ("Receive error\n");
  }


  MPI_Unpublish_name("RandomSession", MPI_INFO_NULL, portname);
  MPI_Close_port(portname);
  MPI_Finalize();

}


#include <sys/types.h>
#include <unistd.h>
#include "mpi.h"
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <fcntl.h>


int main (int argc, char* argv[])
{
  MPI_Init (&argc, &argv);
  MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_RETURN);

  char portname[MPI_MAX_PORT_NAME];
  if (MPI_Lookup_name("RandomSession", MPI_INFO_NULL, portname) == MPI_SUCCESS) {
    printf ("Successfully got portname : %s\n", portname);
    MPI_Comm newComm ;
    MPI_Comm_connect (portname, MPI_INFO_NULL, 0, MPI_COMM_SELF, &newComm);
    printf ("Successfully connected to server\n");
    MPI_Errhandler_set(newComm, MPI_ERRORS_RETURN);

    assert (0);
    int val = 0 ;
    MPI_Send(&val, 1, MPI_INT, 0, 99, newComm);
    printf ("Send a message with tag 99\n");
    MPI_Comm_disconnect (&newComm);
    printf ("Disconnected client\n");
  }
  MPI_Finalize();
}
MPICH Version:        3.0.4
MPICH Release date:   Wed Apr 24 10:08:10 CDT 2013
MPICH Device:         ch3:sock
MPICH configure:      --prefix /home/jlevitt/local/mpich-3.0.4/linux_x86_64 --disable-f77 --disable-fc --disable-f90modules --disable-cxx --enable-fast=nochkmsg --enable-fast=notiming --enable-fast=ndebug --enable-fast=O3 --with-device=ch3:sock CFLAGS=-O3 -fPIC CXXFLAGS=-O3 -fPIC
MPICH CC: /u/prod/gnu/gcc/20121129/gcc-4.5.0-linux_x86_64/bin/gcc -O3 -fPIC   -O3
MPICH CXX:      no -O3 -fPIC
MPICH F77:      no
MPICH FC: no
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20141027/c23fd417/attachment.html>
-------------- next part --------------
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list