2004-01-19 17:43:50 +00:00
|
|
|
//
|
|
|
|
// $HEADER$
|
|
|
|
//
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
#include "ompi_config.h"
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "mca/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"
|
2004-06-07 15:33:53 +00:00
|
|
|
#include "tools/ompi_info/ompi_info.h"
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
using namespace std;
|
2004-06-07 15:33:53 +00:00
|
|
|
using namespace ompi_info;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Public variables
|
|
|
|
//
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_info::module_map_t ompi_info::module_map;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Private variables
|
|
|
|
//
|
|
|
|
|
|
|
|
static bool opened_modules = false;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Open all MCA modules 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
|
2004-06-07 15:33:53 +00:00
|
|
|
// out the environment of all OMPI_MPI_mca_<type> variables to ensure
|
2004-01-19 17:43:50 +00:00
|
|
|
// that the open algorithms don't try to only open one module.
|
|
|
|
//
|
2004-06-07 15:33:53 +00:00
|
|
|
void ompi_info::open_modules()
|
2004-01-19 17:43:50 +00:00
|
|
|
{
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_info::type_vector_t::size_type i;
|
2004-01-19 17:43:50 +00:00
|
|
|
string env;
|
|
|
|
char *target;
|
|
|
|
|
|
|
|
if (opened_modules)
|
|
|
|
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) {
|
2004-06-07 15:33:53 +00:00
|
|
|
env = "OMPI_MPI_MCA_" + mca_types[i];
|
2004-01-19 17:43:50 +00:00
|
|
|
if (NULL != getenv(env.c_str())) {
|
|
|
|
env += "=";
|
|
|
|
target = strdup(env.c_str());
|
|
|
|
putenv(target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open all modules
|
|
|
|
|
|
|
|
mca_base_open();
|
2004-02-13 22:17:42 +00:00
|
|
|
module_map["base"] = NULL;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
2004-01-22 00:38:29 +00:00
|
|
|
mca_pcm_base_open();
|
|
|
|
module_map["pcm"] = &mca_pcm_base_modules_available;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
// oob module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_oob_base_open();
|
2004-07-01 14:49:54 +00:00
|
|
|
module_map["oob"] = &mca_oob_base_components;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
// coll module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_coll_base_open();
|
2004-06-29 00:02:25 +00:00
|
|
|
module_map["coll"] = &mca_coll_base_components_opened;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
// io module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_io_base_open();
|
|
|
|
module_map["io"] = &mca_io_base_modules_available;
|
2004-02-13 22:17:42 +00:00
|
|
|
#else
|
|
|
|
module_map["io"] = NULL;
|
2004-01-19 17:43:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
// one module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_one_base_open();
|
|
|
|
module_map["one"] = &mca_one_base_modules_available;
|
2004-02-13 22:17:42 +00:00
|
|
|
#else
|
|
|
|
module_map["one"] = NULL;
|
2004-01-19 17:43:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// pml module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_pml_base_open();
|
|
|
|
module_map["pml"] = &mca_pml_base_modules_available;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
// ptl module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_ptl_base_open();
|
|
|
|
module_map["ptl"] = &mca_ptl_base_modules_available;
|
2004-01-19 17:43:50 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
// topo module opening not implemented yet
|
2004-01-29 02:51:20 +00:00
|
|
|
mca_topo_base_open();
|
|
|
|
module_map["topo"] = &mca_topo_base_modules_available;
|
2004-02-13 22:17:42 +00:00
|
|
|
#else
|
|
|
|
module_map["topo"] = NULL;
|
2004-01-19 17:43:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// All done
|
|
|
|
|
|
|
|
opened_modules = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
void ompi_info::close_modules()
|
2004-01-19 17:43:50 +00:00
|
|
|
{
|
|
|
|
if (opened_modules) {
|
2004-01-22 00:38:29 +00:00
|
|
|
mca_pcm_base_close();
|
2004-01-31 21:48:58 +00:00
|
|
|
mca_oob_base_close();
|
2004-01-30 03:59:17 +00:00
|
|
|
mca_coll_base_close();
|
2004-01-19 17:43:50 +00:00
|
|
|
mca_pml_base_close();
|
2004-01-31 21:48:58 +00:00
|
|
|
mca_ptl_base_close();
|
2004-01-19 17:43:50 +00:00
|
|
|
|
2004-01-31 21:48:58 +00:00
|
|
|
mca_base_close();
|
2004-01-19 17:43:50 +00:00
|
|
|
module_map.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
opened_modules = false;
|
|
|
|
}
|