- Update to use new mca_base_param interface
- Be consistent w/ "component" and "module" This commit was SVN r1693.
Этот коммит содержится в:
родитель
2aa5f92fca
Коммит
05ab76a7ff
@ -37,30 +37,30 @@ using namespace ompi_info;
|
||||
// Public variables
|
||||
//
|
||||
|
||||
ompi_info::module_map_t ompi_info::module_map;
|
||||
ompi_info::component_map_t ompi_info::component_map;
|
||||
|
||||
|
||||
//
|
||||
// Private variables
|
||||
//
|
||||
|
||||
static bool opened_modules = false;
|
||||
static bool opened_components = false;
|
||||
|
||||
|
||||
//
|
||||
// Open all MCA modules so that they can register their MCA
|
||||
// Open all MCA components so that they can register their MCA
|
||||
// parameters. Take a shotgun approach here and indiscriminately open
|
||||
// all modules -- don't be selective. To this end, we need to clear
|
||||
// all components -- don't be selective. To this end, we need to clear
|
||||
// out the environment of all OMPI_MPI_mca_<type> variables to ensure
|
||||
// that the open algorithms don't try to only open one module.
|
||||
// that the open algorithms don't try to only open one component.
|
||||
//
|
||||
void ompi_info::open_modules()
|
||||
void ompi_info::open_components()
|
||||
{
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
string env;
|
||||
char *target;
|
||||
|
||||
if (opened_modules)
|
||||
if (opened_components)
|
||||
return;
|
||||
|
||||
// Clear out the environment. Use strdup() to orphan the resulting
|
||||
@ -79,89 +79,89 @@ void ompi_info::open_modules()
|
||||
// Find / open all components
|
||||
|
||||
mca_base_open();
|
||||
module_map["base"] = NULL;
|
||||
component_map["base"] = NULL;
|
||||
|
||||
mca_allocator_base_open();
|
||||
module_map["allocator"] = &mca_allocator_base_components;
|
||||
component_map["allocator"] = &mca_allocator_base_components;
|
||||
|
||||
mca_coll_base_open();
|
||||
module_map["coll"] = &mca_coll_base_components_opened;
|
||||
component_map["coll"] = &mca_coll_base_components_opened;
|
||||
|
||||
#if 0
|
||||
// common component framework not implemented yet
|
||||
mca_common_base_open();
|
||||
module_map["common"] = &mca_common_base_components_opened;
|
||||
component_map["common"] = &mca_common_base_components_opened;
|
||||
#else
|
||||
module_map["common"] = NULL;
|
||||
component_map["common"] = NULL;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// waiting for gpr to be implemented
|
||||
mca_gpr_base_open();
|
||||
module_map["gpr"] = &mca_ns_base_components_available;
|
||||
component_map["gpr"] = &mca_ns_base_components_available;
|
||||
#else
|
||||
module_map["gpr"] = NULL;
|
||||
component_map["gpr"] = NULL;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// io module opening not implemented yet
|
||||
// io component opening not implemented yet
|
||||
mca_io_base_open();
|
||||
module_map["io"] = &mca_io_base_modules_available;
|
||||
component_map["io"] = &mca_io_base_components_available;
|
||||
#else
|
||||
module_map["io"] = NULL;
|
||||
component_map["io"] = NULL;
|
||||
#endif
|
||||
|
||||
mca_ns_base_open();
|
||||
module_map["ns"] = &mca_ns_base_components_available;
|
||||
component_map["ns"] = &mca_ns_base_components_available;
|
||||
|
||||
mca_mpool_base_open();
|
||||
module_map["mpool"] = &mca_mpool_base_components;
|
||||
component_map["mpool"] = &mca_mpool_base_components;
|
||||
|
||||
#if 0
|
||||
// one module opening not implemented yet
|
||||
// one component opening not implemented yet
|
||||
mca_one_base_open();
|
||||
module_map["one"] = &mca_one_base_modules_available;
|
||||
component_map["one"] = &mca_one_base_components_available;
|
||||
#else
|
||||
module_map["one"] = NULL;
|
||||
component_map["one"] = NULL;
|
||||
#endif
|
||||
|
||||
mca_oob_base_open();
|
||||
module_map["oob"] = &mca_oob_base_components;
|
||||
component_map["oob"] = &mca_oob_base_components;
|
||||
|
||||
#if 0
|
||||
// op component framework not yet implemented
|
||||
mca_op_base_open();
|
||||
module_map["op"] = &mca_oob_base_components;
|
||||
component_map["op"] = &mca_oob_base_components;
|
||||
#else
|
||||
module_map["op"] = NULL;
|
||||
component_map["op"] = NULL;
|
||||
#endif
|
||||
|
||||
mca_pcm_base_open();
|
||||
module_map["pcm"] = &mca_pcm_base_modules_available;
|
||||
component_map["pcm"] = &mca_pcm_base_modules_available;
|
||||
|
||||
mca_pml_base_open();
|
||||
module_map["pml"] = &mca_pml_base_modules_available;
|
||||
component_map["pml"] = &mca_pml_base_modules_available;
|
||||
|
||||
mca_ptl_base_open();
|
||||
module_map["ptl"] = &mca_ptl_base_modules_available;
|
||||
component_map["ptl"] = &mca_ptl_base_modules_available;
|
||||
|
||||
#if 0
|
||||
// topo module opening not implemented yet
|
||||
// topo component opening not implemented yet
|
||||
mca_topo_base_open();
|
||||
module_map["topo"] = &mca_topo_base_modules_available;
|
||||
component_map["topo"] = &mca_topo_base_components_available;
|
||||
#else
|
||||
module_map["topo"] = NULL;
|
||||
component_map["topo"] = NULL;
|
||||
#endif
|
||||
|
||||
// All done
|
||||
|
||||
opened_modules = true;
|
||||
opened_components = true;
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::close_modules()
|
||||
void ompi_info::close_components()
|
||||
{
|
||||
if (opened_modules) {
|
||||
if (opened_components) {
|
||||
mca_pcm_base_close();
|
||||
mca_oob_base_close();
|
||||
mca_ns_base_close();
|
||||
@ -170,8 +170,8 @@ void ompi_info::close_modules()
|
||||
mca_ptl_base_close();
|
||||
|
||||
mca_base_close();
|
||||
module_map.clear();
|
||||
component_map.clear();
|
||||
}
|
||||
|
||||
opened_modules = false;
|
||||
opened_components = false;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
||||
exit(ret);
|
||||
}
|
||||
ompi_cmd_line_make_opt(cmd_line, 'v', "version", 2,
|
||||
"Show version of OMPI/MPI or a module");
|
||||
"Show version of OMPI/MPI or a component");
|
||||
ompi_cmd_line_make_opt(cmd_line, '\0', "param", 2,
|
||||
"Show MCA parameters");
|
||||
ompi_cmd_line_make_opt(cmd_line, '\0', "path", 1,
|
||||
@ -169,27 +169,27 @@ int main(int argc, char *argv[])
|
||||
ompi_info::show_path(path_prefix, OMPI_PREFIX);
|
||||
ompi_info::do_arch(cmd_line);
|
||||
ompi_info::do_config(false);
|
||||
ompi_info::open_modules();
|
||||
ompi_info::show_module_version("base", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("allocator", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("coll", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("common", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("gpr", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("io", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("mpool", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("ns", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("one", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("oob", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("op", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("pcm", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("pml", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("ptl", module_all, ver_full, type_all);
|
||||
ompi_info::show_module_version("topo", module_all, ver_full, type_all);
|
||||
ompi_info::open_components();
|
||||
ompi_info::show_component_version("base", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("allocator", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("coll", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("common", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("gpr", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("io", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("mpool", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("ns", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("one", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("oob", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("op", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("pcm", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("pml", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("ptl", component_all, ver_full, type_all);
|
||||
ompi_info::show_component_version("topo", component_all, ver_full, type_all);
|
||||
}
|
||||
|
||||
// All done
|
||||
|
||||
ompi_info::close_modules();
|
||||
ompi_info::close_components();
|
||||
ompi_cmd_line_free(cmd_line);
|
||||
mca_base_close();
|
||||
ompi_finalize();
|
||||
|
@ -44,8 +44,8 @@ namespace ompi_info {
|
||||
|
||||
void do_version(bool want_all, ompi_cmd_line_t *cmd_line);
|
||||
void show_ompi_version(const std::string& scope);
|
||||
void show_module_version(const std::string& type_name,
|
||||
const std::string& module_name,
|
||||
void show_component_version(const std::string& type_name,
|
||||
const std::string& component_name,
|
||||
const std::string& scope,
|
||||
const std::string& ver_type);
|
||||
|
||||
@ -53,7 +53,7 @@ namespace ompi_info {
|
||||
// Parameter/configuration-related functions
|
||||
//
|
||||
|
||||
extern std::string module_all;
|
||||
extern std::string component_all;
|
||||
extern std::string param_all;
|
||||
|
||||
extern std::string path_prefix;
|
||||
@ -64,7 +64,7 @@ namespace ompi_info {
|
||||
extern std::string path_sysconfdir;
|
||||
|
||||
void do_params();
|
||||
void show_mca_params(const std::string& type, const std::string& module,
|
||||
void show_mca_params(const std::string& type, const std::string& component,
|
||||
const std::string& param);
|
||||
|
||||
void do_path(bool want_all, ompi_cmd_line_t *cmd_line);
|
||||
@ -84,15 +84,15 @@ namespace ompi_info {
|
||||
const std::string& value);
|
||||
|
||||
//
|
||||
// Module-related functions
|
||||
// Component-related functions
|
||||
//
|
||||
|
||||
typedef std::map<std::string, ompi_list_t *> module_map_t;
|
||||
typedef std::map<std::string, ompi_list_t *> component_map_t;
|
||||
|
||||
extern module_map_t module_map;
|
||||
extern component_map_t component_map;
|
||||
|
||||
void open_modules();
|
||||
void close_modules();
|
||||
void open_components();
|
||||
void close_components();
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
#include "mca/base/mca_base_param_internal.h"
|
||||
#include "tools/ompi_info/ompi_info.h"
|
||||
|
||||
using namespace std;
|
||||
@ -23,7 +24,7 @@ using namespace ompi_info;
|
||||
// Public variables
|
||||
//
|
||||
|
||||
string ompi_info::module_all = "all";
|
||||
string ompi_info::component_all = "all";
|
||||
string ompi_info::param_all = "all";
|
||||
|
||||
string ompi_info::path_prefix = "prefix";
|
||||
@ -46,11 +47,11 @@ extern ompi_value_array_t mca_base_params;
|
||||
void ompi_info::do_params()
|
||||
{
|
||||
unsigned int count;
|
||||
string type, module;
|
||||
string type, component;
|
||||
bool found, want_all;
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
|
||||
ompi_info::open_modules();
|
||||
ompi_info::open_components();
|
||||
|
||||
// See if the special param "all" was givin to --param; that
|
||||
// superceeds any individual type
|
||||
@ -69,12 +70,12 @@ void ompi_info::do_params()
|
||||
|
||||
if (want_all) {
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
show_mca_params(mca_types[i], module_all, param_all);
|
||||
show_mca_params(mca_types[i], component_all, param_all);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < count; ++i) {
|
||||
type = ompi_cmd_line_get_param(cmd_line, "param", i, 0);
|
||||
module = ompi_cmd_line_get_param(cmd_line, "param", i, 1);
|
||||
component = ompi_cmd_line_get_param(cmd_line, "param", i, 1);
|
||||
|
||||
for (found = false, i = 0; i < mca_types.size(); ++i) {
|
||||
if (mca_types[i] == type) {
|
||||
@ -90,13 +91,13 @@ void ompi_info::do_params()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
show_mca_params(type, module, param_all);
|
||||
show_mca_params(type, component, param_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::show_mca_params(const string& type, const string& module,
|
||||
void ompi_info::show_mca_params(const string& type, const string& component,
|
||||
const string& param)
|
||||
{
|
||||
size_t i, size;
|
||||
@ -112,10 +113,10 @@ void ompi_info::show_mca_params(const string& type, const string& module,
|
||||
for (i = 0; i < size; ++i) {
|
||||
item = &(OMPI_VALUE_ARRAY_GET_ITEM(&mca_base_params, mca_base_param_t, i));
|
||||
if (type == item->mbp_type_name) {
|
||||
if (module == module_all ||
|
||||
NULL == item->mbp_module_name ||
|
||||
(NULL != item->mbp_module_name &&
|
||||
module == item->mbp_module_name)) {
|
||||
if (component == component_all ||
|
||||
NULL == item->mbp_component_name ||
|
||||
(NULL != item->mbp_component_name &&
|
||||
component == item->mbp_component_name)) {
|
||||
if (param == param_all || param == item->mbp_param_name) {
|
||||
|
||||
// Make a string for the default value
|
||||
@ -162,8 +163,8 @@ void ompi_info::show_mca_params(const string& type, const string& module,
|
||||
message += item->mbp_type_name;
|
||||
message += ":";
|
||||
|
||||
if (item->mbp_module_name != NULL) {
|
||||
message += item->mbp_module_name;
|
||||
if (item->mbp_component_name != NULL) {
|
||||
message += item->mbp_component_name;
|
||||
} else {
|
||||
message += "base";
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ const string ompi_info::ver_svn = "svn";
|
||||
static const string ver_all = "all";
|
||||
static const string ver_mca = "mca";
|
||||
static const string ver_type = "type";
|
||||
static const string ver_module = "module";
|
||||
static const string ver_component = "component";
|
||||
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
||||
static void show_mca_version(const mca_base_module_t *module,
|
||||
static void show_mca_version(const mca_base_module_t *component,
|
||||
const string& scope, const string& ver_type);
|
||||
static string make_version_str(const string& scope,
|
||||
int major, int minor, int release, int alpha,
|
||||
@ -51,25 +51,25 @@ static string make_version_str(const string& scope,
|
||||
//
|
||||
// do_version
|
||||
//
|
||||
// Determines the version information related to the ompi modules
|
||||
// Determines the version information related to the ompi components
|
||||
// being used.
|
||||
// Accepts:
|
||||
// - want_all: True if all modules' info is required.
|
||||
// - want_all: True if all components' info is required.
|
||||
// - cmd_line: The constructed command line argument
|
||||
//
|
||||
void ompi_info::do_version(bool want_all, ompi_cmd_line_t *cmd_line)
|
||||
{
|
||||
unsigned int count;
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
string arg1, scope, type, module;
|
||||
string arg1, scope, type, component;
|
||||
string::size_type pos;
|
||||
|
||||
open_modules();
|
||||
open_components();
|
||||
|
||||
if (want_all) {
|
||||
show_ompi_version(ver_full);
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
show_module_version(mca_types[i], module_all, ver_full, type_all);
|
||||
show_component_version(mca_types[i], component_all, ver_full, type_all);
|
||||
}
|
||||
} else {
|
||||
count = ompi_cmd_line_get_ninsts(cmd_line, "version");
|
||||
@ -83,19 +83,19 @@ void ompi_info::do_version(bool want_all, ompi_cmd_line_t *cmd_line)
|
||||
show_ompi_version(scope);
|
||||
}
|
||||
|
||||
// Specific type and module
|
||||
// Specific type and component
|
||||
|
||||
else if (string::npos != (pos = arg1.find(':'))) {
|
||||
type = arg1.substr(0, pos - 1);
|
||||
module = arg1.substr(pos);
|
||||
component = arg1.substr(pos);
|
||||
|
||||
show_module_version(type, module, scope, ver_all);
|
||||
show_component_version(type, component, scope, ver_all);
|
||||
}
|
||||
|
||||
// All modules of a specific type
|
||||
// All components of a specific type
|
||||
|
||||
else {
|
||||
show_module_version(arg1, module_all, scope, ver_all);
|
||||
show_component_version(arg1, component_all, scope, ver_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,20 +117,20 @@ void ompi_info::show_ompi_version(const string& scope)
|
||||
|
||||
|
||||
//
|
||||
// Show all the modules of a specific type/module combo (module may be
|
||||
// Show all the components of a specific type/component combo (component may be
|
||||
// a wildcard)
|
||||
//
|
||||
void ompi_info::show_module_version(const string& type_name,
|
||||
const string& module_name,
|
||||
void ompi_info::show_component_version(const string& type_name,
|
||||
const string& component_name,
|
||||
const string& scope, const string& ver_type)
|
||||
{
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
bool want_all_modules = (type_all == module_name);
|
||||
bool want_all_components = (type_all == component_name);
|
||||
bool found;
|
||||
ompi_list_item *item;
|
||||
mca_base_module_list_item_t *mli;
|
||||
const mca_base_module_t *module;
|
||||
ompi_list_t *modules;
|
||||
const mca_base_module_t *component;
|
||||
ompi_list_t *components;
|
||||
|
||||
// Check to see if the type is valid
|
||||
|
||||
@ -148,17 +148,18 @@ void ompi_info::show_module_version(const string& type_name,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Now that we have a valid type, find the right module list
|
||||
// Now that we have a valid type, find the right component list
|
||||
|
||||
modules = module_map[type_name];
|
||||
if (NULL != modules) {
|
||||
for (item = ompi_list_get_first(modules);
|
||||
ompi_list_get_end(modules) != item;
|
||||
components = component_map[type_name];
|
||||
if (NULL != components) {
|
||||
for (item = ompi_list_get_first(components);
|
||||
ompi_list_get_end(components) != item;
|
||||
item = ompi_list_get_next(item)) {
|
||||
mli = (mca_base_module_list_item_t *) item;
|
||||
module = mli->mli_module;
|
||||
if (want_all_modules || module->mca_module_name == module_name) {
|
||||
show_mca_version(module, scope, ver_type);
|
||||
component = mli->mli_module;
|
||||
if (want_all_components ||
|
||||
component->mca_module_name == component_name) {
|
||||
show_mca_version(component, scope, ver_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,38 +167,38 @@ void ompi_info::show_module_version(const string& type_name,
|
||||
|
||||
|
||||
//
|
||||
// Given a module, display its relevant version(s)
|
||||
// Given a component, display its relevant version(s)
|
||||
//
|
||||
static void show_mca_version(const mca_base_module_t* module,
|
||||
static void show_mca_version(const mca_base_module_t* component,
|
||||
const string& scope, const string& ver_type)
|
||||
{
|
||||
bool printed;
|
||||
bool want_mca = (ver_all == ver_type || ver_type == ver_mca);
|
||||
bool want_type = (ver_all == ver_type || ver_type == ver_type);
|
||||
bool want_module = (ver_all == ver_type || ver_type == ver_module);
|
||||
bool want_component = (ver_all == ver_type || ver_type == ver_component);
|
||||
string message, content;
|
||||
string mca_version;
|
||||
string api_version;
|
||||
string module_version;
|
||||
string component_version;
|
||||
string empty;
|
||||
|
||||
mca_version = make_version_str(scope, module->mca_major_version,
|
||||
module->mca_minor_version,
|
||||
module->mca_release_version, 0, 0, "");
|
||||
api_version = make_version_str(scope, module->mca_type_major_version,
|
||||
module->mca_type_minor_version,
|
||||
module->mca_type_release_version, 0, 0, "");
|
||||
module_version = make_version_str(scope, module->mca_module_major_version,
|
||||
module->mca_module_minor_version,
|
||||
module->mca_module_release_version,
|
||||
mca_version = make_version_str(scope, component->mca_major_version,
|
||||
component->mca_minor_version,
|
||||
component->mca_release_version, 0, 0, "");
|
||||
api_version = make_version_str(scope, component->mca_type_major_version,
|
||||
component->mca_type_minor_version,
|
||||
component->mca_type_release_version, 0, 0, "");
|
||||
component_version = make_version_str(scope, component->mca_module_major_version,
|
||||
component->mca_module_minor_version,
|
||||
component->mca_module_release_version,
|
||||
0, 0, "");
|
||||
|
||||
if (pretty) {
|
||||
message = "MCA ";
|
||||
message += module->mca_type_name;
|
||||
message += component->mca_type_name;
|
||||
printed = false;
|
||||
|
||||
content = module->mca_module_name + string(" (");
|
||||
content = component->mca_module_name + string(" (");
|
||||
if (want_mca) {
|
||||
content += "MCA v" + mca_version;
|
||||
printed = true;
|
||||
@ -208,25 +209,25 @@ static void show_mca_version(const mca_base_module_t* module,
|
||||
content += "API v" + api_version;
|
||||
printed = true;
|
||||
}
|
||||
if (want_module) {
|
||||
if (want_component) {
|
||||
if (printed)
|
||||
content += ", ";
|
||||
content += "Module v" + module_version;
|
||||
content += "Component v" + component_version;
|
||||
printed = true;
|
||||
}
|
||||
out(message, empty, content + ")");
|
||||
} else {
|
||||
message = "mca:";
|
||||
message += module->mca_type_name;
|
||||
message += component->mca_type_name;
|
||||
message += ":";
|
||||
message += module->mca_module_name;
|
||||
message += component->mca_module_name;
|
||||
message += ":version";
|
||||
if (want_mca)
|
||||
out(empty, message, "mca:" + mca_version);
|
||||
if (want_type)
|
||||
out(empty, message, "api:" + api_version);
|
||||
if (want_module)
|
||||
out(empty, message, "module:" + module_version);
|
||||
if (want_component)
|
||||
out(empty, message, "component:" + component_version);
|
||||
}
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user