1
1
openmpi/src/tools/ompi_info/components.cc

184 строки
4.0 KiB
C++
Исходник Обычный вид История

//
// $HEADER$
//
#include "ompi_config.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <string.h>
#include "mca/base/base.h"
#include "mca/allocator/allocator.h"
#include "mca/allocator/base/base.h"
#include "mca/mpool/mpool.h"
#include "mca/mpool/base/base.h"
#include "mca/llm/llm.h"
#include "mca/llm/base/base.h"
#include "mca/pcm/pcm.h"
#include "mca/pcm/base/base.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"
#include "mca/pml/pml.h"
#include "mca/pml/base/base.h"
#include "mca/ptl/ptl.h"
#include "mca/ptl/base/base.h"
#include "mca/coll/coll.h"
#include "mca/coll/base/base.h"
#include "mca/ns/ns.h"
#include "mca/ns/base/base.h"
#include "mca/topo/topo.h"
#include "mca/topo/base/base.h"
#include "tools/ompi_info/ompi_info.h"
using namespace std;
using namespace ompi_info;
//
// Public variables
//
ompi_info::component_map_t ompi_info::component_map;
//
// Private variables
//
static bool opened_components = false;
//
// Open all MCA components so that they can register their MCA
// parameters. Take a shotgun approach here and indiscriminately open
// 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 component.
//
void ompi_info::open_components()
{
ompi_info::type_vector_t::size_type i;
string env;
char *target;
if (opened_components)
return;
// Clear out the environment. Use strdup() to orphan the resulting
// strings because items are placed in the environment by reference,
// not by value.
for (i = 0; i < mca_types.size(); ++i) {
env = "OMPI_MPI_MCA_" + mca_types[i];
if (NULL != getenv(env.c_str())) {
env += "=";
target = strdup(env.c_str());
putenv(target);
}
}
// Find / open all components
mca_base_open();
component_map["base"] = NULL;
mca_allocator_base_open();
component_map["allocator"] = &mca_allocator_base_components;
mca_coll_base_open();
component_map["coll"] = &mca_coll_base_components_opened;
#if 0
// common component framework not implemented yet
mca_common_base_open();
component_map["common"] = &mca_common_base_components_opened;
#else
component_map["common"] = NULL;
#endif
#if 0
// waiting for gpr to be implemented
mca_gpr_base_open();
component_map["gpr"] = &mca_ns_base_components_available;
#else
component_map["gpr"] = NULL;
#endif
mca_llm_base_open();
component_map["llm"] = &mca_llm_base_components_available;
#if 0
// io component opening not implemented yet
mca_io_base_open();
component_map["io"] = &mca_io_base_components_available;
#else
component_map["io"] = NULL;
#endif
mca_ns_base_open();
component_map["ns"] = &mca_ns_base_components_available;
mca_mpool_base_open();
component_map["mpool"] = &mca_mpool_base_components;
#if 0
// one component opening not implemented yet
mca_one_base_open();
component_map["one"] = &mca_one_base_components_available;
#else
component_map["one"] = NULL;
#endif
mca_oob_base_open();
component_map["oob"] = &mca_oob_base_components;
#if 0
// op component framework not yet implemented
mca_op_base_open();
component_map["op"] = &mca_oob_base_components;
#else
component_map["op"] = NULL;
#endif
mca_pcm_base_open();
- massive change for module<-->component name fixes throughout the code base. - many (most) mca type names have "component" or "module" in them, as relevant, just to further distinguish the difference between component data/actions and module data/actions. All developers are encouraged to perpetuate this convention when you create types that are specific to a framework, component, or module - did very little to entire framework (just the basics to make it compile) because it's just about to be almost entirely replaced - ditto for io / romio - did not work on elan or ib components; have to commit and then convert those on a different machine with the right libraries and headers - renamed a bunch of *_module.c files to *_component.c and *module*c to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.) - modified autogen/configure/build process to match new filenames (e.g., output static-components.h instead of static-modules.h) - removed DOS-style cr/lf stuff in ns/ns.h - added newline to end of file src/util/numtostr.h - removed some redundant error checking in the top-level topo functions - added a few {} here and there where people "forgot" to put them in for 1 line blocks ;-) - removed a bunch of MPI_* types from mca header files (replaced with corresponding ompi_* types) - all the ptl components had version numbers in their structs; removed - converted a few more elements in the MCA base to use the OBJ interface -- removed some old manual reference counting kruft This commit was SVN r1830.
2004-08-02 00:24:22 +00:00
component_map["pcm"] = &mca_pcm_base_components_available;
mca_pml_base_open();
- massive change for module<-->component name fixes throughout the code base. - many (most) mca type names have "component" or "module" in them, as relevant, just to further distinguish the difference between component data/actions and module data/actions. All developers are encouraged to perpetuate this convention when you create types that are specific to a framework, component, or module - did very little to entire framework (just the basics to make it compile) because it's just about to be almost entirely replaced - ditto for io / romio - did not work on elan or ib components; have to commit and then convert those on a different machine with the right libraries and headers - renamed a bunch of *_module.c files to *_component.c and *module*c to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.) - modified autogen/configure/build process to match new filenames (e.g., output static-components.h instead of static-modules.h) - removed DOS-style cr/lf stuff in ns/ns.h - added newline to end of file src/util/numtostr.h - removed some redundant error checking in the top-level topo functions - added a few {} here and there where people "forgot" to put them in for 1 line blocks ;-) - removed a bunch of MPI_* types from mca header files (replaced with corresponding ompi_* types) - all the ptl components had version numbers in their structs; removed - converted a few more elements in the MCA base to use the OBJ interface -- removed some old manual reference counting kruft This commit was SVN r1830.
2004-08-02 00:24:22 +00:00
component_map["pml"] = &mca_pml_base_components_available;
mca_ptl_base_open();
- massive change for module<-->component name fixes throughout the code base. - many (most) mca type names have "component" or "module" in them, as relevant, just to further distinguish the difference between component data/actions and module data/actions. All developers are encouraged to perpetuate this convention when you create types that are specific to a framework, component, or module - did very little to entire framework (just the basics to make it compile) because it's just about to be almost entirely replaced - ditto for io / romio - did not work on elan or ib components; have to commit and then convert those on a different machine with the right libraries and headers - renamed a bunch of *_module.c files to *_component.c and *module*c to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.) - modified autogen/configure/build process to match new filenames (e.g., output static-components.h instead of static-modules.h) - removed DOS-style cr/lf stuff in ns/ns.h - added newline to end of file src/util/numtostr.h - removed some redundant error checking in the top-level topo functions - added a few {} here and there where people "forgot" to put them in for 1 line blocks ;-) - removed a bunch of MPI_* types from mca header files (replaced with corresponding ompi_* types) - all the ptl components had version numbers in their structs; removed - converted a few more elements in the MCA base to use the OBJ interface -- removed some old manual reference counting kruft This commit was SVN r1830.
2004-08-02 00:24:22 +00:00
component_map["ptl"] = &mca_ptl_base_components_available;
mca_topo_base_open();
- massive change for module<-->component name fixes throughout the code base. - many (most) mca type names have "component" or "module" in them, as relevant, just to further distinguish the difference between component data/actions and module data/actions. All developers are encouraged to perpetuate this convention when you create types that are specific to a framework, component, or module - did very little to entire framework (just the basics to make it compile) because it's just about to be almost entirely replaced - ditto for io / romio - did not work on elan or ib components; have to commit and then convert those on a different machine with the right libraries and headers - renamed a bunch of *_module.c files to *_component.c and *module*c to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.) - modified autogen/configure/build process to match new filenames (e.g., output static-components.h instead of static-modules.h) - removed DOS-style cr/lf stuff in ns/ns.h - added newline to end of file src/util/numtostr.h - removed some redundant error checking in the top-level topo functions - added a few {} here and there where people "forgot" to put them in for 1 line blocks ;-) - removed a bunch of MPI_* types from mca header files (replaced with corresponding ompi_* types) - all the ptl components had version numbers in their structs; removed - converted a few more elements in the MCA base to use the OBJ interface -- removed some old manual reference counting kruft This commit was SVN r1830.
2004-08-02 00:24:22 +00:00
component_map["topo"] = &mca_topo_base_components_opened;
// All done
opened_components = true;
}
void ompi_info::close_components()
{
if (opened_components) {
mca_pcm_base_close();
mca_oob_base_close();
mca_ns_base_close();
mca_coll_base_close();
mca_pml_base_close();
mca_ptl_base_close();
mca_topo_base_close();
mca_mpool_base_close();
mca_llm_base_close();
mca_allocator_base_close();
mca_base_close();
component_map.clear();
}
opened_components = false;
}