1
1

Fix the --tune problem by searching the argv for MCA params in advance of opal_init_util. Only search the first app_context as we historically have done - we can debate whether or not to search all app_contexts

Этот коммит содержится в:
Ralph Castain 2016-05-23 21:09:44 -07:00
родитель a651f26701
Коммит 80f4e3b872
4 изменённых файлов: 80 добавлений и 75 удалений

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

@ -334,6 +334,13 @@ opal_init_util(int* pargc, char*** pargv)
goto return_error; goto return_error;
} }
/* read any param files that were provided */
if (OPAL_SUCCESS != (ret = mca_base_var_cache_files(false))) {
error = "failed to cache files";
goto return_error;
}
/* register params for opal */ /* register params for opal */
if (OPAL_SUCCESS != (ret = opal_register_params())) { if (OPAL_SUCCESS != (ret = opal_register_params())) {
error = "opal_register_params"; error = "opal_register_params";
@ -415,13 +422,6 @@ opal_init(int* pargc, char*** pargv)
return ret; return ret;
} }
/* read any param files that were provided */
if (OPAL_SUCCESS != (ret = mca_base_var_cache_files(false))) {
error = "failed to cache files";
goto return_error;
}
/* open hwloc - since this is a static framework, no /* open hwloc - since this is a static framework, no
* select is required * select is required
*/ */

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

@ -118,11 +118,11 @@ ffi.set_source("orte_cffi", """
ffi.cdef(""" ffi.cdef("""
/* Types */ /* Types */
typedef ... orte_job_t; typedef ... orte_job_t;
typedef ... opal_cmd_line_t; typedef ... opal_cmd_line_init_t;
typedef void (*orte_submit_cbfunc_t)(int index, orte_job_t *jdata, int ret, void *cbdata); typedef void (*orte_submit_cbfunc_t)(int index, orte_job_t *jdata, int ret, void *cbdata);
/* Functions */ /* Functions */
int orte_submit_init(int argc, char *argv[], opal_cmd_line_t *opts); int orte_submit_init(int argc, char *argv[], opal_cmd_line_init_t *opts);
int orte_submit_job(char *cmd[], int *index, int orte_submit_job(char *cmd[], int *index,
orte_submit_cbfunc_t launch_cb, void *launch_cbdata, orte_submit_cbfunc_t launch_cb, void *launch_cbdata,
orte_submit_cbfunc_t complete_cb, void *complete_cbdata); orte_submit_cbfunc_t complete_cb, void *complete_cbdata);

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

@ -199,7 +199,7 @@ static OBJ_CLASS_INSTANCE(trackr_t,
tcon, tdes); tcon, tdes);
int orte_submit_init(int argc, char *argv[], int orte_submit_init(int argc, char *argv[],
opal_cmd_line_t *opts) opal_cmd_line_init_t *opts)
{ {
int rc, i; int rc, i;
char *param; char *param;
@ -211,51 +211,32 @@ int orte_submit_init(int argc, char *argv[],
use it in pretty-print error messages */ use it in pretty-print error messages */
orte_basename = opal_basename(argv[0]); orte_basename = opal_basename(argv[0]);
/* see if print version is requested. Do this before /* search the argv for MCA params */
* check for help so that --version --help works as for (i=0; NULL != argv[i]; i++) {
* one might expect. */ if (':' == argv[i][0] ||
for (i=0; NULL != argv[i]; i++) { NULL == argv[i+1] || NULL == argv[i+2]) {
if (0 == strcmp(argv[i], "--version") || break;
0 == strcmp(argv[i], "-V")) { }
char *str, *project_name = NULL; if (0 == strncmp(argv[i], "-"OPAL_MCA_CMD_LINE_ID, strlen("-"OPAL_MCA_CMD_LINE_ID)) ||
if (0 == strcmp(orte_basename, "mpirun")) { 0 == strncmp(argv[i], "--"OPAL_MCA_CMD_LINE_ID, strlen("--"OPAL_MCA_CMD_LINE_ID)) ||
project_name = "Open MPI"; 0 == strncmp(argv[i], "-g"OPAL_MCA_CMD_LINE_ID, strlen("-g"OPAL_MCA_CMD_LINE_ID)) ||
} else { 0 == strncmp(argv[i], "--g"OPAL_MCA_CMD_LINE_ID, strlen("--g"OPAL_MCA_CMD_LINE_ID))) {
project_name = "OpenRTE"; (void) mca_base_var_env_name (argv[i+1], &param);
} opal_setenv(param, argv[i+2], true, &environ);
str = opal_info_make_version_str("all", free(param);
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, } else if (0 == strcmp(argv[i], "-am") ||
OPAL_RELEASE_VERSION, 0 == strcmp(argv[i], "--am")) {
OPAL_GREEK_VERSION, (void)mca_base_var_env_name("mca_base_param_file_prefix", &param);
OPAL_REPO_REV); opal_setenv(param, argv[i+1], true, &environ);
if (NULL != str) { free(param);
fprintf(stdout, "%s (%s) %s\n\nReport bugs to %s\n", } else if (0 == strcmp(argv[i], "-tune") ||
orte_basename, project_name, str, PACKAGE_BUGREPORT); 0 == strcmp(argv[i], "--tune")) {
free(str); (void)mca_base_var_env_name("mca_base_envar_file_prefix", &param);
} opal_setenv(param, argv[i+1], true, &environ);
exit(0); free(param);
} }
} }
/* need to parse mca options *before* opal_init_util() */
orte_cmd_line = OBJ_NEW(opal_cmd_line_t);
mca_base_cmd_line_setup (orte_cmd_line);
/* parse the result to get values */
if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(orte_cmd_line,
true, true, argc, argv)) ) {
if (OPAL_ERR_SILENT != rc) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(rc));
}
return rc;
}
if (OPAL_SUCCESS != (rc = mca_base_cmd_line_process_args(orte_cmd_line, &environ, &environ))) {
return rc;
}
/* init only the util portion of OPAL */ /* init only the util portion of OPAL */
if (OPAL_SUCCESS != (rc = opal_init_util(&argc, &argv))) { if (OPAL_SUCCESS != (rc = opal_init_util(&argc, &argv))) {
return rc; return rc;
@ -273,6 +254,10 @@ int orte_submit_init(int argc, char *argv[],
OBJ_CONSTRUCT(&tool_jobs, opal_pointer_array_t); OBJ_CONSTRUCT(&tool_jobs, opal_pointer_array_t);
opal_pointer_array_init(&tool_jobs, 256, INT_MAX, 128); opal_pointer_array_init(&tool_jobs, 256, INT_MAX, 128);
/* setup the cmd line */
orte_cmd_line = OBJ_NEW(opal_cmd_line_t);
/* if they were provided, add the opts */ /* if they were provided, add the opts */
if (NULL != opts) { if (NULL != opts) {
if (OPAL_SUCCESS != (rc = opal_cmd_line_add(orte_cmd_line, opts))) { if (OPAL_SUCCESS != (rc = opal_cmd_line_add(orte_cmd_line, opts))) {
@ -298,6 +283,29 @@ int orte_submit_init(int argc, char *argv[],
return rc; return rc;
} }
/* see if print version is requested. Do this before
* check for help so that --version --help works as
* one might expect. */
if (orte_cmd_options.version) {
char *str, *project_name = NULL;
if (0 == strcmp(orte_basename, "mpirun")) {
project_name = "Open MPI";
} else {
project_name = "OpenRTE";
}
str = opal_info_make_version_str("all",
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
OPAL_GREEK_VERSION,
OPAL_REPO_REV);
if (NULL != str) {
fprintf(stdout, "%s (%s) %s\n\nReport bugs to %s\n",
orte_basename, project_name, str, PACKAGE_BUGREPORT);
free(str);
}
exit(0);
}
/* check if we are running as root - if we are, then only allow /* check if we are running as root - if we are, then only allow
* us to proceed if the allow-run-as-root flag was given. Otherwise, * us to proceed if the allow-run-as-root flag was given. Otherwise,
* exit with a giant warning flag * exit with a giant warning flag
@ -332,29 +340,26 @@ int orte_submit_init(int argc, char *argv[],
} }
/* Check for help request */ /* Check for help request */
for (i=0; NULL != argv[i]; i++) { if (orte_cmd_options.help) {
if (0 == strcmp(argv[i], "--help") || char *str, *args = NULL;
0 == strcmp(argv[i], "-h")) { char *project_name = NULL;
char *str, *args = NULL; if (0 == strcmp(orte_basename, "mpirun")) {
char *project_name = NULL; project_name = "Open MPI";
if (0 == strcmp(orte_basename, "mpirun")) { } else {
project_name = "Open MPI"; project_name = "OpenRTE";
} else {
project_name = "OpenRTE";
}
args = opal_cmd_line_get_usage_msg(orte_cmd_line);
str = opal_show_help_string("help-orterun.txt", "orterun:usage", false,
orte_basename, project_name, OPAL_VERSION,
orte_basename, args,
PACKAGE_BUGREPORT);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If someone asks for help, that should be all we do */
exit(0);
} }
args = opal_cmd_line_get_usage_msg(orte_cmd_line);
str = opal_show_help_string("help-orterun.txt", "orterun:usage", false,
orte_basename, project_name, OPAL_VERSION,
orte_basename, args,
PACKAGE_BUGREPORT);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If someone asks for help, that should be all we do */
exit(0);
} }
/* set the flags - if they gave us a -hnp option, then /* set the flags - if they gave us a -hnp option, then

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

@ -23,7 +23,7 @@ BEGIN_C_DECLS
typedef void (*orte_submit_cbfunc_t)(int index, orte_job_t *jdata, int ret, void *cbdata); typedef void (*orte_submit_cbfunc_t)(int index, orte_job_t *jdata, int ret, void *cbdata);
ORTE_DECLSPEC int orte_submit_init(int argc, char *argv[], ORTE_DECLSPEC int orte_submit_init(int argc, char *argv[],
opal_cmd_line_t *opts); opal_cmd_line_init_t *opts);
ORTE_DECLSPEC int orte_submit_cancel(int index); ORTE_DECLSPEC int orte_submit_cancel(int index);
ORTE_DECLSPEC void orte_submit_finalize(void); ORTE_DECLSPEC void orte_submit_finalize(void);
ORTE_DECLSPEC int orte_submit_job(char *cmd[], int *index, ORTE_DECLSPEC int orte_submit_job(char *cmd[], int *index,