1
1

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.
Этот коммит содержится в:
Edgar Gabriel 2004-12-23 15:33:16 +00:00
родитель cfd5ba940d
Коммит 9b2056c345
8 изменённых файлов: 28 добавлений и 14 удалений

Просмотреть файл

@ -380,14 +380,20 @@ ompi_comm_start_processes(int count, char **array_of_commands,
} }
/* Add environment variable with the contact information for the /* 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(&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); ompi_argv_append(&(sched->envc), &(sched->env), tmp);
free(tmp); free(tmp);
free(envvarname); free(envvarname);
/* Verify for the 'wdir' and later potentially for the /* Check for the 'wdir' and later potentially for the
'path' Info object */ 'path' Info object */
have_wdir = 0; have_wdir = 0;
if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) { 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_process_name_t *port_proc_name=NULL;
ompi_group_t *group = NULL; ompi_group_t *group = NULL;
ompi_errhandler_t *errhandler = NULL; ompi_errhandler_t *errhandler = NULL;
char remainder[128];
int appnum=0;
/* get jobid */ /* get jobid */
/* JMS: Previous was using ompi_proc_self() here, which /* JMS: Previous was using ompi_proc_self() here, which
@ -501,8 +509,11 @@ int ompi_comm_dyn_init (void)
if (NULL != port_name ) { if (NULL != port_name ) {
ompi_communicator_t *oldcomm; ompi_communicator_t *oldcomm;
/* we have been spawned */ /* split the content of the environment variable into
oob_port = ompi_parse_port (port_name, &tag); 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); port_proc_name = ompi_name_server.convert_string_to_process_name(oob_port);
ompi_comm_connect_accept (MPI_COMM_WORLD, root, port_proc_name, ompi_comm_connect_accept (MPI_COMM_WORLD, root, port_proc_name,
send_first, &newcomm, tag ); send_first, &newcomm, tag );

Просмотреть файл

@ -59,7 +59,7 @@ int ompi_open_port(char *port_name)
/* takes a port_name and separates it into the process_name /* takes a port_name and separates it into the process_name
and the tag 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; char tmp_port[MPI_MAX_PORT_NAME], *tmp_string;
@ -71,6 +71,9 @@ char *ompi_parse_port (char *port_name, int *tag)
strncpy (tmp_port, port_name, MPI_MAX_PORT_NAME); strncpy (tmp_port, port_name, MPI_MAX_PORT_NAME);
strncpy (tmp_string, strtok(tmp_port, ":"), MPI_MAX_PORT_NAME); strncpy (tmp_string, strtok(tmp_port, ":"), MPI_MAX_PORT_NAME);
sscanf( strtok(NULL, ":"),"%d", tag); sscanf( strtok(NULL, ":"),"%d", tag);
if ( NULL != remainder ) {
*remainder = strtok(NULL, ":");
}
return tmp_string; return tmp_string;
} }

Просмотреть файл

@ -372,7 +372,7 @@ struct ompi_communicator_t {
* takes a port_name and returns the oob-contact information * takes a port_name and returns the oob-contact information
* and the tag * 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 * routines handling name publishing, lookup and unpublishing

Просмотреть файл

@ -2,9 +2,9 @@
* $HEADER$ * $HEADER$
*/ */
extern const mca_base_component_t mca_iof_proxy_component;
const mca_base_component_t *mca_iof_base_static_components[] = { const mca_base_component_t *mca_iof_base_static_components[] = {
&mca_iof_proxy_component,
NULL NULL
}; };

Просмотреть файл

@ -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. * The two leaders will figure this out later. However, we need the tag.
*/ */
if ( rank == root ) { if ( rank == root ) {
tmp_port = ompi_parse_port(port_name, &tag); tmp_port = ompi_parse_port(port_name, &tag, NULL);
free (tmp_port); free (tmp_port);
} }
rc = ompi_comm_connect_accept (comm, root, NULL, send_first, &newcomp, tag); rc = ompi_comm_connect_accept (comm, root, NULL, send_first, &newcomp, tag);

Просмотреть файл

@ -86,7 +86,7 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
* structure. * structure.
*/ */
if ( rank == root ) { 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); port_proc_name = ompi_name_server.convert_string_to_process_name(tmp_port);
if ( NULL == port_proc_name ) { if ( NULL == port_proc_name ) {
*newcomm = MPI_COMM_NULL; *newcomm = MPI_COMM_NULL;

Просмотреть файл

@ -91,7 +91,7 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
ompi_open_port (port_name); ompi_open_port (port_name);
ompi_comm_start_processes (1, &command, &argv, &maxprocs, ompi_comm_start_processes (1, &command, &argv, &maxprocs,
&info, port_name); &info, port_name);
tmp_port = ompi_parse_port (port_name, &tag); tmp_port = ompi_parse_port (port_name, &tag, NULL);
free(tmp_port); free(tmp_port);
} }

Просмотреть файл

@ -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, ompi_comm_start_processes(count, array_of_commands,
array_of_argv, array_of_maxprocs, array_of_argv, array_of_maxprocs,
array_of_info, port_name); 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); free(tmp_port);
} }