Split up laminfo into smaller, more managable pieces
This commit was SVN r480.
Этот коммит содержится в:
родитель
7e2845a187
Коммит
c563eae37b
@ -5,7 +5,7 @@
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
AM_CPPFLAGS = \
|
||||
-DLAM_PREFIX="\"$(prefix)\"" \
|
||||
-DLAM_BINDIR="\"$(bindir)\"" \
|
||||
-DLAM_LIBDIR="\"$(libdir)\"" \
|
||||
@ -16,21 +16,18 @@ AM_CPPFLAGS = \
|
||||
-DLAM_CONFIGURE_HOST="\"@LAM_CONFIGURE_HOST@\"" \
|
||||
-DLAM_CONFIGURE_DATE="\"@LAM_CONFIGURE_DATE@\""
|
||||
|
||||
base = $(top_builddir)/src
|
||||
if WANT_SINGLE_MPI_LIBRARY
|
||||
liblam =
|
||||
libmpi = $(base)/libmpi.la
|
||||
else
|
||||
liblam = $(base)/lam/liblam.la
|
||||
libmpi = $(base)/mpi/libmpi.la
|
||||
endif
|
||||
libs = $(libmpi) $(liblam)
|
||||
libs = $(LIBMPI_LA)
|
||||
|
||||
bin_PROGRAMS = laminfo
|
||||
laminfo_SOURCES = laminfo.cc
|
||||
laminfo_LDADD = $(libs) $(LIBMPI_EXTRA_LIBS) $(LIBLAM_EXTRA_LIBS)
|
||||
laminfo_LDFLAGS = $(LIBMPI_EXTRA_LDFLAGS) $(LIBLAM_EXTRA_LDFLAGS)
|
||||
laminfo_DEPENDENCIES = $(libs)
|
||||
bin_PROGRAMS = laminfo
|
||||
laminfo_SOURCES = \
|
||||
laminfo.cc \
|
||||
modules.cc \
|
||||
output.cc \
|
||||
param.cc \
|
||||
version.cc
|
||||
laminfo_LDADD = $(libs) $(LIBMPI_EXTRA_LIBS) $(LIBLAM_EXTRA_LIBS)
|
||||
laminfo_LDFLAGS = $(LIBMPI_EXTRA_LDFLAGS) $(LIBLAM_EXTRA_LDFLAGS)
|
||||
laminfo_DEPENDENCIES = $(libs)
|
||||
|
||||
clean-local:
|
||||
test -z "$(LAM_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(LAM_CXX_TEMPLATE_REPOSITORY)
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
142
src/tools/laminfo/modules.cc
Обычный файл
142
src/tools/laminfo/modules.cc
Обычный файл
@ -0,0 +1,142 @@
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "tools/laminfo/laminfo.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace laminfo;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
laminfo::module_map_t laminfo::module_map;
|
||||
|
||||
|
||||
//
|
||||
// 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
|
||||
// out the environment of all LAM_MPI_mca_<type> variables to ensure
|
||||
// that the open algorithms don't try to only open one module.
|
||||
//
|
||||
void laminfo::open_modules()
|
||||
{
|
||||
laminfo::type_list_t::size_type i;
|
||||
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) {
|
||||
env = "LAM_MPI_mca_" + mca_types[i];
|
||||
if (NULL != getenv(env.c_str())) {
|
||||
env += "=";
|
||||
target = strdup(env.c_str());
|
||||
putenv(target);
|
||||
}
|
||||
}
|
||||
|
||||
// Open all modules
|
||||
|
||||
mca_base_open();
|
||||
|
||||
#if 0
|
||||
// pcm module opening not implemented yet
|
||||
mca_pcm_open();
|
||||
module_map("pcm") = mca_pcm_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// oob module opening not implemented yet
|
||||
mca_oob_open();
|
||||
module_map("oob") = mca_oob_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// registry module opening not implemented yet
|
||||
mca_registry_open();
|
||||
module_map("registry") = mca_registry_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// coll module opening not implemented yet
|
||||
mca_coll_open();
|
||||
module_map("coll") = mca_coll_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// io module opening not implemented yet
|
||||
mca_io_open();
|
||||
module_map("io") = mca_io_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// one module opening not implemented yet
|
||||
mca_one_open();
|
||||
module_map("one") = mca_one_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// pml module opening not implemented yet
|
||||
mca_pml_open();
|
||||
module_map("pml") = mca_pml_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// ptl module opening not implemented yet
|
||||
mca_ptl_open();
|
||||
module_map("ptl") = mca_ptl_base_module_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// topo module opening not implemented yet
|
||||
mca_topo_open();
|
||||
module_map("topo") = mca_topo_base_module_list;
|
||||
#endif
|
||||
|
||||
// All done
|
||||
|
||||
opened_modules = true;
|
||||
}
|
||||
|
||||
|
||||
void laminfo::close_modules()
|
||||
{
|
||||
if (opened_modules) {
|
||||
#if 0
|
||||
mca_crmpi_base_close();
|
||||
mca_coll_base_close();
|
||||
mca_pml_base_close();
|
||||
mca_boot_close();
|
||||
mca_base_close();
|
||||
#endif
|
||||
|
||||
module_map.clear();
|
||||
}
|
||||
|
||||
opened_modules = false;
|
||||
}
|
99
src/tools/laminfo/output.cc
Обычный файл
99
src/tools/laminfo/output.cc
Обычный файл
@ -0,0 +1,99 @@
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
/** @file **/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "tools/laminfo/laminfo.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace laminfo;
|
||||
|
||||
#define LAM_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
||||
//
|
||||
// Private variables
|
||||
//
|
||||
|
||||
static int centerpoint = 20;
|
||||
static int screen_width = 78;
|
||||
|
||||
|
||||
//
|
||||
// Prints the passed strings in a pretty or parsable format.
|
||||
//
|
||||
void laminfo::out(const string& pretty_message, const string &plain_message,
|
||||
const string& value)
|
||||
{
|
||||
if (pretty) {
|
||||
string::size_type pos, max_value_width;
|
||||
string spaces(LAM_max(centerpoint - pretty_message.length(), 0), ' ');
|
||||
string v = value;
|
||||
string filler;
|
||||
|
||||
max_value_width = screen_width - spaces.length() -
|
||||
pretty_message.length() - 2;
|
||||
filler = spaces + pretty_message + ": ";
|
||||
|
||||
while (true) {
|
||||
if (v.length() < max_value_width) {
|
||||
cout << filler << v << endl;
|
||||
break;
|
||||
} else {
|
||||
string spaces(centerpoint + 2, ' ');
|
||||
|
||||
// Work backwards to find the first space before
|
||||
// max_value_width
|
||||
|
||||
pos = v.rfind(' ', max_value_width);
|
||||
if (string::npos == pos) {
|
||||
|
||||
// No space found < max_value_width. Look for the first
|
||||
// space after max_value_width.
|
||||
|
||||
pos = v.find(' ', max_value_width);
|
||||
|
||||
if (string::npos == pos) {
|
||||
|
||||
// There's just no spaces. So just print it and be done.
|
||||
|
||||
cout << filler << v << endl;
|
||||
break;
|
||||
} else {
|
||||
cout << filler << v.substr(0, pos) << endl;
|
||||
v = v.substr(pos + 1);
|
||||
}
|
||||
} else {
|
||||
cout << filler << v.substr(0, pos) << endl;
|
||||
v = v.substr(pos + 1);
|
||||
}
|
||||
|
||||
// Reset for the next iteration
|
||||
|
||||
filler = spaces;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cout << plain_message << ":" << value << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Prints the passed integer in a pretty or parsable format.
|
||||
//
|
||||
void laminfo::out(const string& pretty_message, const string &plain_message,
|
||||
int value)
|
||||
{
|
||||
if (laminfo::pretty) {
|
||||
string spaces(LAM_max(centerpoint - pretty_message.length(), 0), ' ');
|
||||
cout << spaces << pretty_message << ": " << value << endl;
|
||||
} else {
|
||||
cout << plain_message << ":" << value << endl;
|
||||
}
|
||||
}
|
353
src/tools/laminfo/param.cc
Обычный файл
353
src/tools/laminfo/param.cc
Обычный файл
@ -0,0 +1,353 @@
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#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";
|
||||
|
||||
|
||||
void laminfo::do_params(bool want_all)
|
||||
{
|
||||
unsigned int count;
|
||||
string type, module;
|
||||
bool found;
|
||||
laminfo::type_list_t::size_type i;
|
||||
|
||||
if (want_all) {
|
||||
show_mca_params(type_all, module_all, param_all);
|
||||
} else {
|
||||
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);
|
||||
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)
|
||||
{
|
||||
#if 0
|
||||
// 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];
|
||||
string message, content;
|
||||
|
||||
// Ensure that we've opened the modules (so that they can register
|
||||
// their parameters).
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
if (type == type_all || type == array[i].lsbp_type_name) {
|
||||
if (module == module_all ||
|
||||
(array[i].lsbp_module_name != NULL &&
|
||||
module == array[i].lsbp_module_name)) {
|
||||
if (param == param_all || param == array[i].lsbp_param_name) {
|
||||
|
||||
// Make a string for the default value
|
||||
|
||||
temp[0] = '\0';
|
||||
if (array[i].lsbp_type == LAM_MCA_BASE_PARAM_TYPE_STRING) {
|
||||
if (array[i].lsbp_default_value.stringval != NULL)
|
||||
default_value_string = array[i].lsbp_default_value.stringval;
|
||||
else
|
||||
default_value_string = temp;
|
||||
} else {
|
||||
default_value_string = temp;
|
||||
snprintf(default_value_string, BUFSIZ, "%d",
|
||||
array[i].lsbp_default_value.intval);
|
||||
}
|
||||
content = default_value_string;
|
||||
|
||||
// Build up the strings to output.
|
||||
|
||||
if (pretty) {
|
||||
message = "MCA ";
|
||||
message += array[i].lsbp_type_name;
|
||||
|
||||
// Put in the real, full name (which may be different than
|
||||
// the categorization).
|
||||
|
||||
content = (array[i].lsbp_env_var_name != NULL) ?
|
||||
"parameter \"" : "information \"";
|
||||
content += array[i].lsbp_full_name;
|
||||
content += (array[i].lsbp_env_var_name != NULL) ?
|
||||
"\" (default value: " : "\" (value: ";
|
||||
|
||||
if (strlen(default_value_string) == 0)
|
||||
content += "<none>)";
|
||||
else {
|
||||
content += "\"";
|
||||
content += default_value_string;
|
||||
content += "\")";
|
||||
}
|
||||
|
||||
out(message, message, content);
|
||||
} else {
|
||||
message = "mca:";
|
||||
message += array[i].lsbp_type_name;
|
||||
message += ":";
|
||||
|
||||
if (array[i].lsbp_module_name != NULL) {
|
||||
message += array[i].lsbp_module_name;
|
||||
} else {
|
||||
message += "base";
|
||||
}
|
||||
message += (array[i].lsbp_env_var_name != NULL) ?
|
||||
":param:" : ":info:";
|
||||
|
||||
// Put in the real, full name (which may be different than
|
||||
// the categorization).
|
||||
|
||||
message += array[i].lsbp_full_name;
|
||||
|
||||
content = default_value_string;
|
||||
|
||||
out(message, message, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // Nullifying the function
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
const string f77(LAM_ENABLE_MPI_F77 ? "yes" : "no");
|
||||
const string f90(LAM_ENABLE_MPI_F90 ? "yes" : "no");
|
||||
const string sthreads(LAM_HAVE_SOLARIS_THREADS ? "yes" : "no");
|
||||
const string pthreads(LAM_HAVE_POSIX_THREADS ? "yes" : "no");
|
||||
#if 0
|
||||
// Anju:
|
||||
// These are the options that will definately be added along the
|
||||
// line. So, I am compiling them out instead of deleting them
|
||||
const string romio(LAM_WANT_ROMIO ? "yes" : "no");
|
||||
const string impi(LAM_WANT_IMPI ? "yes" : "no");
|
||||
#endif
|
||||
const string memzero(LAM_ENABLE_MEM_ZERO ? "yes" : "no");
|
||||
const string debug(LAM_ENABLE_DEBUG ? "yes" : "no");
|
||||
const string cprofiling(LAM_WANT_MPI_PROFILING ? "yes" : "no");
|
||||
const string cxxprofiling(LAM_WANT_MPI_PROFILING ? "yes" : "no");
|
||||
const string f77profiling((LAM_WANT_MPI_PROFILING && LAM_ENABLE_MPI_F77) ?
|
||||
"yes" : "no");
|
||||
const string f90profiling((LAM_WANT_MPI_PROFILING && LAM_ENABLE_MPI_F90) ?
|
||||
"yes" : "no");
|
||||
const string cxxexceptions(LAM_HAVE_CXX_EXCEPTION_SUPPORT ? "yes" : "no");
|
||||
|
||||
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 *));
|
||||
#if 0
|
||||
// Anju:
|
||||
// Not yet gotten to this part in LAM-10.
|
||||
//
|
||||
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);
|
||||
out("C double align", "compiler:c:align:double",
|
||||
LAM_ALIGNMENT_DOUBLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
out("C++ compiler", "compiler:cxx:command", LAM_CXX);
|
||||
|
||||
out("Fortran77 compiler", "compiler:f77:command", LAM_F77);
|
||||
out("Fortran90 compiler", "compiler:f90:command", LAM_F90);
|
||||
if (want_all) {
|
||||
#if 0
|
||||
// Anju:
|
||||
// Not yet gotten to this part in LAM-10.
|
||||
//
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
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);
|
||||
out("Posix thread support", "option:threads", pthreads);
|
||||
out("Solaris thread support", "option:threads", sthreads);
|
||||
#if 0
|
||||
// Anju:
|
||||
// Someday even this should be presented as information
|
||||
out("ROMIO support", "option:romio", romio);
|
||||
out("IMPI support", "option:impi", impi);
|
||||
#endif
|
||||
out("Memory zeroing clean", "option:memzero", memzero);
|
||||
out("Debug support", "option:debug", debug);
|
||||
}
|
282
src/tools/laminfo/version.cc
Обычный файл
282
src/tools/laminfo/version.cc
Обычный файл
@ -0,0 +1,282 @@
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tools/laminfo/laminfo.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace laminfo;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
const string laminfo::ver_full = "full";
|
||||
const string laminfo::ver_major = "major";
|
||||
const string laminfo::ver_minor = "minor";
|
||||
const string laminfo::ver_release = "release";
|
||||
const string laminfo::ver_alpha = "alpha";
|
||||
const string laminfo::ver_beta = "beta";
|
||||
const string laminfo::ver_cvs = "cvs";
|
||||
|
||||
//
|
||||
// Private variables
|
||||
//
|
||||
|
||||
static const string ver_all = "all";
|
||||
static const string ver_mca = "mca";
|
||||
static const string ver_type = "type";
|
||||
static const string ver_module = "module";
|
||||
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
||||
static void show_module_version(const string& type_name,
|
||||
const string& module_name,
|
||||
const string& scope, const string& ver_type);
|
||||
static void show_mca_version(const mca_base_module_t *module,
|
||||
const string& scope, const string& ver_type);
|
||||
static string make_version_str(const string& scope,
|
||||
int major, int minor, int release, int alpha,
|
||||
int beta, int cvs);
|
||||
|
||||
//
|
||||
// do_version
|
||||
//
|
||||
// Determines the version information related to the lam modules
|
||||
// being used.
|
||||
// Accepts:
|
||||
// - want_all: True if all modules' info is required.
|
||||
// - cmd_line: The constructed command line argument
|
||||
//
|
||||
void laminfo::do_version(bool want_all, lam_cmd_line_t *cmd_line)
|
||||
{
|
||||
unsigned int count;
|
||||
laminfo::type_list_t::size_type i;
|
||||
string arg1, scope, type, module;
|
||||
string::size_type pos;
|
||||
|
||||
open_modules();
|
||||
|
||||
if (want_all) {
|
||||
show_lam_version(ver_full);
|
||||
for (i = 0; i < mca_types.size(); ++i)
|
||||
show_module_version(mca_types[i], module_all, ver_full, type_all);
|
||||
} else {
|
||||
count = lam_cmd_line_get_ninsts(cmd_line, "version");
|
||||
for (i = 0; i < count; ++i) {
|
||||
arg1 = lam_cmd_line_get_param(cmd_line, "version", i, 0);
|
||||
scope = lam_cmd_line_get_param(cmd_line, "version", i, 1);
|
||||
|
||||
// Version of LAM/MPI
|
||||
|
||||
if (type_lam == arg1) {
|
||||
show_lam_version(scope);
|
||||
}
|
||||
|
||||
// Specific type and module
|
||||
|
||||
else if (string::npos != (pos = arg1.find(':'))) {
|
||||
type = arg1.substr(0, pos - 1);
|
||||
module = arg1.substr(pos);
|
||||
|
||||
show_module_version(type, module, scope, ver_all);
|
||||
}
|
||||
|
||||
// All modules of a specific type
|
||||
|
||||
else {
|
||||
show_module_version(arg1, module_all, scope, ver_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Show the version of LAM/MPI
|
||||
//
|
||||
void laminfo::show_lam_version(const string& scope)
|
||||
{
|
||||
out("LAM/MPI", "version:" + type_lam,
|
||||
make_version_str(scope,
|
||||
LAM_MAJOR_VERSION, LAM_MINOR_VERSION,
|
||||
LAM_RELEASE_VERSION,
|
||||
LAM_ALPHA_VERSION, LAM_BETA_VERSION, LAM_CVS_VERSION));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Show all the modules of a specific type/module combo (module may be
|
||||
// a wildcard)
|
||||
//
|
||||
static void show_module_version(const string& type_name,
|
||||
const string& module_name,
|
||||
const string& scope, const string& ver_type)
|
||||
{
|
||||
laminfo::type_list_t::size_type i;
|
||||
bool want_all_modules = (type_all == module_name);
|
||||
bool found;
|
||||
lam_list_item *item;
|
||||
mca_base_module_t *module;
|
||||
lam_list_t *modules;
|
||||
|
||||
// Check to see if the type is valid
|
||||
|
||||
for (found = false, i = 0; i < mca_types.size(); ++i) {
|
||||
if (mca_types[i] == type_name) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
#if 0
|
||||
show_help("laminfo", "usage");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Now that we have a valid type, find the right module list
|
||||
|
||||
modules = module_map[type_name];
|
||||
for (item = lam_list_get_first(modules);
|
||||
lam_list_get_last(modules) != item;
|
||||
item = lam_list_get_next(item)) {
|
||||
module = (mca_base_module_t *) item;
|
||||
if (want_all_modules || module->mca_module_name == module_name) {
|
||||
show_mca_version(module, scope, ver_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Given a module, display its relevant version(s)
|
||||
//
|
||||
static void show_mca_version(const mca_base_module_t* module,
|
||||
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);
|
||||
string message, content;
|
||||
string mca_version;
|
||||
string api_version;
|
||||
string module_version;
|
||||
string empty;
|
||||
|
||||
mca_version = make_version_str(scope, module->mca_major_version,
|
||||
module->mca_minor_version,
|
||||
module->mca_release_version, 0, 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, 0);
|
||||
module_version = make_version_str(scope, module->mca_module_major_version,
|
||||
module->mca_module_minor_version,
|
||||
module->mca_module_release_version,
|
||||
0, 0, 0);
|
||||
|
||||
if (pretty) {
|
||||
message = "MCA ";
|
||||
message += module->mca_type_name;
|
||||
printed = false;
|
||||
|
||||
content = module->mca_module_name + string(" (");
|
||||
if (want_mca) {
|
||||
content += "MCA v" + mca_version;
|
||||
printed = true;
|
||||
}
|
||||
if (want_type) {
|
||||
if (printed)
|
||||
content += ", ";
|
||||
content += "API v" + api_version;
|
||||
printed = true;
|
||||
}
|
||||
if (want_module) {
|
||||
if (printed)
|
||||
content += ", ";
|
||||
content += "Module v" + module_version;
|
||||
printed = true;
|
||||
}
|
||||
out(message, empty, content + ")");
|
||||
} else {
|
||||
message = "mca:";
|
||||
message += module->mca_type_name;
|
||||
message += ":";
|
||||
message += module->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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static string make_version_str(const string& scope,
|
||||
int major, int minor, int release, int alpha,
|
||||
int beta, int cvs)
|
||||
{
|
||||
string str;
|
||||
char temp[BUFSIZ];
|
||||
|
||||
temp[BUFSIZ - 1] = '\0';
|
||||
if (scope == ver_full) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d.%d", major, minor);
|
||||
str = temp;
|
||||
if (release > 0) {
|
||||
snprintf(temp, BUFSIZ - 1, ".%d", release);
|
||||
str += temp;
|
||||
}
|
||||
if (alpha > 0) {
|
||||
snprintf(temp, BUFSIZ - 1, "a%d", alpha);
|
||||
str += temp;
|
||||
}
|
||||
else if (beta > 0) {
|
||||
snprintf(temp, BUFSIZ - 1, "b%d", beta);
|
||||
str += temp;
|
||||
}
|
||||
if (cvs > 0) {
|
||||
str += "cvs";
|
||||
if (cvs > 1) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d", cvs);
|
||||
str += temp;
|
||||
}
|
||||
}
|
||||
} else if (scope == ver_major)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", major);
|
||||
else if (scope == ver_minor)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", minor);
|
||||
else if (scope == ver_release)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", release);
|
||||
else if (scope == ver_alpha)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", alpha);
|
||||
else if (scope == ver_beta)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", beta);
|
||||
else if (scope == ver_cvs)
|
||||
snprintf(temp, BUFSIZ - 1, "%d", cvs);
|
||||
else {
|
||||
#if 0
|
||||
show_help("laminfo", "usage");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (str.empty())
|
||||
str = temp;
|
||||
|
||||
return str;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user