Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions opal/runtime/opal_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
*/
Expand Down
41 changes: 24 additions & 17 deletions opal/util/cmd_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -977,12 +990,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;
}

Expand Down Expand Up @@ -1158,7 +1169,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
Expand All @@ -1176,17 +1186,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 */
Expand Down
4 changes: 2 additions & 2 deletions orte/bindings/python/src/orte-cffi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions orte/orted/orted_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) ) {
Expand Down
2 changes: 1 addition & 1 deletion orte/orted/orted_submit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down