2004-01-19 20:43:50 +03:00
|
|
|
//
|
|
|
|
// $HEADER$
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "lam_config.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
2004-01-30 01:10:58 +03:00
|
|
|
#include <map>
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "lfc/lam_value_array.h"
|
|
|
|
#include "mca/base/mca_base_param.h"
|
2004-01-19 20:43:50 +03:00
|
|
|
#include "tools/laminfo/laminfo.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace laminfo;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Public variables
|
|
|
|
//
|
|
|
|
|
|
|
|
string laminfo::module_all = "all";
|
|
|
|
string laminfo::param_all = "all";
|
|
|
|
|
|
|
|
string laminfo::path_prefix = "prefix";
|
|
|
|
string laminfo::path_bindir = "bindir";
|
|
|
|
string laminfo::path_libdir = "libdir";
|
|
|
|
string laminfo::path_incdir = "incdir";
|
|
|
|
string laminfo::path_pkglibdir = "pkglibdir";
|
|
|
|
string laminfo::path_sysconfdir = "sysconfdir";
|
|
|
|
|
2004-01-30 01:10:58 +03:00
|
|
|
//
|
|
|
|
// External variables
|
|
|
|
//
|
2004-03-17 21:45:16 +03:00
|
|
|
// This exists in mca/base/mca_base_param.c. It's not extern'ed
|
2004-01-30 01:10:58 +03:00
|
|
|
// in mca_base_param.h so that no one else will use it.
|
|
|
|
//
|
|
|
|
|
2004-02-11 01:37:47 +03:00
|
|
|
extern lam_value_array_t mca_base_params;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-01-30 01:10:58 +03:00
|
|
|
|
|
|
|
void laminfo::do_params()
|
2004-01-19 20:43:50 +03:00
|
|
|
{
|
|
|
|
unsigned int count;
|
|
|
|
string type, module;
|
2004-01-30 01:10:58 +03:00
|
|
|
bool found, want_all;
|
|
|
|
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
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
if (want_all) {
|
2004-01-30 01:10:58 +03:00
|
|
|
for (i = 0; i < mca_types.size(); ++i) {
|
|
|
|
show_mca_params(mca_types[i], module_all, param_all);
|
|
|
|
}
|
2004-01-19 20:43:50 +03:00
|
|
|
} else {
|
|
|
|
for (i = 0; i < count; ++i) {
|
|
|
|
type = lam_cmd_line_get_param(cmd_line, "param", i, 0);
|
|
|
|
module = lam_cmd_line_get_param(cmd_line, "param", i, 1);
|
|
|
|
|
|
|
|
for (found = false, i = 0; i < mca_types.size(); ++i) {
|
|
|
|
if (mca_types[i] == type) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
#if 0
|
|
|
|
show_help("laminfo", "usage");
|
|
|
|
#endif
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
show_mca_params(type, module, param_all);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void laminfo::show_mca_params(const string& type, const string& module,
|
|
|
|
const string& param)
|
|
|
|
{
|
2004-01-30 01:10:58 +03:00
|
|
|
size_t i, size;
|
2004-01-19 20:43:50 +03:00
|
|
|
char *default_value_string, temp[BUFSIZ];
|
|
|
|
string message, content;
|
2004-01-30 01:10:58 +03:00
|
|
|
mca_base_param_t *item;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-02-11 01:37:47 +03:00
|
|
|
size = lam_value_array_get_size(&mca_base_params);
|
2004-01-30 01:10:58 +03:00
|
|
|
if (0 == size) {
|
2004-01-19 20:43:50 +03:00
|
|
|
return;
|
2004-01-30 01:10:58 +03:00
|
|
|
}
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
for (i = 0; i < size; ++i) {
|
2004-02-11 01:37:47 +03:00
|
|
|
item = &(LAM_VALUE_ARRAY_GET_ITEM(&mca_base_params, mca_base_param_t, i));
|
2004-01-30 01:10:58 +03:00
|
|
|
if (type == item->mbp_type_name) {
|
2004-01-19 20:43:50 +03:00
|
|
|
if (module == module_all ||
|
2004-01-30 01:10:58 +03:00
|
|
|
NULL == item->mbp_module_name ||
|
|
|
|
(NULL != item->mbp_module_name &&
|
|
|
|
module == item->mbp_module_name)) {
|
|
|
|
if (param == param_all || param == item->mbp_param_name) {
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
// Make a string for the default value
|
|
|
|
|
|
|
|
temp[0] = '\0';
|
2004-01-30 01:10:58 +03:00
|
|
|
if (item->mbp_type == MCA_BASE_PARAM_TYPE_STRING) {
|
|
|
|
if (item->mbp_default_value.stringval != NULL)
|
|
|
|
default_value_string = item->mbp_default_value.stringval;
|
2004-01-19 20:43:50 +03:00
|
|
|
else
|
|
|
|
default_value_string = temp;
|
|
|
|
} else {
|
|
|
|
default_value_string = temp;
|
|
|
|
snprintf(default_value_string, BUFSIZ, "%d",
|
2004-01-30 01:10:58 +03:00
|
|
|
item->mbp_default_value.intval);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
content = default_value_string;
|
|
|
|
|
|
|
|
// Build up the strings to output.
|
|
|
|
|
|
|
|
if (pretty) {
|
|
|
|
message = "MCA ";
|
2004-01-30 01:10:58 +03:00
|
|
|
message += item->mbp_type_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
// Put in the real, full name (which may be different than
|
|
|
|
// the categorization).
|
|
|
|
|
2004-01-30 01:10:58 +03:00
|
|
|
content = (item->mbp_env_var_name != NULL) ?
|
2004-01-19 20:43:50 +03:00
|
|
|
"parameter \"" : "information \"";
|
2004-01-30 01:10:58 +03:00
|
|
|
content += item->mbp_full_name;
|
|
|
|
content += (item->mbp_env_var_name != NULL) ?
|
2004-02-10 02:58:37 +03:00
|
|
|
"\" (default: " : "\" (value: ";
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
if (strlen(default_value_string) == 0)
|
|
|
|
content += "<none>)";
|
|
|
|
else {
|
|
|
|
content += "\"";
|
|
|
|
content += default_value_string;
|
|
|
|
content += "\")";
|
|
|
|
}
|
|
|
|
|
|
|
|
out(message, message, content);
|
|
|
|
} else {
|
|
|
|
message = "mca:";
|
2004-01-30 01:10:58 +03:00
|
|
|
message += item->mbp_type_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
message += ":";
|
|
|
|
|
2004-01-30 01:10:58 +03:00
|
|
|
if (item->mbp_module_name != NULL) {
|
|
|
|
message += item->mbp_module_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
} else {
|
|
|
|
message += "base";
|
|
|
|
}
|
2004-01-30 01:10:58 +03:00
|
|
|
message += (item->mbp_env_var_name != NULL) ?
|
2004-01-19 20:43:50 +03:00
|
|
|
":param:" : ":info:";
|
|
|
|
|
|
|
|
// Put in the real, full name (which may be different than
|
|
|
|
// the categorization).
|
|
|
|
|
2004-01-30 01:10:58 +03:00
|
|
|
message += item->mbp_full_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
content = default_value_string;
|
|
|
|
|
|
|
|
out(message, message, content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void laminfo::do_path(bool want_all, lam_cmd_line_t *cmd_line)
|
|
|
|
{
|
|
|
|
int i, count;
|
|
|
|
string scope;
|
|
|
|
|
|
|
|
if (want_all) {
|
|
|
|
show_path(path_prefix, LAM_PREFIX);
|
|
|
|
show_path(path_bindir, LAM_BINDIR);
|
|
|
|
show_path(path_libdir, LAM_LIBDIR);
|
|
|
|
show_path(path_incdir, LAM_INCDIR);
|
|
|
|
show_path(path_pkglibdir, LAM_PKGLIBDIR);
|
|
|
|
show_path(path_sysconfdir, LAM_SYSCONFDIR);
|
|
|
|
} else {
|
|
|
|
count = lam_cmd_line_get_ninsts(cmd_line, "path");
|
|
|
|
for (i = 0; i < count; ++i) {
|
|
|
|
scope = lam_cmd_line_get_param(cmd_line, "path", i, 0);
|
|
|
|
|
|
|
|
if (path_prefix == scope)
|
|
|
|
show_path(path_prefix, LAM_PREFIX);
|
|
|
|
else if (path_bindir == scope)
|
|
|
|
show_path(path_bindir, LAM_BINDIR);
|
|
|
|
else if (path_libdir == scope)
|
|
|
|
show_path(path_libdir, LAM_LIBDIR);
|
|
|
|
else if (path_incdir == scope)
|
|
|
|
show_path(path_incdir, LAM_INCDIR);
|
|
|
|
else if (path_pkglibdir == scope)
|
|
|
|
show_path(path_pkglibdir, LAM_PKGLIBDIR);
|
|
|
|
else if (path_sysconfdir == scope)
|
|
|
|
show_path(path_sysconfdir, LAM_SYSCONFDIR);
|
|
|
|
else {
|
|
|
|
#if 0
|
|
|
|
show_help("laminfo", "usage");
|
|
|
|
#endif
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void laminfo::show_path(const string& type, const string& value)
|
|
|
|
{
|
|
|
|
string pretty(type);
|
|
|
|
pretty[0] &= toupper(pretty[0]);
|
|
|
|
|
|
|
|
out(pretty, "path:" + type, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void laminfo::do_arch(lam_cmd_line_t *cmd_line)
|
|
|
|
{
|
|
|
|
string prefix;
|
|
|
|
char hostname[MAXHOSTNAMELEN];
|
|
|
|
|
|
|
|
if (lam_cmd_line_is_taken(cmd_line, "hostname")) {
|
|
|
|
gethostname(hostname, MAXHOSTNAMELEN);
|
|
|
|
prefix = hostname + string(":");
|
|
|
|
}
|
|
|
|
out("Architecture", prefix + "arch", LAM_ARCH);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// do_config
|
|
|
|
// Accepts:
|
|
|
|
// - want_all: boolean flag; TRUE -> display all options
|
|
|
|
// FALSE -> display selected options
|
|
|
|
//
|
|
|
|
// This function displays all the options with which the current
|
|
|
|
// installation of lam was configured. There are many options here
|
|
|
|
// that are carried forward from LAM-7 and are not mca parameters
|
|
|
|
// in LAM-10. I have to dig through the invalid options and replace
|
|
|
|
// them with LAM-10 options.
|
|
|
|
//
|
|
|
|
void laminfo::do_config(bool want_all)
|
|
|
|
{
|
2004-03-28 14:02:38 +04:00
|
|
|
const string f77(LAM_WANT_F77_BINDINGS ? "yes" : "no");
|
|
|
|
const string f90(LAM_WANT_F90_BINDINGS ? "yes" : "no");
|
2004-01-19 20:43:50 +03:00
|
|
|
const string sthreads(LAM_HAVE_SOLARIS_THREADS ? "yes" : "no");
|
|
|
|
const string pthreads(LAM_HAVE_POSIX_THREADS ? "yes" : "no");
|
2004-02-10 02:58:37 +03:00
|
|
|
const string memprofile(LAM_ENABLE_MEM_PROFILE ? "yes" : "no");
|
|
|
|
const string memdebug(LAM_ENABLE_MEM_DEBUG ? "yes" : "no");
|
2004-01-19 20:43:50 +03:00
|
|
|
const string debug(LAM_ENABLE_DEBUG ? "yes" : "no");
|
2004-02-10 22:34:58 +03:00
|
|
|
const string cprofiling(LAM_ENABLE_MPI_PROFILING ? "yes" : "no");
|
|
|
|
const string cxxprofiling(LAM_ENABLE_MPI_PROFILING ? "yes" : "no");
|
2004-03-28 14:02:38 +04:00
|
|
|
const string f77profiling((LAM_ENABLE_MPI_PROFILING && LAM_WANT_F77_BINDINGS) ?
|
2004-01-19 20:43:50 +03:00
|
|
|
"yes" : "no");
|
2004-03-28 14:02:38 +04:00
|
|
|
const string f90profiling((LAM_ENABLE_MPI_PROFILING && LAM_WANT_F90_BINDINGS) ?
|
2004-01-19 20:43:50 +03:00
|
|
|
"yes" : "no");
|
|
|
|
const string cxxexceptions(LAM_HAVE_CXX_EXCEPTION_SUPPORT ? "yes" : "no");
|
2004-02-14 01:17:42 +03:00
|
|
|
int lam_mpi_param_check = 3;
|
|
|
|
const string paramcheck(0 == MPI_PARAM_CHECK ? "never" :
|
|
|
|
1 == MPI_PARAM_CHECK ? "always" : "runtime");
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
out("Configured by", "config:user", LAM_CONFIGURE_USER);
|
|
|
|
out("Configured on", "config:timestamp", LAM_CONFIGURE_DATE);
|
|
|
|
out("Configure host", "config:host", LAM_CONFIGURE_HOST);
|
|
|
|
|
|
|
|
out("C bindings", "bindings:c", "yes");
|
|
|
|
out("C++ bindings", "bindings:cxx", "yes");
|
|
|
|
out("Fortran77 bindings", "bindings:f77", f77);
|
|
|
|
out("Fortran90 bindings", "bindings:f90", f90);
|
|
|
|
|
|
|
|
out("C compiler", "compiler:c:command", LAM_CC);
|
|
|
|
|
|
|
|
if (want_all) {
|
|
|
|
out("C char size", "compiler:c:sizeof:char", sizeof(char));
|
|
|
|
out("C bool size", "compiler:c:sizeof:bool", sizeof(bool));
|
|
|
|
out("C short size", "compiler:c:sizeof:short", sizeof(short));
|
|
|
|
out("C int size", "compiler:c:sizeof:int", sizeof(int));
|
|
|
|
out("C long size", "compiler:c:sizeof:long", sizeof(long));
|
|
|
|
out("C float size", "compiler:c:sizeof:float", sizeof(float));
|
|
|
|
out("C double size", "compiler:c:sizeof:double", sizeof(double));
|
|
|
|
out("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *));
|
|
|
|
out("C char align", "compiler:c:align:char", LAM_ALIGNMENT_CHAR);
|
|
|
|
out("C bool align", "compiler:c:align:bool", LAM_ALIGNMENT_CXX_BOOL);
|
|
|
|
out("C int align", "compiler:c:align:int", LAM_ALIGNMENT_INT);
|
|
|
|
out("C float align", "compiler:c:align:float", LAM_ALIGNMENT_FLOAT);
|
2004-02-14 01:17:42 +03:00
|
|
|
out("C double align", "compiler:c:align:double", LAM_ALIGNMENT_DOUBLE);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
out("C++ compiler", "compiler:cxx:command", LAM_CXX);
|
|
|
|
|
|
|
|
out("Fortran77 compiler", "compiler:f77:command", LAM_F77);
|
|
|
|
out("Fortran90 compiler", "compiler:f90:command", LAM_F90);
|
2004-03-16 22:23:24 +03:00
|
|
|
|
2004-01-19 20:43:50 +03:00
|
|
|
if (want_all) {
|
|
|
|
out("Fort integer size", "compiler:fortran:sizeof:integer",
|
|
|
|
LAM_SIZEOF_FORTRAN_INT);
|
|
|
|
out("Fort real size", "compiler:fortran:sizeof:real",
|
|
|
|
LAM_SIZEOF_FORTRAN_REAL);
|
|
|
|
out("Fort dbl prec size",
|
|
|
|
"compiler:fortran:sizeof:double_precision", LAM_SIZEOF_FORTRAN_REAL);
|
|
|
|
out("Fort cplx size", "compiler:fortran:sizeof:complex",
|
|
|
|
LAM_SIZEOF_FORTRAN_REAL);
|
|
|
|
out("Fort dbl cplx size",
|
|
|
|
"compiler:fortran:sizeof:double_complex",
|
|
|
|
LAM_SIZEOF_FORTRAN_REAL);
|
|
|
|
|
|
|
|
out("Fort integer align", "compiler:fortran:align:integer",
|
|
|
|
LAM_ALIGNMENT_FORTRAN_INT);
|
|
|
|
out("Fort real align", "compiler:fortran:align:real",
|
|
|
|
LAM_ALIGNMENT_FORTRAN_REAL);
|
|
|
|
out("Fort dbl prec align",
|
|
|
|
"compiler:fortran:align:double_precision", LAM_ALIGNMENT_FORTRAN_REAL);
|
|
|
|
out("Fort cplx align", "compiler:fortran:align:complex",
|
|
|
|
LAM_ALIGNMENT_FORTRAN_REAL);
|
|
|
|
out("Fort dbl cplx align",
|
|
|
|
"compiler:fortran:align:double_complex",
|
|
|
|
LAM_ALIGNMENT_FORTRAN_REAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
out("C profiling", "option:profiling:c", cprofiling);
|
|
|
|
out("C++ profiling", "option:profiling:cxx", cxxprofiling);
|
|
|
|
out("Fortran77 profiling", "option:profiling:f77", f77profiling);
|
|
|
|
out("Fortran90 profiling", "option:profiling:f90", f90profiling);
|
|
|
|
|
|
|
|
out("C++ exceptions", "option:cxx_exceptions", cxxexceptions);
|
2004-02-14 06:39:59 +03:00
|
|
|
out("POSIX thread support", "option:pthreads", pthreads);
|
|
|
|
out("Solaris thread support", "option:solaris_threads", sthreads);
|
2004-02-10 02:58:37 +03:00
|
|
|
|
2004-01-19 20:43:50 +03:00
|
|
|
out("Debug support", "option:debug", debug);
|
2004-02-14 01:17:42 +03:00
|
|
|
out("MPI parameter check", "option:mpi-param-check", paramcheck);
|
2004-02-10 02:58:37 +03:00
|
|
|
out("Memory profiling support", "option:mem-profile", memprofile);
|
|
|
|
out("Memory debugging support", "option:mem-debug", memdebug);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|