#include "mpi.h" #include #include int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); char portname[MPI_MAX_PORT_NAME]; MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); if (MPI_Lookup_name("RandomSession", MPI_INFO_NULL, portname) == MPI_SUCCESS) { MPI_Comm newComm ; int errclass ; int err = MPI_Comm_connect (portname, MPI_INFO_NULL, 0, MPI_COMM_SELF, &newComm); MPI_Error_class(err, &errclass); if (errclass == MPI_SUCCESS) { MPI_Errhandler_set(newComm, MPI_ERRORS_RETURN); printf("Connected to Port : %s\n", portname); int val = 99 ; MPI_Status status ; MPI_Send (&val, 1, MPI_INT, 0, 94, newComm); MPI_Recv (&val, 1, MPI_INT, 0, 91, newComm, &status); //CRASH HERE assert(0); MPI_Comm_disconnect(&newComm); } else { printf( "Connection attempt failed" ); } } else { printf( "Failed to find portname " ); } MPI_Finalize(); return 0 ; }