1
1

Enable the passing of MCA params to dynamically spawned jobs. This creates a new info_key "ompi_param" that allows a user to specify MCA params for a dynamically spawned job.

We currently apply all of the MCA params in the parent job to the child. This commit allows a user to specify additional params for the child job, and to override any pre-existing params with the new value so they can better control behavior of the child job.

This commit was SVN r20989.
Этот коммит содержится в:
Ralph Castain 2009-04-14 14:15:49 +00:00
родитель 339948928d
Коммит 9c39a3edd7
8 изменённых файлов: 28 добавлений и 8 удалений

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

@ -497,6 +497,7 @@ static int spawn(int count, char **array_of_commands,
char host[OMPI_PATH_MAX]; /*** should define OMPI_HOST_MAX ***/
char prefix[OMPI_PATH_MAX];
char stdin_target[OMPI_PATH_MAX];
char params[OMPI_PATH_MAX];
orte_job_t *jdata;
orte_app_context_t *app;
@ -686,6 +687,12 @@ static int spawn(int count, char **array_of_commands,
jdata->controls |= ORTE_JOB_CONTROL_NON_ORTE_JOB;
}
/* see if this is an MCA param that the user wants applied to the child job */
ompi_info_get (array_of_info[i], "ompi_param", valuelen, params, &flag);
if ( flag ) {
opal_argv_append_unique_nosize(&app->env, params, true);
}
/* see if user specified what to do with stdin - defaults to
* not forwarding stdin to child processes
*/

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

@ -140,6 +140,10 @@ ompi_non_mpi bool If set to true, launching a non-MPI
this flag when launching a non-MPI
application will cause both the child
and parent jobs to "hang".
ompi_param char * Pass an OMPI MCA parameter to the child job.
If that parameter already exists in the
environment, the value will be overwritten
by the provided value.
.fi
\fIbool\fP info keys are actually strings but are evaluated as

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

@ -151,6 +151,10 @@ ompi_non_mpi bool If set to true, launching a non-MPI
this flag when launching a non-MPI
application will cause both the child
and parent jobs to "hang".
ompi_param char * Pass an OMPI MCA parameter to the child job.
If that parameter already exists in the
environment, the value will be overwritten
by the provided value.
.fi
.sp

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

@ -90,7 +90,7 @@ int opal_argv_append_nosize(char ***argv, const char *arg)
return OPAL_SUCCESS;
}
int opal_argv_append_unique_nosize(char ***argv, const char *arg)
int opal_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite)
{
int i;
@ -104,7 +104,11 @@ int opal_argv_append_unique_nosize(char ***argv, const char *arg)
/* see if this arg is already present in the array */
for (i=0; NULL != (*argv)[i]; i++) {
if (0 == strcmp(arg, (*argv)[i])) {
/* already exists - nothing to do */
/* already exists - are we authorized to overwrite? */
if (overwrite) {
free((*argv)[i]);
(*argv)[i] = strdup(arg);
}
return OPAL_SUCCESS;
}
}

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

@ -91,15 +91,16 @@ OPAL_DECLSPEC int opal_argv_append_nosize(char ***argv, const char *arg);
*
* @param argv Pointer to an argv array.
* @param str Pointer to the string to append.
* @param bool Whether or not to overwrite a matching value if found
*
* @retval OPAL_SUCCESS On success
* @retval OPAL_ERROR On failure
*
* This function is identical to the opal_argv_append_nosize() function
* except that it only appends the provided argument if it does not already
* exist in the provided array.
* exist in the provided array, or overwrites it if it is.
*/
OPAL_DECLSPEC int opal_argv_append_unique_nosize(char ***argv, const char *arg);
OPAL_DECLSPEC int opal_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite);
/**
* Free a NULL-terminated argv array.

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

@ -123,12 +123,12 @@ int orte_ras_base_node_insert(opal_list_t* nodes, orte_job_t *jdata)
/* if the node name is different, store it as an alias */
if (0 != strcmp(node->name, hnp_node->name)) {
/* add to list of aliases for this node - only add if unique */
opal_argv_append_unique_nosize(&hnp_node->alias, node->name);
opal_argv_append_unique_nosize(&hnp_node->alias, node->name, false);
}
if (NULL != node->alias) {
/* now copy over any aliases that are unique */
for (i=0; NULL != node->alias[i]; i++) {
opal_argv_append_unique_nosize(&hnp_node->alias, node->alias[i]);
opal_argv_append_unique_nosize(&hnp_node->alias, node->alias[i], false);
}
}
}

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

@ -117,7 +117,7 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
if (orte_show_resolved_nodenames &&
0 != strcmp(mapped_nodes[i], orte_process_info.nodename)) {
/* add to list of aliases for this node - only add if unique */
opal_argv_append_unique_nosize(&node->alias, mapped_nodes[i]);
opal_argv_append_unique_nosize(&node->alias, mapped_nodes[i], false);
}
node->name = strdup(orte_process_info.nodename);
} else {

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

@ -236,7 +236,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates, opal_list_t* exc
/* do we need to record an alias for this node? */
if (NULL != node_alias) {
/* add to list of aliases for this node - only add if unique */
opal_argv_append_unique_nosize(&node->alias, node_alias);
opal_argv_append_unique_nosize(&node->alias, node_alias, false);
free(node_alias);
}
} else if (ORTE_HOSTFILE_RELATIVE == token) {