Allow there to be no default hostfile without generating an error
This commit was SVN r25930.
Этот коммит содержится в:
родитель
91977444af
Коммит
3da1787c06
@ -150,6 +150,7 @@ bool orte_report_launch_progress = false;
|
||||
|
||||
/* allocation specification */
|
||||
char *orte_default_hostfile = NULL;
|
||||
bool orte_default_hostfile_given = false;
|
||||
char *orte_rankfile = NULL;
|
||||
#ifdef __WINDOWS__
|
||||
char *orte_ccp_headnode;
|
||||
|
@ -615,6 +615,7 @@ ORTE_DECLSPEC extern bool orte_report_launch_progress;
|
||||
|
||||
/* allocation specification */
|
||||
ORTE_DECLSPEC extern char *orte_default_hostfile;
|
||||
ORTE_DECLSPEC extern bool orte_default_hostfile_given;
|
||||
ORTE_DECLSPEC extern char *orte_rankfile;
|
||||
#ifdef __WINDOWS__
|
||||
ORTE_DECLSPEC extern char *orte_ccp_headnode;
|
||||
|
@ -251,15 +251,23 @@ int orte_register_params(void)
|
||||
false, false, 1000, &orte_timeout_usec_per_proc);
|
||||
|
||||
/* default hostfile */
|
||||
asprintf(&orte_default_hostfile, "%s/etc/openmpi-default-hostfile", opal_install_dirs.prefix);
|
||||
mca_base_param_reg_string_name("orte", "default_hostfile",
|
||||
"Name of the default hostfile (relative or absolute path, \"none\" to ignore environmental or default MCA param setting)",
|
||||
false, false, orte_default_hostfile, &orte_default_hostfile);
|
||||
if (0 == strcmp(orte_default_hostfile, "none")) {
|
||||
free(orte_default_hostfile);
|
||||
false, false, NULL, &strval);
|
||||
if (NULL == strval) {
|
||||
/* nothing was given, so define the default */
|
||||
asprintf(&orte_default_hostfile, "%s/etc/openmpi-default-hostfile", opal_install_dirs.prefix);
|
||||
/* flag that nothing was given */
|
||||
orte_default_hostfile_given = false;
|
||||
} else if (0 == strcmp(orte_default_hostfile, "none")) {
|
||||
orte_default_hostfile = NULL;
|
||||
/* flag that it was given */
|
||||
orte_default_hostfile_given = true;
|
||||
} else {
|
||||
orte_default_hostfile = strval;
|
||||
/* flag that it was given */
|
||||
orte_default_hostfile_given = true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
mca_base_param_reg_string_name("orte", "ccp_headnode",
|
||||
|
@ -419,8 +419,25 @@ static int hostfile_parse(const char *hostfile, opal_list_t* updates, opal_list_
|
||||
orte_util_hostfile_done = false;
|
||||
orte_util_hostfile_in = fopen(hostfile, "r");
|
||||
if (NULL == orte_util_hostfile_in) {
|
||||
orte_show_help("help-hostfile.txt", "no-hostfile", true, hostfile);
|
||||
rc = ORTE_ERR_NOT_FOUND;
|
||||
if (NULL == orte_default_hostfile ||
|
||||
0 != strcmp(orte_default_hostfile, hostfile)) {
|
||||
/* not the default hostfile, so not finding it
|
||||
* is an error
|
||||
*/
|
||||
orte_show_help("help-hostfile.txt", "no-hostfile", true, hostfile);
|
||||
rc = ORTE_ERR_SILENT;
|
||||
goto unlock;
|
||||
}
|
||||
/* if this is the default hostfile and it was given,
|
||||
* then it's an error
|
||||
*/
|
||||
if (orte_default_hostfile_given) {
|
||||
orte_show_help("help-hostfile.txt", "no-hostfile", true, hostfile);
|
||||
rc = ORTE_ERR_NOT_FOUND;
|
||||
goto unlock;
|
||||
}
|
||||
/* otherwise, not finding it is okay */
|
||||
rc = ORTE_SUCCESS;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user