1
1

Extend the mca_component_path param usage by allowing a user to add paths to the default system and user ones defined in the program. Thus, the user can specify a param value of:

"my_perfect_path":SYSTEM_DEFAULT:USER_DEFAULT

and OPAL will substitute its internally derived values for the defaults (instead of forcing the user to figure them out).

This commit was SVN r22272.
Этот коммит содержится в:
Ralph Castain 2009-12-07 20:29:28 +00:00
родитель b024aee10c
Коммит 0b654ba4dc

Просмотреть файл

@ -48,6 +48,8 @@
#endif #endif
#endif #endif
#include "opal/mca/installdirs/installdirs.h"
#include "opal/util/opal_environ.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
@ -248,6 +250,20 @@ static void find_dyn_components(const char *path, const char *type_name,
component_file_item_t *file; component_file_item_t *file;
opal_list_item_t *cur; opal_list_item_t *cur;
char prefix[32 + MCA_BASE_MAX_TYPE_NAME_LEN], *basename; char prefix[32 + MCA_BASE_MAX_TYPE_NAME_LEN], *basename;
char *system_default;
char *user_default=NULL;
/* copy the default location definitions */
#if OPAL_WANT_HOME_CONFIG_FILES
system_default = opal_install_dirs.pkglibdir; /* DO NOT FREE */
asprintf(&user_default, "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"components", opal_home_directory());
#else
# if defined(__WINDOWS__) && defined(_DEBUG)
asprintf(&system_default, "%s/debug", opal_install_dirs.pkglibdir);
# else
asprintf(&system_default, "%s", opal_install_dirs.pkglibdir);
# endif
#endif
/* If path is NULL, iterate over the set of directories specified by /* If path is NULL, iterate over the set of directories specified by
the MCA param mca_base_component_path. If path is not NULL, then the MCA param mca_base_component_path. If path is not NULL, then
@ -277,13 +293,29 @@ static void find_dyn_components(const char *path, const char *type_name,
if (NULL != end) { if (NULL != end) {
*end = '\0'; *end = '\0';
} }
if ((0 == strcmp(dir, "USER_DEFAULT") ||
0 == strcmp(dir, "USR_DEFAULT"))
&& NULL != user_default) {
if (0 != lt_dlforeachfile(user_default, save_filename, NULL)) {
break;
}
} else if (0 == strcmp(dir, "SYS_DEFAULT") ||
0 == strcmp(dir, "SYSTEM_DEFAULT")) {
if (0 != lt_dlforeachfile(system_default, save_filename, NULL)) {
break;
}
} else {
if (0 != lt_dlforeachfile(dir, save_filename, NULL)) { if (0 != lt_dlforeachfile(dir, save_filename, NULL)) {
break; break;
} }
}
dir = end + 1; dir = end + 1;
} while (NULL != end); } while (NULL != end);
} }
} }
if (NULL != user_default) {
free(user_default);
}
/* Look through the list of found files and find those that match /* Look through the list of found files and find those that match
the desired framework name */ the desired framework name */