diff --git a/src/communicator/Makefile.am b/src/communicator/Makefile.am index a10feb2a93..20a70b565c 100644 --- a/src/communicator/Makefile.am +++ b/src/communicator/Makefile.am @@ -16,7 +16,8 @@ libcommunicator_la_SOURCES = \ $(headers) \ comm_init.c \ comm.c \ - comm_cid.c + comm_cid.c \ + comm_publish.c # Conditionally install the header files diff --git a/src/communicator/comm_publish.c b/src/communicator/comm_publish.c new file mode 100644 index 0000000000..b6cd47d874 --- /dev/null +++ b/src/communicator/comm_publish.c @@ -0,0 +1,68 @@ +/* + * $HEADER$ + */ + +#include "ompi_config.h" +#include +#include +#include "mpi.h" + +#include "communicator/communicator.h" +#include "proc/proc.h" +#include "include/constants.h" +#include "mca/pcm/pcm.h" +#include "mca/pml/pml.h" + +#ifndef HAVE_REGISTRY +/* just to keep the linker happy */ +int ompi_comm_namepublish ( char *service_name, char *port_name ) +{ + return OMPI_SUCCESS; +} +char* ompi_comm_namelookup ( char *service_name ) +{ + return NULL; +} +int ompi_comm_nameunpublish ( char *service_name ) +{ + return OMPI_SUCCESS; +} +#else +#include "mca/gpr/gpr.h" + +/* + * publish the port_name using the service_name as a token + * jobid and vpid are used later to make + * sure, that only this process can unpublish the information. + */ +int ompi_comm_namepublish ( char *service_name, char *port_name ) +{ + return (ompi_registry_put((uint8_t *)port_name, strlen(service_name), + "universe", service_name, NULL)); +} + +char* ompi_comm_namelookup ( char *service_name ) +{ + ompi_registry_value_t *tmp; + char *stmp=NULL; + + tmp = ompi_registry_get("universe", service_name, NULL); + if ( NULL != tmp ) { + stmp = (char*)tmp->object; + } + + return (stmp); +} + +/* + * delete the entry. Just the process who has published + * the service_name, has the right to remove this + * service. Will be done later, by adding jobid and vpid + * as tokens + */ +int ompi_comm_nameunpublish ( char *service_name ) +{ + return (ompi_registry_del("universe", service_name, NULL)); +} + +#endif diff --git a/src/communicator/communicator.h b/src/communicator/communicator.h index c23b953100..8af28f7657 100644 --- a/src/communicator/communicator.h +++ b/src/communicator/communicator.h @@ -287,6 +287,16 @@ extern "C" { */ int ompi_comm_dump ( ompi_communicator_t *comm ); + + + /** + * routines handling name publishing, lookup and unpublishing + */ + int ompi_comm_namepublish ( char *service_name, char *port_name ); + char* ompi_comm_namelookup ( char *service_name ); + int ompi_comm_nameunpublish ( char *service_name ); + + #if defined(c_plusplus) || defined(__cplusplus) } #endif