From 9b2056c345e92ac4ccd3f12646ae85cc84521676 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 23 Dec 2004 15:33:16 +0000 Subject: [PATCH] adding support for the optional attribute MPI_APPNUM. The information is now correctly available at the child processes, however the attribute is not yet set. This commit was SVN r3876. --- src/communicator/comm_dyn.c | 21 ++++++++++++++++----- src/communicator/comm_publish.c | 7 +++++-- src/communicator/communicator.h | 2 +- src/mca/iof/base/static-components.h | 4 ++-- src/mpi/c/comm_accept.c | 2 +- src/mpi/c/comm_connect.c | 2 +- src/mpi/c/comm_spawn.c | 2 +- src/mpi/c/comm_spawn_multiple.c | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/communicator/comm_dyn.c b/src/communicator/comm_dyn.c index 1817a85411..0417e2bc6d 100644 --- a/src/communicator/comm_dyn.c +++ b/src/communicator/comm_dyn.c @@ -380,14 +380,20 @@ ompi_comm_start_processes(int count, char **array_of_commands, } /* Add environment variable with the contact information for the - child processes */ + child processes. + 12.23.2004 EG: the content of the environment variable + does know hold additionally to the oob contact information + also the information, which application in spawn/spawn_multiple + it has been. This information is needed to construct the + attribute MPI_APPNUM on the children side (an optional + MPI-2 attribute. */ asprintf(&envvarname, "OMPI_PARENT_PORT_%u", new_jobid); - asprintf(&tmp, "%s=%s", envvarname, port_name); + asprintf(&tmp, "%s=%s:%d", envvarname, port_name, i); ompi_argv_append(&(sched->envc), &(sched->env), tmp); free(tmp); free(envvarname); - /* Verify for the 'wdir' and later potentially for the + /* Check for the 'wdir' and later potentially for the 'path' Info object */ have_wdir = 0; if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) { @@ -482,6 +488,8 @@ int ompi_comm_dyn_init (void) ompi_process_name_t *port_proc_name=NULL; ompi_group_t *group = NULL; ompi_errhandler_t *errhandler = NULL; + char remainder[128]; + int appnum=0; /* get jobid */ /* JMS: Previous was using ompi_proc_self() here, which @@ -501,8 +509,11 @@ int ompi_comm_dyn_init (void) if (NULL != port_name ) { ompi_communicator_t *oldcomm; - /* we have been spawned */ - oob_port = ompi_parse_port (port_name, &tag); + /* split the content of the environment variable into + its pieces, which are : port_name, tag, and mpi_appnum. */ + oob_port = ompi_parse_port (port_name, &tag, &(remainder[0])); + sscanf (remainder, "%d", &appnum); + port_proc_name = ompi_name_server.convert_string_to_process_name(oob_port); ompi_comm_connect_accept (MPI_COMM_WORLD, root, port_proc_name, send_first, &newcomm, tag ); diff --git a/src/communicator/comm_publish.c b/src/communicator/comm_publish.c index 70eccfe880..7d828bf658 100644 --- a/src/communicator/comm_publish.c +++ b/src/communicator/comm_publish.c @@ -59,7 +59,7 @@ int ompi_open_port(char *port_name) /* takes a port_name and separates it into the process_name and the tag */ -char *ompi_parse_port (char *port_name, int *tag) +char *ompi_parse_port (char *port_name, int *tag, char **remainder) { char tmp_port[MPI_MAX_PORT_NAME], *tmp_string; @@ -71,7 +71,10 @@ char *ompi_parse_port (char *port_name, int *tag) strncpy (tmp_port, port_name, MPI_MAX_PORT_NAME); strncpy (tmp_string, strtok(tmp_port, ":"), MPI_MAX_PORT_NAME); sscanf( strtok(NULL, ":"),"%d", tag); - + if ( NULL != remainder ) { + *remainder = strtok(NULL, ":"); + } + return tmp_string; } diff --git a/src/communicator/communicator.h b/src/communicator/communicator.h index 2247303b23..89fa136aaf 100644 --- a/src/communicator/communicator.h +++ b/src/communicator/communicator.h @@ -372,7 +372,7 @@ struct ompi_communicator_t { * takes a port_name and returns the oob-contact information * and the tag */ - char * ompi_parse_port (char *port_name, int *tag) ; + char * ompi_parse_port (char *port_name, int *tag, char **remainder) ; /** * routines handling name publishing, lookup and unpublishing diff --git a/src/mca/iof/base/static-components.h b/src/mca/iof/base/static-components.h index 25c52ca0ba..52a02d91a3 100644 --- a/src/mca/iof/base/static-components.h +++ b/src/mca/iof/base/static-components.h @@ -2,9 +2,9 @@ * $HEADER$ */ -extern const mca_base_component_t mca_iof_proxy_component; + const mca_base_component_t *mca_iof_base_static_components[] = { - &mca_iof_proxy_component, + NULL }; diff --git a/src/mpi/c/comm_accept.c b/src/mpi/c/comm_accept.c index 035734306d..20f7a1e8e1 100644 --- a/src/mpi/c/comm_accept.c +++ b/src/mpi/c/comm_accept.c @@ -84,7 +84,7 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root, * The two leaders will figure this out later. However, we need the tag. */ if ( rank == root ) { - tmp_port = ompi_parse_port(port_name, &tag); + tmp_port = ompi_parse_port(port_name, &tag, NULL); free (tmp_port); } rc = ompi_comm_connect_accept (comm, root, NULL, send_first, &newcomp, tag); diff --git a/src/mpi/c/comm_connect.c b/src/mpi/c/comm_connect.c index c85f673654..1545fcca2f 100644 --- a/src/mpi/c/comm_connect.c +++ b/src/mpi/c/comm_connect.c @@ -86,7 +86,7 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root, * structure. */ if ( rank == root ) { - tmp_port = ompi_parse_port (port_name, &tag); + tmp_port = ompi_parse_port (port_name, &tag, NULL); port_proc_name = ompi_name_server.convert_string_to_process_name(tmp_port); if ( NULL == port_proc_name ) { *newcomm = MPI_COMM_NULL; diff --git a/src/mpi/c/comm_spawn.c b/src/mpi/c/comm_spawn.c index 2dc28636d0..b2dcc83ea4 100644 --- a/src/mpi/c/comm_spawn.c +++ b/src/mpi/c/comm_spawn.c @@ -91,7 +91,7 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info, ompi_open_port (port_name); ompi_comm_start_processes (1, &command, &argv, &maxprocs, &info, port_name); - tmp_port = ompi_parse_port (port_name, &tag); + tmp_port = ompi_parse_port (port_name, &tag, NULL); free(tmp_port); } diff --git a/src/mpi/c/comm_spawn_multiple.c b/src/mpi/c/comm_spawn_multiple.c index 047103c077..c8e11edba4 100644 --- a/src/mpi/c/comm_spawn_multiple.c +++ b/src/mpi/c/comm_spawn_multiple.c @@ -117,7 +117,7 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o ompi_comm_start_processes(count, array_of_commands, array_of_argv, array_of_maxprocs, array_of_info, port_name); - tmp_port = ompi_parse_port (port_name, &tag); + tmp_port = ompi_parse_port (port_name, &tag, NULL); free(tmp_port); }