Fix issue found by Josh England: ompi_info deliberately clears
environment variables corresopnding to framework MCA parameters so that the opal MCA base loads '''all''' components (not just the ones specified in the environment variables). This has the side-effect of not showing the user's value when displaying the framework MCA parameters via --param output. For example: {{{ shell% setenv OMPI_MCA_btl foo shell% ompi_info --param btl base }}} The above sequence would show a "<none>" value for the "btl" parameter instead of "foo". This commit restores the environment after we munge it to make the loader load all components. Hence, the above command sequence will show "foo" for the "btl" parameter value, not "<none>". This commit was SVN r14771.
Этот коммит содержится в:
родитель
e8b85faf28
Коммит
4bf964eb3f
@ -143,10 +143,13 @@ void ompi_info::open_components()
|
||||
{
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
string env;
|
||||
char *target;
|
||||
char *target, *save;
|
||||
vector<std::string> env_save;
|
||||
vector<std::string>::iterator esi;
|
||||
|
||||
if (opened_components)
|
||||
if (opened_components) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear out the environment. Use strdup() to orphan the resulting
|
||||
// strings because items are placed in the environment by reference,
|
||||
@ -154,8 +157,9 @@ void ompi_info::open_components()
|
||||
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
env = "OMPI_MCA_" + mca_types[i];
|
||||
if (NULL != getenv(env.c_str())) {
|
||||
if (NULL != (save = getenv(env.c_str()))) {
|
||||
env += "=";
|
||||
env_save.push_back(env + save);
|
||||
target = strdup(env.c_str());
|
||||
putenv(target);
|
||||
}
|
||||
@ -313,6 +317,17 @@ void ompi_info::open_components()
|
||||
component_map["crcp"] = &ompi_crcp_base_components_available;
|
||||
#endif
|
||||
|
||||
// Restore the environment to what it was before we started so that
|
||||
// if users setenv OMPI_MCA_<framework name> to some value, they'll
|
||||
// see that value when it is shown via --param output.
|
||||
|
||||
if (!env_save.empty()) {
|
||||
for (esi = env_save.begin(); esi != env_save.end(); ++esi) {
|
||||
target = strdup(esi->c_str());
|
||||
putenv(target);
|
||||
}
|
||||
}
|
||||
|
||||
// All done
|
||||
|
||||
opened_components = true;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user