void MPICommunicator::establishConnectionChannel(){ // This function will open a port and publish a service in the name CS(control script). MPI_Status status; MPI_Open_port(MPI_INFO_NULL, &portname[0]); // Publish the service MPI_Publish_name((char*)(name.c_str()), MPI_INFO_NULL, &portname[0]); }
MPI_Comm server_init( MPI_Comm comm ) { char port_name[ MPI_MAX_PORT_NAME ]; MPI_Comm newcomm; MPI_Open_port( MPI_INFO_NULL, port_name ); fprintf( stdout, "server: port opened at %s\n", port_name ); MPI_Publish_name( "mpe_port_name", MPI_INFO_NULL, port_name ); MPI_Comm_accept( port_name, MPI_INFO_NULL, 0, comm, &newcomm ); return newcomm; }
void mpi_publish_name_f(char *service_name, MPI_Fint *info, char *port_name, MPI_Fint *ierr, int service_name_len, int port_name_len) { MPI_Info c_info; char *c_service_name; char *c_port_name; c_info = MPI_Info_f2c(*info); ompi_fortran_string_f2c(service_name, service_name_len, &c_service_name); ompi_fortran_string_f2c(port_name, port_name_len, &c_port_name); *ierr = OMPI_INT_2_FINT(MPI_Publish_name(c_service_name, c_info, c_port_name)); free ( c_service_name); free ( c_port_name); }