Now have ability to show MCA parameters
This commit was SVN r595.
Этот коммит содержится в:
родитель
dba3562f52
Коммит
2e4aa358fb
@ -8,6 +8,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -218,7 +219,7 @@ lam_cmd_line_t *laminfo::cmd_line = NULL;
|
|||||||
const string laminfo::type_all = "all";
|
const string laminfo::type_all = "all";
|
||||||
const string laminfo::type_lam = "lam";
|
const string laminfo::type_lam = "lam";
|
||||||
const string laminfo::type_base = "base";
|
const string laminfo::type_base = "base";
|
||||||
laminfo::type_list_t laminfo::mca_types;
|
laminfo::type_vector_t laminfo::mca_types;
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -321,7 +322,7 @@ int main(int argc, char *argv[])
|
|||||||
acted = true;
|
acted = true;
|
||||||
}
|
}
|
||||||
if (want_all || lam_cmd_line_is_taken(cmd_line, "param")) {
|
if (want_all || lam_cmd_line_is_taken(cmd_line, "param")) {
|
||||||
do_params(want_all);
|
do_params();
|
||||||
acted = true;
|
acted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace laminfo {
|
|||||||
// Globals
|
// Globals
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef std::vector<std::string> type_list_t;
|
typedef std::vector<std::string> type_vector_t;
|
||||||
|
|
||||||
extern bool pretty;
|
extern bool pretty;
|
||||||
extern lam_cmd_line_t *cmd_line;
|
extern lam_cmd_line_t *cmd_line;
|
||||||
@ -28,7 +28,7 @@ namespace laminfo {
|
|||||||
extern const std::string type_all;
|
extern const std::string type_all;
|
||||||
extern const std::string type_lam;
|
extern const std::string type_lam;
|
||||||
extern const std::string type_base;
|
extern const std::string type_base;
|
||||||
extern type_list_t mca_types;
|
extern type_vector_t mca_types;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Version-related strings and functions
|
// Version-related strings and functions
|
||||||
@ -63,7 +63,7 @@ namespace laminfo {
|
|||||||
extern std::string path_pkglibdir;
|
extern std::string path_pkglibdir;
|
||||||
extern std::string path_sysconfdir;
|
extern std::string path_sysconfdir;
|
||||||
|
|
||||||
void do_params(bool want_all);
|
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& module,
|
||||||
const std::string& param);
|
const std::string& param);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ static bool opened_modules = false;
|
|||||||
//
|
//
|
||||||
void laminfo::open_modules()
|
void laminfo::open_modules()
|
||||||
{
|
{
|
||||||
laminfo::type_list_t::size_type i;
|
laminfo::type_vector_t::size_type i;
|
||||||
string env;
|
string env;
|
||||||
char *target;
|
char *target;
|
||||||
|
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
#include "mca/lam/base/mca_base_param.h"
|
||||||
#include "tools/laminfo/laminfo.h"
|
#include "tools/laminfo/laminfo.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -30,18 +32,47 @@ string laminfo::path_incdir = "incdir";
|
|||||||
string laminfo::path_pkglibdir = "pkglibdir";
|
string laminfo::path_pkglibdir = "pkglibdir";
|
||||||
string laminfo::path_sysconfdir = "sysconfdir";
|
string laminfo::path_sysconfdir = "sysconfdir";
|
||||||
|
|
||||||
|
//
|
||||||
|
// External variables
|
||||||
|
//
|
||||||
|
// This exists in mca/lam/base/mca_base_param.c. It's not extern'ed
|
||||||
|
// in mca_base_param.h so that no one else will use it.
|
||||||
|
//
|
||||||
|
|
||||||
void laminfo::do_params(bool want_all)
|
extern lam_array_t mca_base_params;
|
||||||
|
|
||||||
|
|
||||||
|
void laminfo::do_params()
|
||||||
{
|
{
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
string type, module;
|
string type, module;
|
||||||
bool found;
|
bool found, want_all;
|
||||||
laminfo::type_list_t::size_type i;
|
laminfo::type_vector_t::size_type i;
|
||||||
|
|
||||||
|
laminfo::open_modules();
|
||||||
|
|
||||||
|
// See if the special param "all" was givin to --param; that
|
||||||
|
// superceeds any individual type
|
||||||
|
|
||||||
|
want_all = false;
|
||||||
|
count = lam_cmd_line_get_ninsts(cmd_line, "param");
|
||||||
|
for (i = 0; i < count; ++i) {
|
||||||
|
type = lam_cmd_line_get_param(cmd_line, "param", i, 0);
|
||||||
|
if (type_all == type) {
|
||||||
|
want_all = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the params
|
||||||
|
|
||||||
if (want_all) {
|
if (want_all) {
|
||||||
show_mca_params(type_all, module_all, param_all);
|
show_mca_params("lam", module_all, param_all);
|
||||||
|
show_mca_params("mpi", module_all, param_all);
|
||||||
|
for (i = 0; i < mca_types.size(); ++i) {
|
||||||
|
show_mca_params(mca_types[i], module_all, param_all);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
count = lam_cmd_line_get_ninsts(cmd_line, "param");
|
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i) {
|
||||||
type = lam_cmd_line_get_param(cmd_line, "param", i, 0);
|
type = lam_cmd_line_get_param(cmd_line, "param", i, 0);
|
||||||
module = lam_cmd_line_get_param(cmd_line, "param", i, 1);
|
module = lam_cmd_line_get_param(cmd_line, "param", i, 1);
|
||||||
@ -69,49 +100,37 @@ void laminfo::do_params(bool want_all)
|
|||||||
void laminfo::show_mca_params(const string& type, const string& module,
|
void laminfo::show_mca_params(const string& type, const string& module,
|
||||||
const string& param)
|
const string& param)
|
||||||
{
|
{
|
||||||
#if 0
|
size_t i, size;
|
||||||
// Anju:
|
|
||||||
// This datatype has not been incorporated as yet. Yet to
|
|
||||||
// decide how this will come into picture.
|
|
||||||
lam_mca_base_param_t *array;
|
|
||||||
int i, size;
|
|
||||||
char *default_value_string, temp[BUFSIZ];
|
char *default_value_string, temp[BUFSIZ];
|
||||||
string message, content;
|
string message, content;
|
||||||
|
mca_base_param_t *item;
|
||||||
|
|
||||||
// Ensure that we've opened the modules (so that they can register
|
size = lam_arr_get_size(&mca_base_params);
|
||||||
// their parameters).
|
if (0 == size) {
|
||||||
|
|
||||||
open_modules();
|
|
||||||
// Anju:
|
|
||||||
// Since this whole function is built on the premise of
|
|
||||||
// "lam_mca_base_param_t" and this enum (see lam_mca.h)
|
|
||||||
// is not supported, it is best to not do anything right
|
|
||||||
// now about this function
|
|
||||||
if (mca_base_params == NULL)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
size = lam_arr_size(mca_base_params);
|
|
||||||
array = (lam_mca_base_param_t*) lam_arr_get(mca_base_params);
|
|
||||||
|
|
||||||
for (i = 0; i < size; ++i) {
|
for (i = 0; i < size; ++i) {
|
||||||
if (type == type_all || type == array[i].lsbp_type_name) {
|
item = (mca_base_param_t *) lam_arr_get_item(&mca_base_params, i);
|
||||||
|
if (type == item->mbp_type_name) {
|
||||||
if (module == module_all ||
|
if (module == module_all ||
|
||||||
(array[i].lsbp_module_name != NULL &&
|
NULL == item->mbp_module_name ||
|
||||||
module == array[i].lsbp_module_name)) {
|
(NULL != item->mbp_module_name &&
|
||||||
if (param == param_all || param == array[i].lsbp_param_name) {
|
module == item->mbp_module_name)) {
|
||||||
|
if (param == param_all || param == item->mbp_param_name) {
|
||||||
|
|
||||||
// Make a string for the default value
|
// Make a string for the default value
|
||||||
|
|
||||||
temp[0] = '\0';
|
temp[0] = '\0';
|
||||||
if (array[i].lsbp_type == LAM_MCA_BASE_PARAM_TYPE_STRING) {
|
if (item->mbp_type == MCA_BASE_PARAM_TYPE_STRING) {
|
||||||
if (array[i].lsbp_default_value.stringval != NULL)
|
if (item->mbp_default_value.stringval != NULL)
|
||||||
default_value_string = array[i].lsbp_default_value.stringval;
|
default_value_string = item->mbp_default_value.stringval;
|
||||||
else
|
else
|
||||||
default_value_string = temp;
|
default_value_string = temp;
|
||||||
} else {
|
} else {
|
||||||
default_value_string = temp;
|
default_value_string = temp;
|
||||||
snprintf(default_value_string, BUFSIZ, "%d",
|
snprintf(default_value_string, BUFSIZ, "%d",
|
||||||
array[i].lsbp_default_value.intval);
|
item->mbp_default_value.intval);
|
||||||
}
|
}
|
||||||
content = default_value_string;
|
content = default_value_string;
|
||||||
|
|
||||||
@ -119,15 +138,15 @@ void laminfo::show_mca_params(const string& type, const string& module,
|
|||||||
|
|
||||||
if (pretty) {
|
if (pretty) {
|
||||||
message = "MCA ";
|
message = "MCA ";
|
||||||
message += array[i].lsbp_type_name;
|
message += item->mbp_type_name;
|
||||||
|
|
||||||
// Put in the real, full name (which may be different than
|
// Put in the real, full name (which may be different than
|
||||||
// the categorization).
|
// the categorization).
|
||||||
|
|
||||||
content = (array[i].lsbp_env_var_name != NULL) ?
|
content = (item->mbp_env_var_name != NULL) ?
|
||||||
"parameter \"" : "information \"";
|
"parameter \"" : "information \"";
|
||||||
content += array[i].lsbp_full_name;
|
content += item->mbp_full_name;
|
||||||
content += (array[i].lsbp_env_var_name != NULL) ?
|
content += (item->mbp_env_var_name != NULL) ?
|
||||||
"\" (default value: " : "\" (value: ";
|
"\" (default value: " : "\" (value: ";
|
||||||
|
|
||||||
if (strlen(default_value_string) == 0)
|
if (strlen(default_value_string) == 0)
|
||||||
@ -141,21 +160,21 @@ void laminfo::show_mca_params(const string& type, const string& module,
|
|||||||
out(message, message, content);
|
out(message, message, content);
|
||||||
} else {
|
} else {
|
||||||
message = "mca:";
|
message = "mca:";
|
||||||
message += array[i].lsbp_type_name;
|
message += item->mbp_type_name;
|
||||||
message += ":";
|
message += ":";
|
||||||
|
|
||||||
if (array[i].lsbp_module_name != NULL) {
|
if (item->mbp_module_name != NULL) {
|
||||||
message += array[i].lsbp_module_name;
|
message += item->mbp_module_name;
|
||||||
} else {
|
} else {
|
||||||
message += "base";
|
message += "base";
|
||||||
}
|
}
|
||||||
message += (array[i].lsbp_env_var_name != NULL) ?
|
message += (item->mbp_env_var_name != NULL) ?
|
||||||
":param:" : ":info:";
|
":param:" : ":info:";
|
||||||
|
|
||||||
// Put in the real, full name (which may be different than
|
// Put in the real, full name (which may be different than
|
||||||
// the categorization).
|
// the categorization).
|
||||||
|
|
||||||
message += array[i].lsbp_full_name;
|
message += item->mbp_full_name;
|
||||||
|
|
||||||
content = default_value_string;
|
content = default_value_string;
|
||||||
|
|
||||||
@ -165,7 +184,6 @@ void laminfo::show_mca_params(const string& type, const string& module,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // Nullifying the function
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static string make_version_str(const string& scope,
|
|||||||
void laminfo::do_version(bool want_all, lam_cmd_line_t *cmd_line)
|
void laminfo::do_version(bool want_all, lam_cmd_line_t *cmd_line)
|
||||||
{
|
{
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
laminfo::type_list_t::size_type i;
|
laminfo::type_vector_t::size_type i;
|
||||||
string arg1, scope, type, module;
|
string arg1, scope, type, module;
|
||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void laminfo::show_module_version(const string& type_name,
|
|||||||
const string& module_name,
|
const string& module_name,
|
||||||
const string& scope, const string& ver_type)
|
const string& scope, const string& ver_type)
|
||||||
{
|
{
|
||||||
laminfo::type_list_t::size_type i;
|
laminfo::type_vector_t::size_type i;
|
||||||
bool want_all_modules = (type_all == module_name);
|
bool want_all_modules = (type_all == module_name);
|
||||||
bool found;
|
bool found;
|
||||||
lam_list_item *item;
|
lam_list_item *item;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user