From b732e71889ccd7d396515ff98691a9501b7e0a2b Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 21 May 2016 07:06:43 -0700 Subject: [PATCH 1/3] Make another attempt Maintain the python bindings Only call cmd_line_setup once as those params will persist Temporarily disable the AMCA option --- opal/mca/base/mca_base_var.c | 11 +++++++++++ opal/runtime/opal_init.c | 13 ++++++------- opal/util/cmd_line.c | 2 -- orte/bindings/python/src/orte-cffi/build.py | 4 ++-- orte/orted/orted_submit.c | 5 +---- orte/orted/orted_submit.h | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index 5322433a432..7493db6855d 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -513,6 +513,17 @@ int mca_base_var_cache_files(bool rel_path_search) } } + /*** TEMPORARY SETTING - AMCA PARAM FILES ARE CURRENTLY NOT OPERATIONAL + * PENDING IDENTIFICATION OF A MAINTAINER + ***/ + if (NULL != mca_base_var_file_prefix || + NULL != mca_base_envar_file_prefix || + NULL != mca_base_param_file_path) { + opal_output(0, "The AMCA parameter file options are not operational at this time"); + opal_output(0, "pending identification of a maintainer. Please list your options"); + opal_output(0, "manually on the command line or in your environment"); + return OPAL_ERR_SILENT; + } if (NULL != mca_base_var_file_prefix) { resolve_relative_paths(&mca_base_var_file_prefix, mca_base_param_file_path, rel_path_search, &mca_base_var_files, OPAL_ENV_SEP); } diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index a6f97990a8f..90f0d3c4c3d 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -334,6 +334,12 @@ opal_init_util(int* pargc, char*** pargv) 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 */ if (OPAL_SUCCESS != (ret = opal_register_params())) { error = "opal_register_params"; @@ -415,13 +421,6 @@ opal_init(int* pargc, char*** pargv) 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 * select is required */ diff --git a/opal/util/cmd_line.c b/opal/util/cmd_line.c index bac3430344c..e4ffa8f4512 100644 --- a/opal/util/cmd_line.c +++ b/opal/util/cmd_line.c @@ -977,12 +977,10 @@ static int make_opt(opal_cmd_line_t *cmd, opal_cmd_line_init_t *e) /* see if the option already exists */ if (NULL != e->ocl_cmd_single_dash_name && NULL != find_option(cmd, e->ocl_cmd_single_dash_name)) { - opal_output(0, "Duplicate cmd line entry %s", e->ocl_cmd_single_dash_name); return OPAL_ERR_BAD_PARAM; } if (NULL != e->ocl_cmd_long_name && NULL != find_option(cmd, e->ocl_cmd_long_name)) { - opal_output(0, "Duplicate cmd line entry %s", e->ocl_cmd_long_name); return OPAL_ERR_BAD_PARAM; } diff --git a/orte/bindings/python/src/orte-cffi/build.py b/orte/bindings/python/src/orte-cffi/build.py index 18dfd6cdf73..64bd0e33cde 100644 --- a/orte/bindings/python/src/orte-cffi/build.py +++ b/orte/bindings/python/src/orte-cffi/build.py @@ -118,11 +118,11 @@ def pkgconfig(libname, variables=None): ffi.cdef(""" /* Types */ 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); /* 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, orte_submit_cbfunc_t launch_cb, void *launch_cbdata, orte_submit_cbfunc_t complete_cb, void *complete_cbdata); diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index 41d3bf1d161..a833b92a0c2 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -199,7 +199,7 @@ static OBJ_CLASS_INSTANCE(trackr_t, tcon, tdes); int orte_submit_init(int argc, char *argv[], - opal_cmd_line_t *opts) + opal_cmd_line_init_t *opts) { int rc, i; char *param; @@ -285,9 +285,6 @@ int orte_submit_init(int argc, char *argv[], return rc; } - /* now that options have been defined, finish setup */ - 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, false, argc, argv)) ) { diff --git a/orte/orted/orted_submit.h b/orte/orted/orted_submit.h index 1daf1b0ecb0..f26b14aa9b0 100644 --- a/orte/orted/orted_submit.h +++ b/orte/orted/orted_submit.h @@ -23,7 +23,7 @@ BEGIN_C_DECLS 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[], - opal_cmd_line_t *opts); + opal_cmd_line_init_t *opts); ORTE_DECLSPEC int orte_submit_cancel(int index); ORTE_DECLSPEC void orte_submit_finalize(void); ORTE_DECLSPEC int orte_submit_job(char *cmd[], int *index, From eaf82f1e36ae81eeb1ec89321fe2b7bd3252595a Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 23 May 2016 11:31:55 -0600 Subject: [PATCH 2/3] opal/cmd_line: enable complete command line parsing This commit changes the command line parsing behavior when ignoring both unknown switches and tokens. In this case we are probably trying to parse part of the command line (-mca, -am, -tune) before the rest. Before this change the command line parser stopped on the first unknown switch or token. Now it will continue to parse out options. This includes options to the app being run by mpirun (unless -- is specified) but since only -mca, -tune, and -am are affected this probably is not a big deal. This change only affects the parsing of command-line MCA parameters in orte-submit, all other parsers are unchanged. Signed-off-by: Nathan Hjelm --- opal/util/cmd_line.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/opal/util/cmd_line.c b/opal/util/cmd_line.c index bac3430344c..64b7cfd6ed7 100644 --- a/opal/util/cmd_line.c +++ b/opal/util/cmd_line.c @@ -35,11 +35,11 @@ #include "opal/util/argv.h" #include "opal/util/cmd_line.h" #include "opal/util/output.h" +#include "opal/util/opal_environ.h" #include "opal/mca/base/mca_base_var.h" #include "opal/constants.h" - /* * Some usage message constants * @@ -440,7 +440,6 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u /* If it's the first, save it in the variable dest and/or MCA parameter */ - if (0 == j && (NULL != option->clo_mca_param_env_var || NULL != option->clo_variable_dest)) { @@ -485,15 +484,29 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u fprintf(stderr, "Type '%s --help' for usage.\n", cmd->lcl_argv[0]); } - } error: - while (i < cmd->lcl_argc) { - opal_argv_append(&cmd->lcl_tail_argc, &cmd->lcl_tail_argv, - cmd->lcl_argv[i]); - ++i; - } + while (i < cmd->lcl_argc) { + opal_argv_append(&cmd->lcl_tail_argc, &cmd->lcl_tail_argv, + cmd->lcl_argv[i]); + ++i; + } - /* Because i has advanced, we'll fall out of the loop */ + /* Because i has advanced, we'll fall out of the loop */ + } else { + while (i < cmd->lcl_argc) { + opal_argv_append(&cmd->lcl_tail_argc, &cmd->lcl_tail_argv, + cmd->lcl_argv[i]); + ++i; + if (i == cmd->lcl_argc) { + break; + } + if (cmd->lcl_argv[i][0] == '-') { + /* found next option */ + break; + } + } + is_unknown_option = is_unknown_token = false; + } } } @@ -1158,7 +1171,6 @@ static int set_dest(cmd_line_option_t *option, char *sval) { int ival = atol(sval); long lval = strtoul(sval, NULL, 10); - char *str = NULL; size_t i; /* Set MCA param. We do this in the environment because the MCA @@ -1176,17 +1188,14 @@ static int set_dest(cmd_line_option_t *option, char *sval) case OPAL_CMD_LINE_TYPE_STRING: case OPAL_CMD_LINE_TYPE_INT: case OPAL_CMD_LINE_TYPE_SIZE_T: - asprintf(&str, "%s=%s", option->clo_mca_param_env_var, sval); + opal_setenv (option->clo_mca_param_env_var, sval, true, &environ); break; case OPAL_CMD_LINE_TYPE_BOOL: - asprintf(&str, "%s=1", option->clo_mca_param_env_var); + opal_setenv (option->clo_mca_param_env_var, "1", true, &environ); break; default: break; } - if (NULL != str) { - putenv(str); - } } /* Set variable */ From b77c9cdafd9c77395a9692c9562a26800d7e8296 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 23 May 2016 12:55:00 -0700 Subject: [PATCH 3/3] Remove amca protection --- opal/mca/base/mca_base_var.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index 7493db6855d..5322433a432 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -513,17 +513,6 @@ int mca_base_var_cache_files(bool rel_path_search) } } - /*** TEMPORARY SETTING - AMCA PARAM FILES ARE CURRENTLY NOT OPERATIONAL - * PENDING IDENTIFICATION OF A MAINTAINER - ***/ - if (NULL != mca_base_var_file_prefix || - NULL != mca_base_envar_file_prefix || - NULL != mca_base_param_file_path) { - opal_output(0, "The AMCA parameter file options are not operational at this time"); - opal_output(0, "pending identification of a maintainer. Please list your options"); - opal_output(0, "manually on the command line or in your environment"); - return OPAL_ERR_SILENT; - } if (NULL != mca_base_var_file_prefix) { resolve_relative_paths(&mca_base_var_file_prefix, mca_base_param_file_path, rel_path_search, &mca_base_var_files, OPAL_ENV_SEP); }