[mpich2-commits] r8021 - in mpich2/trunk/src/pm/hydra: include pm/pmiserv tools/bootstrap/persist tools/nameserver ui/mpich utils/args
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Tue Feb 22 22:35:58 CST 2011
Author: balaji
Date: 2011-02-22 22:35:58 -0600 (Tue, 22 Feb 2011)
New Revision: 8021
Modified:
mpich2/trunk/src/pm/hydra/include/hydra.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_utils.c
mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c
mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c
mpich2/trunk/src/pm/hydra/ui/mpich/utils.c
mpich2/trunk/src/pm/hydra/utils/args/args.c
Log:
A config file option to mpiexec is now only considered as the default
set of argument values. If the user passes any command-line arguments,
they override the config file arguments.
This commit also restructures a lot of code for parsing through the
arguments to deal with the config file setup.
No reviewer.
Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h 2011-02-23 04:35:58 UTC (rev 8021)
@@ -438,10 +438,8 @@
/* args */
HYD_status HYDU_find_in_path(const char *execname, char **path);
HYD_status HYDU_parse_array(char ***argv, struct HYD_arg_match_table *match_table);
-HYD_status HYDU_set_str(char *arg, char ***argv, char **var, const char *val);
-HYD_status HYDU_set_str_and_incr(char *arg, char ***argv, char **var);
-HYD_status HYDU_set_int(char *arg, char ***argv, int *var, int val);
-HYD_status HYDU_set_int_and_incr(char *arg, char ***argv, int *var);
+HYD_status HYDU_set_str(char *arg, char **var, const char *val);
+HYD_status HYDU_set_int(char *arg, int *var, int val);
char *HYDU_getcwd(void);
HYD_status HYDU_process_mfile_token(char *token, int newline, struct HYD_node **node_list);
HYD_status HYDU_parse_hostfile(const char *hostfile, struct HYD_node **node_list,
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_utils.c 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmip_utils.c 2011-02-23 04:35:58 UTC (rev 8021)
@@ -57,62 +57,128 @@
static HYD_status proxy_id_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.local.id);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.id, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status pgid_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.local.pgid);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.pgid, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status debug_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYD_pmcd_pmip.user_global.debug, 1);
+ return HYDU_set_int(arg, &HYD_pmcd_pmip.user_global.debug, 1);
}
static HYD_status rmk_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.rmk);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.rmk, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status launcher_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.launcher);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.launcher, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status launcher_exec_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.launcher_exec);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.launcher_exec, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status demux_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.demux);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.demux, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status iface_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.iface);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.iface, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status auto_cleanup_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.auto_cleanup);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.user_global.auto_cleanup, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status pmi_port_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.system_global.pmi_port);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.system_global.pmi_port, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status pmi_fd_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.system_global.pmi_fd);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.system_global.pmi_fd, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status pmi_rank_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.system_global.pmi_rank);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.system_global.pmi_rank, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status pmi_kvsname_fn(char *arg, char ***argv)
@@ -141,32 +207,68 @@
static HYD_status pmi_process_mapping_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.system_global.pmi_process_mapping);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.system_global.pmi_process_mapping, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status binding_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.binding);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.binding, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status bindlib_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.bindlib);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.bindlib, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status ckpointlib_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.ckpointlib);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.ckpointlib, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status ckpoint_num_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.ckpoint_num);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.user_global.ckpoint_num, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status ckpoint_prefix_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.ckpoint_prefix);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.ckpoint_prefix, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status global_env_fn(char *arg, char ***argv)
@@ -205,7 +307,13 @@
static HYD_status genv_prop_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.user_global.global_env.prop);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.user_global.global_env.prop, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status split_map(char *map, int *left, int *current, int *right)
@@ -293,7 +401,14 @@
static HYD_status global_process_count_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.system_global.global_process_count);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.system_global.global_process_count,
+ atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status version_fn(char *arg, char ***argv)
@@ -316,22 +431,46 @@
static HYD_status interface_env_name_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.local.interface_env_name);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.local.interface_env_name, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status hostname_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.local.hostname);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.local.hostname, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status local_binding_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_pmcd_pmip.local.local_binding);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &HYD_pmcd_pmip.local.local_binding, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status proxy_core_count_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_pmcd_pmip.local.proxy_core_count);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYD_pmcd_pmip.local.proxy_core_count, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status exec_fn(char *arg, char ***argv)
@@ -360,17 +499,27 @@
static HYD_status exec_appnum_fn(char *arg, char ***argv)
{
struct HYD_exec *exec = NULL;
+ HYD_status status = HYD_SUCCESS;
for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
- return HYDU_set_int_and_incr(arg, argv, &exec->appnum);
+ status = HYDU_set_int(arg, &exec->appnum, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status exec_proc_count_fn(char *arg, char ***argv)
{
struct HYD_exec *exec = NULL;
+ HYD_status status = HYD_SUCCESS;
for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
- return HYDU_set_int_and_incr(arg, argv, &exec->proc_count);
+ status = HYDU_set_int(arg, &exec->proc_count, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static HYD_status exec_local_env_fn(char *arg, char ***argv)
@@ -410,19 +559,29 @@
static HYD_status exec_env_prop_fn(char *arg, char ***argv)
{
struct HYD_exec *exec = NULL;
+ HYD_status status = HYD_SUCCESS;
for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
- return HYDU_set_str_and_incr(arg, argv, &exec->env_prop);
+ status = HYDU_set_str(arg, &exec->env_prop, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status exec_wdir_fn(char *arg, char ***argv)
{
struct HYD_exec *exec = NULL;
+ HYD_status status = HYD_SUCCESS;
for (exec = HYD_pmcd_pmip.exec_list; exec->next; exec = exec->next);
- return HYDU_set_str_and_incr(arg, argv, &exec->wdir);
+ status = HYDU_set_str(arg, &exec->wdir, **argv);
+
+ (*argv)++;
+
+ return status;
}
static HYD_status exec_args_fn(char *arg, char ***argv)
Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/persist/persist_server.c 2011-02-23 04:35:58 UTC (rev 8021)
@@ -40,7 +40,12 @@
static HYD_status port_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYDT_persist_handle.port);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &HYDT_persist_handle.port, atoi(**argv));
+ (*argv)++;
+
+ return status;
}
static void debug_help_fn(void)
@@ -54,7 +59,7 @@
static HYD_status debug_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYDT_persist_handle.debug, 1);
+ return HYDU_set_int(arg, &HYDT_persist_handle.debug, 1);
}
static struct HYD_arg_match_table match_table[] = {
Modified: mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/tools/nameserver/hydra_nameserver.c 2011-02-23 04:35:58 UTC (rev 8021)
@@ -36,7 +36,13 @@
static HYD_status port_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &private.port);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_int(arg, &private.port, atoi(**argv));
+
+ (*argv)++;
+
+ return status;
}
static void debug_help_fn(void)
@@ -47,7 +53,7 @@
static HYD_status debug_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &private.debug, 1);
+ return HYDU_set_int(arg, &private.debug, 1);
}
static void demux_help_fn(void)
@@ -58,7 +64,13 @@
static HYD_status demux_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &private.demux);
+ HYD_status status = HYD_SUCCESS;
+
+ status = HYDU_set_str(arg, &private.demux, **argv);
+
+ (*argv)++;
+
+ return status;
}
static struct HYD_arg_match_table match_table[] = {
Modified: mpich2/trunk/src/pm/hydra/ui/mpich/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/ui/mpich/utils.c 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/ui/mpich/utils.c 2011-02-23 04:35:58 UTC (rev 8021)
@@ -11,6 +11,10 @@
#include "uiu.h"
static int hostname_propagation = -1;
+static char *config_file = NULL;
+static char **config_argv = NULL;
+static int reading_config_file = 0;
+static struct HYD_arg_match_table match_table[];
static void init_ui_mpich_info(void)
{
@@ -122,15 +126,20 @@
int len;
HYD_status status = HYD_SUCCESS;
+ if (reading_config_file && HYD_server_info.user_global.global_env.prop) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
HYDU_ERR_CHKANDJUMP(status, HYD_server_info.user_global.global_env.prop,
HYD_INTERNAL_ERROR, "duplicate environment setting\n");
len = strlen("list:") + strlen(**argv) + 1;
HYDU_MALLOC(HYD_server_info.user_global.global_env.prop, char *, len, status);
HYDU_snprintf(HYD_server_info.user_global.global_env.prop, len, "list:%s", **argv);
- (*argv)++;
fn_exit:
+ (*argv)++;
return status;
fn_fail:
@@ -146,7 +155,21 @@
static HYD_status genvnone_fn(char *arg, char ***argv)
{
- return HYDU_set_str(arg, argv, &HYD_server_info.user_global.global_env.prop, "none");
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.global_env.prop) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.global_env.prop, "none");
+ HYDU_ERR_POP(status, "error setting genvnone\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void genvall_help_fn(void)
@@ -158,7 +181,21 @@
static HYD_status genvall_fn(char *arg, char ***argv)
{
- return HYDU_set_str(arg, argv, &HYD_server_info.user_global.global_env.prop, "all");
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.global_env.prop) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.global_env.prop, "all");
+ HYDU_ERR_POP(status, "error setting genvall\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void mfile_help_fn(void)
@@ -171,6 +208,11 @@
{
HYD_status status = HYD_SUCCESS;
+ if (reading_config_file && HYD_server_info.node_list) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
HYDU_ERR_CHKANDJUMP(status, HYD_server_info.node_list, HYD_INTERNAL_ERROR,
"duplicate host file setting\n");
@@ -184,9 +226,8 @@
HYDU_ERR_POP(status, "unable to add to node list\n");
}
+ fn_exit:
(*argv)++;
-
- fn_exit:
return status;
fn_fail:
@@ -205,6 +246,11 @@
int count = 0;
HYD_status status = HYD_SUCCESS;
+ if (reading_config_file && HYD_server_info.node_list) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
HYDU_ERR_CHKANDJUMP(status, HYD_server_info.node_list, HYD_INTERNAL_ERROR,
"duplicate host file or host list setting\n");
@@ -227,9 +273,8 @@
HYDU_ERR_POP(status, "unable to add to node list\n");
}
+ fn_exit:
(*argv)++;
-
- fn_exit:
return status;
fn_fail:
@@ -244,7 +289,22 @@
static HYD_status ppn_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_ui_mpich_info.ppn);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_mpich_info.ppn != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_ui_mpich_info.ppn, atoi(**argv));
+ HYDU_ERR_POP(status, "error setting ppn\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void profile_help_fn(void)
@@ -257,11 +317,16 @@
{
HYD_status status = HYD_SUCCESS;
+ if (reading_config_file && HYD_server_info.enable_profiling != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
#if !defined ENABLE_PROFILING
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "profiling support not compiled in\n");
#endif /* ENABLE_PROFILING */
- status = HYDU_set_int(arg, argv, &HYD_server_info.enable_profiling, 1);
+ status = HYDU_set_int(arg, &HYD_server_info.enable_profiling, 1);
HYDU_ERR_POP(status, "error enabling profiling\n");
fn_exit:
@@ -279,7 +344,21 @@
static HYD_status prepend_rank_fn(char *arg, char ***argv)
{
- return HYDU_set_str(arg, argv, &HYD_ui_info.prepend_pattern, "[%r] ");
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_info.prepend_pattern) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_ui_info.prepend_pattern, "[%r] ");
+ HYDU_ERR_POP(status, "error setting prepend_rank field\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void pattern_info(void)
@@ -301,7 +380,22 @@
static HYD_status prepend_pattern_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_ui_info.prepend_pattern);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_info.prepend_pattern) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_ui_info.prepend_pattern, **argv);
+ HYDU_ERR_POP(status, "error setting prepend pattern\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void outfile_pattern_help_fn(void)
@@ -313,7 +407,22 @@
static HYD_status outfile_pattern_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_ui_info.outfile_pattern);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_info.outfile_pattern) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_ui_info.outfile_pattern, **argv);
+ HYDU_ERR_POP(status, "error setting outfile pattern\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void errfile_pattern_help_fn(void)
@@ -325,102 +434,43 @@
static HYD_status errfile_pattern_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_ui_info.errfile_pattern);
-}
-
-static void wdir_help_fn(void)
-{
- printf("\n");
- printf("-wdir: Working directory to use on the compute nodes\n\n");
-}
-
-static HYD_status wdir_fn(char *arg, char ***argv)
-{
- struct HYD_exec *exec;
HYD_status status = HYD_SUCCESS;
- status = get_current_exec(&exec);
- HYDU_ERR_POP(status, "get_current_exec returned error\n");
+ if (reading_config_file && HYD_ui_info.errfile_pattern) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
- status = HYDU_set_str_and_incr(arg, argv, &exec->wdir);
- HYDU_ERR_POP(status, "error setting wdir for executable\n");
+ status = HYDU_set_str(arg, &HYD_ui_info.errfile_pattern, **argv);
+ HYDU_ERR_POP(status, "error setting errfile pattern\n");
fn_exit:
+ (*argv)++;
return status;
fn_fail:
goto fn_exit;
}
-static struct HYD_arg_match_table match_table[];
-
-static char **config_argv = NULL;
-
-static HYD_status parse_config_argv(void)
+static void wdir_help_fn(void)
{
- struct HYD_exec *exec;
- int i;
- HYD_status status = HYD_SUCCESS;
-
- do {
- /* Get the mpiexec arguments */
- status = HYDU_parse_array(&config_argv, match_table);
- HYDU_ERR_POP(status, "error parsing input array\n");
-
- if (!(*config_argv))
- break;
-
- /* Get the executable information */
- do {
- status = get_current_exec(&exec);
- HYDU_ERR_POP(status, "get_current_exec returned error\n");
-
- i = 0;
- while (exec->exec[i] != NULL)
- i++;
- exec->exec[i] = HYDU_strdup(*config_argv);
- exec->exec[i + 1] = NULL;
- } while (++config_argv && *config_argv);
- } while (1);
-
- fn_exit:
- return status;
-
- fn_fail:
- goto fn_exit;
+ printf("\n");
+ printf("-wdir: Working directory to use on the compute nodes\n\n");
}
-static HYD_status process_config_token(char *token, int newline, struct HYD_node **node_list)
+static HYD_status wdir_fn(char *arg, char ***argv)
{
struct HYD_exec *exec;
- static int first_line = 1, idx = 0;
HYD_status status = HYD_SUCCESS;
- if (config_argv == NULL)
- HYDU_MALLOC(config_argv, char **, HYD_NUM_TMP_STRINGS * sizeof(char *), status);
-
status = get_current_exec(&exec);
HYDU_ERR_POP(status, "get_current_exec returned error\n");
- if (newline) { /* The first entry gives the hostname and processes */
- if (first_line)
- first_line = 0;
- else {
- status = parse_config_argv();
- HYDU_ERR_POP(status, "error parsing config args\n");
+ status = HYDU_set_str(arg, &exec->wdir, **argv);
+ HYDU_ERR_POP(status, "error setting wdir for executable\n");
- status = HYDU_alloc_exec(&exec->next);
- HYDU_ERR_POP(status, "allocate_exec returned error\n");
- exec->next->appnum = exec->appnum + 1;
- }
-
- idx = 0;
- }
-
- config_argv[idx++] = HYDU_strdup(token);
- config_argv[idx] = NULL;
-
fn_exit:
+ (*argv)++;
return status;
fn_fail:
@@ -436,29 +486,12 @@
printf(" launch, except ':' is replaced with a new line character\n");
}
-static HYD_status parse_config_file(const char *config_file)
-{
- HYD_status status = HYD_SUCCESS;
-
- status = HYDU_parse_hostfile(config_file, NULL, process_config_token);
- HYDU_ERR_POP(status, "error parsing config file\n");
-
- status = parse_config_argv();
- HYDU_ERR_POP(status, "error parsing config args\n");
-
- fn_exit:
- return status;
-
- fn_fail:
- goto fn_exit;
-}
-
static HYD_status config_fn(char *arg, char ***argv)
{
HYD_status status = HYD_SUCCESS;
- status = parse_config_file(**argv);
- HYDU_ERR_POP(status, "unable to parse config file %s\n", **argv);
+ HYDU_ASSERT(!config_file, status);
+ config_file = HYDU_strdup(**argv);
fn_exit:
return status;
@@ -570,7 +603,7 @@
status = get_current_exec(&exec);
HYDU_ERR_POP(status, "get_current_exec returned error\n");
- status = HYDU_set_str(arg, argv, &exec->env_prop, "none");
+ status = HYDU_set_str(arg, &exec->env_prop, "none");
fn_exit:
return status;
@@ -594,7 +627,7 @@
status = get_current_exec(&exec);
HYDU_ERR_POP(status, "get_current_exec returned error\n");
- status = HYDU_set_str(arg, argv, &exec->env_prop, "all");
+ status = HYDU_set_str(arg, &exec->env_prop, "all");
fn_exit:
return status;
@@ -617,12 +650,13 @@
status = get_current_exec(&exec);
HYDU_ERR_POP(status, "get_current_exec returned error\n");
- status = HYDU_set_int_and_incr(arg, argv, &exec->proc_count);
+ status = HYDU_set_int(arg, &exec->proc_count, atoi(**argv));
HYDU_ERR_POP(status, "error getting executable process count\n");
HYD_server_info.pg_list.pg_process_count += exec->proc_count;
fn_exit:
+ (*argv)++;
return status;
fn_fail:
@@ -639,7 +673,22 @@
static HYD_status launcher_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.launcher);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.launcher) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.launcher, **argv);
+ HYDU_ERR_POP(status, "error setting launcher\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void launcher_exec_help_fn(void)
@@ -652,7 +701,22 @@
static HYD_status launcher_exec_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.launcher_exec);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.launcher_exec) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.launcher_exec, **argv);
+ HYDU_ERR_POP(status, "error setting launcher exec\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void enablex_help_fn(void)
@@ -664,8 +728,22 @@
static HYD_status enablex_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYD_server_info.user_global.enablex,
- !strcmp(arg, "enable-x"));
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.enablex != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_server_info.user_global.enablex,
+ !strcmp(arg, "enable-x"));
+ HYDU_ERR_POP(status, "error setting enable-x\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void rmk_help_fn(void)
@@ -678,7 +756,22 @@
static HYD_status rmk_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.rmk);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.rmk) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.rmk, **argv);
+ HYDU_ERR_POP(status, "error setting rmk\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void ranks_per_proc_help_fn(void)
@@ -689,7 +782,22 @@
static HYD_status ranks_per_proc_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_ui_mpich_info.ranks_per_proc);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_mpich_info.ranks_per_proc != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_ui_mpich_info.ranks_per_proc, atoi(**argv));
+ HYDU_ERR_POP(status, "error setting ranks per process\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void binding_help_fn(void)
@@ -739,7 +847,22 @@
static HYD_status binding_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.binding);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.binding) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.binding, **argv);
+ HYDU_ERR_POP(status, "error setting binding\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void bindlib_help_fn(void)
@@ -752,7 +875,22 @@
static HYD_status bindlib_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.bindlib);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.bindlib) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.bindlib, **argv);
+ HYDU_ERR_POP(status, "error setting bindlib\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void ckpoint_interval_help_fn(void)
@@ -763,7 +901,22 @@
static HYD_status ckpoint_interval_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_ui_mpich_info.ckpoint_int);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_mpich_info.ckpoint_int != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_ui_mpich_info.ckpoint_int, atoi(**argv));
+ HYDU_ERR_POP(status, "error setting ckpoint interval\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void ckpoint_prefix_help_fn(void)
@@ -774,7 +927,22 @@
static HYD_status ckpoint_prefix_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.ckpoint_prefix);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.ckpoint_prefix) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.ckpoint_prefix, **argv);
+ HYDU_ERR_POP(status, "error setting ckpoint_prefix\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void ckpoint_num_help_fn(void)
@@ -785,7 +953,22 @@
static HYD_status ckpoint_num_fn(char *arg, char ***argv)
{
- return HYDU_set_int_and_incr(arg, argv, &HYD_server_info.user_global.ckpoint_num);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.ckpoint_num != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_server_info.user_global.ckpoint_num, atoi(**argv));
+ HYDU_ERR_POP(status, "error setting ckpoint_num\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void ckpointlib_help_fn(void)
@@ -798,7 +981,22 @@
static HYD_status ckpointlib_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.ckpointlib);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.ckpointlib) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.ckpointlib, **argv);
+ HYDU_ERR_POP(status, "error setting ckpointlib\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void demux_help_fn(void)
@@ -811,7 +1009,22 @@
static HYD_status demux_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.demux);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.demux) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.demux, **argv);
+ HYDU_ERR_POP(status, "error setting demux\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void verbose_help_fn(void)
@@ -822,7 +1035,21 @@
static HYD_status verbose_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYD_server_info.user_global.debug, 1);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.debug != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_server_info.user_global.debug, 1);
+ HYDU_ERR_POP(status, "error setting debug\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void info_help_fn(void)
@@ -882,7 +1109,21 @@
static HYD_status print_all_exitcodes_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYD_ui_mpich_info.print_all_exitcodes, 1);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_ui_mpich_info.print_all_exitcodes != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_ui_mpich_info.print_all_exitcodes, 1);
+ HYDU_ERR_POP(status, "error setting print_all_exitcodes\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void iface_help_fn(void)
@@ -893,7 +1134,22 @@
static HYD_status iface_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.user_global.iface);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.iface) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.user_global.iface, **argv);
+ HYDU_ERR_POP(status, "error setting iface\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void nameserver_help_fn(void)
@@ -904,7 +1160,22 @@
static HYD_status nameserver_fn(char *arg, char ***argv)
{
- return HYDU_set_str_and_incr(arg, argv, &HYD_server_info.nameserver);
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.nameserver) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_str(arg, &HYD_server_info.nameserver, **argv);
+ HYDU_ERR_POP(status, "error setting nameserver\n");
+
+ fn_exit:
+ (*argv)++;
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void auto_cleanup_help_fn(void)
@@ -916,8 +1187,22 @@
static HYD_status auto_cleanup_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &HYD_server_info.user_global.auto_cleanup,
- !strcmp(arg, "enable-auto-cleanup"));
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && HYD_server_info.user_global.auto_cleanup != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &HYD_server_info.user_global.auto_cleanup,
+ !strcmp(arg, "enable-auto-cleanup"));
+ HYDU_ERR_POP(status, "error setting auto cleanup\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void hostname_propagation_help_fn(void)
@@ -929,8 +1214,22 @@
static HYD_status hostname_propagation_fn(char *arg, char ***argv)
{
- return HYDU_set_int(arg, argv, &hostname_propagation,
- strcmp(arg, "disable-hostname-propagation"));
+ HYD_status status = HYD_SUCCESS;
+
+ if (reading_config_file && hostname_propagation != -1) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
+ status = HYDU_set_int(arg, &hostname_propagation,
+ strcmp(arg, "disable-hostname-propagation"));
+ HYDU_ERR_POP(status, "error setting hostname propagation\n");
+
+ fn_exit:
+ return status;
+
+ fn_fail:
+ goto fn_exit;
}
static void order_nodes_help_fn(void)
@@ -944,6 +1243,11 @@
{
HYD_status status = HYD_SUCCESS;
+ if (reading_config_file && HYD_ui_mpich_info.sort_order != NONE) {
+ /* global variable already set; ignore */
+ goto fn_exit;
+ }
+
if (!strcmp(**argv, "ASCENDING") || !strcmp(**argv, "ascending") ||
!strcmp(**argv, "UP") || !strcmp(**argv, "up"))
HYD_ui_mpich_info.sort_order = ASCENDING;
@@ -953,101 +1257,14 @@
else
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "unrecognized sort order\n");
+ fn_exit:
(*argv)++;
-
- fn_exit:
return status;
fn_fail:
goto fn_exit;
}
-static struct HYD_arg_match_table match_table[] = {
- /* Global environment options */
- {"genv", genv_fn, genv_help_fn},
- {"genvlist", genvlist_fn, genvlist_help_fn},
- {"genvnone", genvnone_fn, genvnone_help_fn},
- {"genvall", genvall_fn, genvall_help_fn},
-
- /* Other global options */
- {"f", mfile_fn, mfile_help_fn},
- {"hostfile", mfile_fn, mfile_help_fn},
- {"machinefile", mfile_fn, mfile_help_fn},
- {"machine", hostlist_fn, mfile_help_fn},
- {"machines", hostlist_fn, mfile_help_fn},
- {"machinelist", hostlist_fn, mfile_help_fn},
- {"host", hostlist_fn, hostlist_help_fn},
- {"hosts", hostlist_fn, hostlist_help_fn},
- {"hostlist", hostlist_fn, hostlist_help_fn},
- {"ppn", ppn_fn, ppn_help_fn},
- {"profile", profile_fn, profile_help_fn},
- {"prepend-rank", prepend_rank_fn, prepend_rank_help_fn},
- {"l", prepend_rank_fn, prepend_rank_help_fn},
- {"prepend-pattern", prepend_pattern_fn, prepend_pattern_help_fn},
- {"outfile-pattern", outfile_pattern_fn, outfile_pattern_help_fn},
- {"errfile-pattern", errfile_pattern_fn, errfile_pattern_help_fn},
- {"outfile", outfile_pattern_fn, outfile_pattern_help_fn},
- {"errfile", errfile_pattern_fn, errfile_pattern_help_fn},
- {"wdir", wdir_fn, wdir_help_fn},
- {"configfile", config_fn, config_help_fn},
-
- /* Local environment options */
- {"env", env_fn, env_help_fn},
- {"envlist", envlist_fn, envlist_help_fn},
- {"envnone", envnone_fn, envnone_help_fn},
- {"envall", envall_fn, envall_help_fn},
-
- /* Other local options */
- {"n", np_fn, np_help_fn},
- {"np", np_fn, np_help_fn},
-
- /* Hydra specific options */
-
- /* Launcher options */
- {"launcher", launcher_fn, launcher_help_fn},
- {"launcher-exec", launcher_exec_fn, launcher_exec_help_fn},
- {"bootstrap", launcher_fn, launcher_help_fn},
- {"bootstrap-exec", launcher_exec_fn, launcher_exec_help_fn},
- {"enable-x", enablex_fn, enablex_help_fn},
- {"disable-x", enablex_fn, enablex_help_fn},
-
- /* Resource management kernel options */
- {"rmk", rmk_fn, rmk_help_fn},
-
- /* Hybrid programming options */
- {"ranks-per-proc", ranks_per_proc_fn, ranks_per_proc_help_fn},
-
- /* Process-core binding options */
- {"binding", binding_fn, binding_help_fn},
- {"bindlib", bindlib_fn, bindlib_help_fn},
-
- /* Checkpoint/restart options */
- {"ckpoint-interval", ckpoint_interval_fn, ckpoint_interval_help_fn},
- {"ckpoint-prefix", ckpoint_prefix_fn, ckpoint_prefix_help_fn},
- {"ckpoint-num", ckpoint_num_fn, ckpoint_num_help_fn},
- {"ckpointlib", ckpointlib_fn, ckpointlib_help_fn},
-
- /* Demux engine options */
- {"demux", demux_fn, demux_help_fn},
-
- /* Other hydra options */
- {"verbose", verbose_fn, verbose_help_fn},
- {"v", verbose_fn, verbose_help_fn},
- {"debug", verbose_fn, verbose_help_fn},
- {"info", info_fn, info_help_fn},
- {"version", info_fn, info_help_fn},
- {"print-all-exitcodes", print_all_exitcodes_fn, print_all_exitcodes_help_fn},
- {"iface", iface_fn, iface_help_fn},
- {"nameserver", nameserver_fn, nameserver_help_fn},
- {"disable-auto-cleanup", auto_cleanup_fn, auto_cleanup_help_fn},
- {"enable-auto-cleanup", auto_cleanup_fn, auto_cleanup_help_fn},
- {"disable-hostname-propagation", hostname_propagation_fn, hostname_propagation_help_fn},
- {"enable-hostname-propagation", hostname_propagation_fn, hostname_propagation_help_fn},
- {"order-nodes", order_nodes_fn, order_nodes_help_fn},
-
- {"\0", NULL}
-};
-
static HYD_status set_default_values(void)
{
char *tmp;
@@ -1110,22 +1327,25 @@
goto fn_exit;
}
-HYD_status HYD_uii_mpx_get_parameters(char **t_argv)
+static HYD_status process_config_token(char *token, int newline, struct HYD_node **node_list)
{
- int i, ret;
+ static int idx = 0;
+
+ config_argv[idx++] = HYDU_strdup(token);
+ config_argv[idx] = NULL;
+
+ return HYD_SUCCESS;
+}
+
+static HYD_status parse_args(char **t_argv)
+{
char **argv = t_argv;
- char *progname = *argv;
- char *post, *loc, *tmp[HYD_NUM_TMP_STRINGS], *conf_file;
- const char *home;
struct HYD_exec *exec;
+ int i;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
- HYD_uiu_init_params();
- init_ui_mpich_info();
-
- argv++;
do {
/* Get the mpiexec arguments */
status = HYDU_parse_array(&argv, match_table);
@@ -1156,27 +1376,68 @@
} while (++argv && *argv);
} while (1);
- ret = MPL_env2str("HOME", &home);
- if (ret) {
- int len = strlen(home) + strlen("/.mpiexec.hydra.conf") + 1;
+ fn_exit:
+ HYDU_FUNC_EXIT();
+ return status;
- HYDU_MALLOC(conf_file, char *, len, status);
- MPL_snprintf(conf_file, len, "%s/.mpiexec.hydra.conf", home);
+ fn_fail:
+ goto fn_exit;
+}
- ret = open(conf_file, O_RDONLY);
- if (ret < 0) {
- HYDU_FREE(conf_file);
- conf_file = HYDU_strdup(HYDRA_CONF_FILE);
+HYD_status HYD_uii_mpx_get_parameters(char **t_argv)
+{
+ int ret;
+ char **argv = t_argv;
+ char *progname = *argv;
+ char *post, *loc, *tmp[HYD_NUM_TMP_STRINGS], *conf_file;
+ const char *home;
+ HYD_status status = HYD_SUCCESS;
+
+ HYDU_FUNC_ENTER();
+
+ HYD_uiu_init_params();
+ init_ui_mpich_info();
+
+ argv++;
+ status = parse_args(argv);
+ HYDU_ERR_POP(status, "unable to parse user arguments\n");
+
+ if (config_file == NULL) {
+ ret = MPL_env2str("HOME", &home);
+ if (ret) {
+ int len = strlen(home) + strlen("/.mpiexec.hydra.conf") + 1;
+
+ HYDU_MALLOC(conf_file, char *, len, status);
+ MPL_snprintf(conf_file, len, "%s/.mpiexec.hydra.conf", home);
+
ret = open(conf_file, O_RDONLY);
- }
+ if (ret < 0) {
+ HYDU_FREE(conf_file);
+ conf_file = HYDU_strdup(HYDRA_CONF_FILE);
+ ret = open(conf_file, O_RDONLY);
+ }
- if (ret >= 0) {
- /* We have successfully opened the file */
- close(ret);
- parse_config_file(conf_file);
+ if (ret >= 0) {
+ /* We have successfully opened the file */
+ close(ret);
+ config_file = conf_file;
+ }
}
+ }
- HYDU_FREE(conf_file);
+ if (config_file) {
+ HYDU_ASSERT(config_argv == NULL, status);
+ HYDU_MALLOC(config_argv, char **, HYD_NUM_TMP_STRINGS * sizeof(char *), status);
+
+ status = HYDU_parse_hostfile(config_file, NULL, process_config_token);
+ HYDU_ERR_POP(status, "error parsing config file\n");
+
+ reading_config_file = 1;
+ status = parse_args(config_argv);
+ HYDU_ERR_POP(status, "error parsing config args\n");
+ reading_config_file = 0;
+
+ HYDU_FREE(config_file);
}
/* Get the base path */
@@ -1235,3 +1496,89 @@
fn_fail:
goto fn_exit;
}
+
+static struct HYD_arg_match_table match_table[] = {
+ /* Global environment options */
+ {"genv", genv_fn, genv_help_fn},
+ {"genvlist", genvlist_fn, genvlist_help_fn},
+ {"genvnone", genvnone_fn, genvnone_help_fn},
+ {"genvall", genvall_fn, genvall_help_fn},
+
+ /* Other global options */
+ {"f", mfile_fn, mfile_help_fn},
+ {"hostfile", mfile_fn, mfile_help_fn},
+ {"machinefile", mfile_fn, mfile_help_fn},
+ {"machine", hostlist_fn, mfile_help_fn},
+ {"machines", hostlist_fn, mfile_help_fn},
+ {"machinelist", hostlist_fn, mfile_help_fn},
+ {"host", hostlist_fn, hostlist_help_fn},
+ {"hosts", hostlist_fn, hostlist_help_fn},
+ {"hostlist", hostlist_fn, hostlist_help_fn},
+ {"ppn", ppn_fn, ppn_help_fn},
+ {"profile", profile_fn, profile_help_fn},
+ {"prepend-rank", prepend_rank_fn, prepend_rank_help_fn},
+ {"l", prepend_rank_fn, prepend_rank_help_fn},
+ {"prepend-pattern", prepend_pattern_fn, prepend_pattern_help_fn},
+ {"outfile-pattern", outfile_pattern_fn, outfile_pattern_help_fn},
+ {"errfile-pattern", errfile_pattern_fn, errfile_pattern_help_fn},
+ {"outfile", outfile_pattern_fn, outfile_pattern_help_fn},
+ {"errfile", errfile_pattern_fn, errfile_pattern_help_fn},
+ {"wdir", wdir_fn, wdir_help_fn},
+ {"configfile", config_fn, config_help_fn},
+
+ /* Local environment options */
+ {"env", env_fn, env_help_fn},
+ {"envlist", envlist_fn, envlist_help_fn},
+ {"envnone", envnone_fn, envnone_help_fn},
+ {"envall", envall_fn, envall_help_fn},
+
+ /* Other local options */
+ {"n", np_fn, np_help_fn},
+ {"np", np_fn, np_help_fn},
+
+ /* Hydra specific options */
+
+ /* Launcher options */
+ {"launcher", launcher_fn, launcher_help_fn},
+ {"launcher-exec", launcher_exec_fn, launcher_exec_help_fn},
+ {"bootstrap", launcher_fn, launcher_help_fn},
+ {"bootstrap-exec", launcher_exec_fn, launcher_exec_help_fn},
+ {"enable-x", enablex_fn, enablex_help_fn},
+ {"disable-x", enablex_fn, enablex_help_fn},
+
+ /* Resource management kernel options */
+ {"rmk", rmk_fn, rmk_help_fn},
+
+ /* Hybrid programming options */
+ {"ranks-per-proc", ranks_per_proc_fn, ranks_per_proc_help_fn},
+
+ /* Process-core binding options */
+ {"binding", binding_fn, binding_help_fn},
+ {"bindlib", bindlib_fn, bindlib_help_fn},
+
+ /* Checkpoint/restart options */
+ {"ckpoint-interval", ckpoint_interval_fn, ckpoint_interval_help_fn},
+ {"ckpoint-prefix", ckpoint_prefix_fn, ckpoint_prefix_help_fn},
+ {"ckpoint-num", ckpoint_num_fn, ckpoint_num_help_fn},
+ {"ckpointlib", ckpointlib_fn, ckpointlib_help_fn},
+
+ /* Demux engine options */
+ {"demux", demux_fn, demux_help_fn},
+
+ /* Other hydra options */
+ {"verbose", verbose_fn, verbose_help_fn},
+ {"v", verbose_fn, verbose_help_fn},
+ {"debug", verbose_fn, verbose_help_fn},
+ {"info", info_fn, info_help_fn},
+ {"version", info_fn, info_help_fn},
+ {"print-all-exitcodes", print_all_exitcodes_fn, print_all_exitcodes_help_fn},
+ {"iface", iface_fn, iface_help_fn},
+ {"nameserver", nameserver_fn, nameserver_help_fn},
+ {"disable-auto-cleanup", auto_cleanup_fn, auto_cleanup_help_fn},
+ {"enable-auto-cleanup", auto_cleanup_fn, auto_cleanup_help_fn},
+ {"disable-hostname-propagation", hostname_propagation_fn, hostname_propagation_help_fn},
+ {"enable-hostname-propagation", hostname_propagation_fn, hostname_propagation_help_fn},
+ {"order-nodes", order_nodes_fn, order_nodes_help_fn},
+
+ {"\0", NULL}
+};
Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c 2011-02-23 00:37:22 UTC (rev 8020)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c 2011-02-23 04:35:58 UTC (rev 8021)
@@ -150,7 +150,7 @@
goto fn_exit;
}
-HYD_status HYDU_set_str(char *arg, char ***argv, char **var, const char *val)
+HYD_status HYDU_set_str(char *arg, char **var, const char *val)
{
HYD_status status = HYD_SUCCESS;
@@ -168,29 +168,10 @@
goto fn_exit;
}
-HYD_status HYDU_set_str_and_incr(char *arg, char ***argv, char **var)
+HYD_status HYDU_set_int(char *arg, int *var, int val)
{
HYD_status status = HYD_SUCCESS;
- if (**argv == NULL)
- HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "cannot assign NULL object\n");
-
- status = HYDU_set_str(arg, argv, var, **argv);
- HYDU_ERR_POP(status, "unable to set int\n");
-
- (*argv)++;
-
- fn_exit:
- return status;
-
- fn_fail:
- goto fn_exit;
-}
-
-HYD_status HYDU_set_int(char *arg, char ***argv, int *var, int val)
-{
- HYD_status status = HYD_SUCCESS;
-
HYDU_ERR_CHKANDJUMP(status, *var != -1, HYD_INTERNAL_ERROR,
"duplicate setting: %s\n", arg);
@@ -203,25 +184,6 @@
goto fn_exit;
}
-HYD_status HYDU_set_int_and_incr(char *arg, char ***argv, int *var)
-{
- HYD_status status = HYD_SUCCESS;
-
- if (**argv == NULL)
- HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "cannot assign NULL object\n");
-
- status = HYDU_set_int(arg, argv, var, atoi(**argv));
- HYDU_ERR_POP(status, "unable to set int\n");
-
- (*argv)++;
-
- fn_exit:
- return status;
-
- fn_fail:
- goto fn_exit;
-}
-
char *HYDU_getcwd(void)
{
char *cwdval, *retval = NULL;
More information about the mpich2-commits
mailing list