diff --git a/config/opal_set_mca_prefix.m4 b/config/opal_set_mca_prefix.m4 new file mode 100644 index 0000000000..f01297f560 --- /dev/null +++ b/config/opal_set_mca_prefix.m4 @@ -0,0 +1,41 @@ +# -*- shell-script -*- +# +# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2014 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# OPAL_SET_MCA_PREFIX([mca_prefix] +# +# This macro sets a prefix for the MCA parameter system. Specifically, +# OMPI_MCA_ becomes _ +# +# -------------------------------------------------------- +AC_DEFUN([OPAL_SET_MCA_PREFIX],[ + AS_IF([test "$opal_mca_prefix_set" = "yes"], + [AC_MSG_WARN([OPAL mca prefix was already set!]) + AC_MSG_WARN([This is a configury programming error]) + AC_MSG_ERROR([Cannot continue])]) + + MCA_PREFIX=$1 + opal_mca_prefix_set=yes + AC_DEFINE_UNQUOTED([OPAL_MCA_PREFIX], ["$MCA_PREFIX"], [MCA prefix string for envars]) +])dnl + +# +# Set the MCA cmd line identifier - i.e., change "-mca" to "-" +# +AC_DEFUN([OPAL_SET_MCA_CMD_LINE_ID],[ + AS_IF([test "$opal_mca_cmd_id_set" = "yes"], + [AC_MSG_WARN([OPAL mca cmd line id was already set!]) + AC_MSG_WARN([This is a configury programming error]) + AC_MSG_ERROR([Cannot continue])]) + + MCA_CMD_LINE_ID=$1 + opal_mca_cmd_id_set=yes + AC_DEFINE_UNQUOTED([OPAL_MCA_CMD_LINE_ID], ["$MCA_CMD_LINE_ID"], [MCA cmd line identifier]) +])dnl diff --git a/configure.ac b/configure.ac index 1a539ff374..5d1689c4fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1408,6 +1408,8 @@ AC_SUBST(opallibdir) AC_SUBST(opalincludedir) OPAL_SET_LIB_PREFIX([]) +OPAL_SET_MCA_PREFIX([OMPI_MCA_]) +OPAL_SET_MCA_CMD_LINE_ID([mca]) m4_ifdef([project_orte], [ortedatadir="$opaldatadir" AC_SUBST(ortedatadir) diff --git a/opal/mca/base/mca_base_cmd_line.c b/opal/mca/base/mca_base_cmd_line.c index fe8f35f7e8..bded8a1bf4 100644 --- a/opal/mca/base/mca_base_cmd_line.c +++ b/opal/mca/base/mca_base_cmd_line.c @@ -49,13 +49,13 @@ int mca_base_cmd_line_setup(opal_cmd_line_t *cmd) { int ret = OPAL_SUCCESS; - ret = opal_cmd_line_make_opt3(cmd, '\0', "mca", "mca", 2, - "Pass context-specific MCA parameters; they are considered global if --gmca is not used and only one context is specified (arg0 is the parameter name; arg1 is the parameter value)"); + ret = opal_cmd_line_make_opt3(cmd, '\0', OPAL_MCA_CMD_LINE_ID, OPAL_MCA_CMD_LINE_ID, 2, + "Pass context-specific MCA parameters; they are considered global if --g"OPAL_MCA_CMD_LINE_ID" is not used and only one context is specified (arg0 is the parameter name; arg1 is the parameter value)"); if (OPAL_SUCCESS != ret) { return ret; } - ret = opal_cmd_line_make_opt3(cmd, '\0', "gmca", "gmca", 2, + ret = opal_cmd_line_make_opt3(cmd, '\0', "g"OPAL_MCA_CMD_LINE_ID, "g"OPAL_MCA_CMD_LINE_ID, 2, "Pass global MCA parameters that are applicable to all contexts (arg0 is the parameter name; arg1 is the parameter value)"); if (OPAL_SUCCESS != ret) { @@ -90,18 +90,18 @@ int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd, /* If no relevant parameters were given, just return */ - if (!opal_cmd_line_is_taken(cmd, "mca") && - !opal_cmd_line_is_taken(cmd, "gmca")) { + if (!opal_cmd_line_is_taken(cmd, OPAL_MCA_CMD_LINE_ID) && + !opal_cmd_line_is_taken(cmd, "g"OPAL_MCA_CMD_LINE_ID)) { return OPAL_SUCCESS; } /* Handle app context-specific parameters */ - num_insts = opal_cmd_line_get_ninsts(cmd, "mca"); + num_insts = opal_cmd_line_get_ninsts(cmd, OPAL_MCA_CMD_LINE_ID); params = values = NULL; for (i = 0; i < num_insts; ++i) { - if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, "mca", i, 0), - opal_cmd_line_get_param(cmd, "mca", i, 1), + if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, OPAL_MCA_CMD_LINE_ID, i, 0), + opal_cmd_line_get_param(cmd, OPAL_MCA_CMD_LINE_ID, i, 1), ¶ms, &values))) { return rc; } @@ -114,11 +114,11 @@ int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd, /* Handle global parameters */ - num_insts = opal_cmd_line_get_ninsts(cmd, "gmca"); + num_insts = opal_cmd_line_get_ninsts(cmd, "g"OPAL_MCA_CMD_LINE_ID); params = values = NULL; for (i = 0; i < num_insts; ++i) { - if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, "gmca", i, 0), - opal_cmd_line_get_param(cmd, "gmca", i, 1), + if (OPAL_SUCCESS != (rc = process_arg(opal_cmd_line_get_param(cmd, "g"OPAL_MCA_CMD_LINE_ID, i, 0), + opal_cmd_line_get_param(cmd, "g"OPAL_MCA_CMD_LINE_ID, i, 1), ¶ms, &values))) { return rc; } @@ -191,7 +191,7 @@ static void add_to_env(char **params, char **values, char ***env) char *name; /* Loop through all the args that we've gotten and make env - vars of the form OMPI_MCA_*=value. */ + vars of the form OPAL_MCA_PREFIX*=value. */ for (i = 0; NULL != params && NULL != params[i]; ++i) { (void) mca_base_var_env_name (params[i], &name); @@ -206,8 +206,8 @@ void mca_base_cmd_line_wrap_args(char **args) char *tstr; for (i=0; NULL != args && NULL != args[i]; i++) { - if (0 == strcmp(args[i], "-mca") || - 0 == strcmp(args[i], "--mca")) { + if (0 == strcmp(args[i], "-"OPAL_MCA_CMD_LINE_ID) || + 0 == strcmp(args[i], "--"OPAL_MCA_CMD_LINE_ID)) { if (NULL == args[i+1] || NULL == args[i+2]) { /* this should be impossible as the error would * have been detected well before here, but just diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index d8665385b1..e63457d9a6 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -52,7 +52,7 @@ * local variables */ static opal_pointer_array_t mca_base_vars; -static const char *mca_prefix = "OMPI_MCA_"; +static const char *mca_prefix = OPAL_MCA_PREFIX; static char *home = NULL; static char *cwd = NULL; bool mca_base_var_initialized = false; diff --git a/opal/mca/memory/linux/hooks.c b/opal/mca/memory/linux/hooks.c index f85918e91b..03d9a095b1 100644 --- a/opal/mca/memory/linux/hooks.c +++ b/opal/mca/memory/linux/hooks.c @@ -780,12 +780,12 @@ void opal_memory_linux_malloc_init_hook(void) (unfortunately, there's really no good way to do this other than this abstraction violation :-( ) */ lp = check("OPAL_MCA_leave_pinned"); - if( RESULT_NOT_FOUND == lp ) lp = check("OMPI_MCA_mpi_leave_pinned"); + if( RESULT_NOT_FOUND == lp ) lp = check(OPAL_MCA_PREFIX"mpi_leave_pinned"); lpp = check("OPAL_MCA_leave_pinned_pipeline"); - if( RESULT_NOT_FOUND == lpp ) lpp = check("OMPI_MCA_mpi_leave_pinned_pipeline"); + if( RESULT_NOT_FOUND == lpp ) lpp = check(OPAL_MCA_PREFIX"mpi_leave_pinned_pipeline"); /* See if we want to disable this component. */ - r1 = check("OMPI_MCA_memory_linux_disable"); + r1 = check(OPAL_MCA_PREFIX"memory_linux_disable"); if (RESULT_NOT_FOUND != r1 && RESULT_NO != r1) { return; } diff --git a/orte/mca/ess/base/ess_base_fns.c b/orte/mca/ess/base/ess_base_fns.c index 0eb6fce482..0928f60c08 100644 --- a/orte/mca/ess/base/ess_base_fns.c +++ b/orte/mca/ess/base/ess_base_fns.c @@ -57,9 +57,9 @@ int orte_ess_base_proc_binding(void) opal_value_t kv; /* Determine if we were pre-bound or not */ - if (NULL != getenv("OMPI_MCA_orte_bound_at_launch")) { + if (NULL != getenv(OPAL_MCA_PREFIX"orte_bound_at_launch")) { orte_proc_is_bound = true; - if (NULL != (map = getenv("OMPI_MCA_orte_base_applied_binding"))) { + if (NULL != (map = getenv(OPAL_MCA_PREFIX"orte_base_applied_binding"))) { orte_proc_applied_binding = hwloc_bitmap_alloc(); if (0 != (ret = hwloc_bitmap_list_sscanf(orte_proc_applied_binding, map))) { error = "applied_binding parse"; diff --git a/orte/mca/ess/pmi/ess_pmi_module.c b/orte/mca/ess/pmi/ess_pmi_module.c index 129bf668ba..a4e5b51d50 100644 --- a/orte/mca/ess/pmi/ess_pmi_module.c +++ b/orte/mca/ess/pmi/ess_pmi_module.c @@ -212,7 +212,7 @@ static int rte_init(void) /* push into the environ for pickup in MPI layer for * MPI-3 required info key */ - asprintf(&ev1, "OMPI_MCA_orte_ess_num_procs=%d", orte_process_info.num_procs); + asprintf(&ev1, OPAL_MCA_PREFIX"orte_ess_num_procs=%d", orte_process_info.num_procs); putenv(ev1); asprintf(&ev2, "OMPI_APP_CTX_NUM_PROCS=%d", orte_process_info.num_procs); putenv(ev2); @@ -401,9 +401,9 @@ static int rte_finalize(void) /* remove the envars that we pushed into environ * so we leave that structure intact */ - unsetenv("OMPI_MCA_routed"); - unsetenv("OMPI_MCA_orte_precondition_transports"); - unsetenv("OMPI_MCA_orte_ess_num_procs"); + unsetenv(OPAL_MCA_PREFIX"routed"); + unsetenv(OPAL_MCA_PREFIX"orte_precondition_transports"); + unsetenv(OPAL_MCA_PREFIX"orte_ess_num_procs"); unsetenv("OMPI_APP_CTX_NUM_PROCS"); /* use the default app procedure to finish */ if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { diff --git a/orte/mca/ess/singleton/ess_singleton_module.c b/orte/mca/ess/singleton/ess_singleton_module.c index 0b993cac92..0469fef569 100644 --- a/orte/mca/ess/singleton/ess_singleton_module.c +++ b/orte/mca/ess/singleton/ess_singleton_module.c @@ -129,7 +129,7 @@ static int rte_init(void) /* save the daemon uri - we will process it later */ orte_process_info.my_daemon_uri = strdup(orte_process_info.my_hnp_uri); /* for convenience, push the pubsub version of this param into the environ */ - asprintf(¶m,"OMPI_MCA_pubsub_orte_server=%s",orte_process_info.my_hnp_uri); + asprintf(¶m,OPAL_MCA_PREFIX"pubsub_orte_server=%s",orte_process_info.my_hnp_uri); putenv(param); } @@ -202,7 +202,7 @@ static int rte_init(void) putenv("OMPI_NUM_APP_CTX=1"); putenv("OMPI_FIRST_RANKS=0"); putenv("OMPI_APP_CTX_NUM_PROCS=1"); - putenv("OMPI_MCA_orte_ess_num_procs=1"); + putenv(OPAL_MCA_PREFIX"orte_ess_num_procs=1"); /* push some required info to our local datastore */ OBJ_CONSTRUCT(&kvn, opal_value_t); @@ -271,8 +271,8 @@ static int rte_finalize(void) unsetenv("OMPI_NUM_APP_CTX"); unsetenv("OMPI_FIRST_RANKS"); unsetenv("OMPI_APP_CTX_NUM_PROCS"); - unsetenv("OMPI_MCA_orte_ess_num_procs"); - unsetenv("OMPI_MCA_pubsub_orte_server"); // just in case it is there + unsetenv(OPAL_MCA_PREFIX"orte_ess_num_procs"); + unsetenv(OPAL_MCA_PREFIX"pubsub_orte_server"); // just in case it is there return ret; } diff --git a/orte/mca/ess/tm/ess_tm_module.c b/orte/mca/ess/tm/ess_tm_module.c index 8bc1860491..3fdb4195db 100644 --- a/orte/mca/ess/tm/ess_tm_module.c +++ b/orte/mca/ess/tm/ess_tm_module.c @@ -84,7 +84,7 @@ static int rte_init(void) */ if (ORTE_PROC_IS_DAEMON) { /* get the list of nodes used for this job */ - nodelist = getenv("OMPI_MCA_orte_nodelist"); + nodelist = getenv(OPAL_MCA_PREFIX"orte_nodelist"); if (NULL != nodelist) { /* split the node list into an argv array */ diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index c310fae159..fcaa6149fe 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -751,7 +751,7 @@ static int setup_child(orte_proc_t *child, */ opal_setenv("PWD", param, true, env); /* update the initial wdir value too */ - opal_setenv("OMPI_MCA_initial_wdir", param, true, env); + opal_setenv(OPAL_MCA_PREFIX"initial_wdir", param, true, env); } free(param); return ORTE_SUCCESS; @@ -791,7 +791,7 @@ static int setup_path(orte_app_context_t *app) getcwd(dir, sizeof(dir)); opal_setenv("PWD", dir, true, &app->env); /* update the initial wdir value too */ - opal_setenv("OMPI_MCA_initial_wdir", dir, true, &app->env); + opal_setenv(OPAL_MCA_PREFIX"initial_wdir", dir, true, &app->env); } /* Search for the OMPI_exec_path and PATH settings in the environment. */ diff --git a/orte/mca/plm/base/plm_base_launch_support.c b/orte/mca/plm/base/plm_base_launch_support.c index 6002fb0060..911e8996e6 100644 --- a/orte/mca/plm/base/plm_base_launch_support.c +++ b/orte/mca/plm/base/plm_base_launch_support.c @@ -1073,22 +1073,22 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv, /* check for debug flags */ if (orte_debug_flag) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_debug"); opal_argv_append(argc, argv, "1"); } if (orte_debug_daemons_flag) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_debug_daemons"); opal_argv_append(argc, argv, "1"); } if (orte_debug_daemons_file_flag) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_debug_daemons_file"); opal_argv_append(argc, argv, "1"); } if (orte_leave_session_attached) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_leave_session_attached"); opal_argv_append(argc, argv, "1"); } @@ -1098,12 +1098,12 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv, } #if OPAL_HAVE_HWLOC if (opal_hwloc_report_bindings) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_report_bindings"); opal_argv_append(argc, argv, "1"); } if (orte_hetero_nodes) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_hetero_nodes"); opal_argv_append(argc, argv, "1"); } @@ -1112,7 +1112,7 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv, opal_argv_append(argc, argv, "--mapreduce"); } if (orte_map_stddiag_to_stderr) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_map_stddiag_to_stderr"); opal_argv_append(argc, argv, "1"); } @@ -1133,13 +1133,13 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv, /* tell the orted what ESS component to use */ if (NULL != ess) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "ess"); opal_argv_append(argc, argv, ess); } /* pass the daemon jobid */ - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_ess_jobid"); if (ORTE_SUCCESS != (rc = orte_util_convert_jobid_to_string(¶m, ORTE_PROC_MY_NAME->jobid))) { ORTE_ERROR_LOG(rc); @@ -1150,7 +1150,7 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv, /* setup to pass the vpid */ if (NULL != proc_vpid_index) { - opal_argv_append(argc, argv, "-mca"); + opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "orte_ess_vpid"); *proc_vpid_index = *argc; opal_argv_append(argc, argv, "