2004-01-19 20:43:50 +03:00
|
|
|
//
|
2004-11-22 04:38:40 +03:00
|
|
|
// Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
// All rights reserved.
|
|
|
|
// Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
// All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
// University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
// Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
// All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
// $COPYRIGHT$
|
|
|
|
//
|
|
|
|
// Additional copyrights may follow
|
|
|
|
//
|
2004-01-19 20:43:50 +03:00
|
|
|
// $HEADER$
|
|
|
|
//
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-01-29 05:51:20 +03:00
|
|
|
#include <iostream>
|
2004-01-19 20:43:50 +03:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mca/base/base.h"
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "tools/ompi_info/ompi_info.h"
|
2005-07-04 06:16:57 +04:00
|
|
|
#include "opal/util/printf.h"
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
using namespace std;
|
2004-06-07 19:33:53 +04:00
|
|
|
using namespace ompi_info;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Public variables
|
|
|
|
//
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
const string ompi_info::ver_full = "full";
|
|
|
|
const string ompi_info::ver_major = "major";
|
|
|
|
const string ompi_info::ver_minor = "minor";
|
|
|
|
const string ompi_info::ver_release = "release";
|
2005-09-27 06:06:05 +04:00
|
|
|
const string ompi_info::ver_greek = "greek";
|
2004-06-07 19:33:53 +04:00
|
|
|
const string ompi_info::ver_svn = "svn";
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// Private variables
|
|
|
|
//
|
|
|
|
|
|
|
|
static const string ver_all = "all";
|
|
|
|
static const string ver_mca = "mca";
|
|
|
|
static const string ver_type = "type";
|
2004-07-14 00:25:12 +04:00
|
|
|
static const string ver_component = "component";
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Private functions
|
|
|
|
//
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
static void show_mca_version(const mca_base_component_t *component,
|
2004-01-19 20:43:50 +03:00
|
|
|
const string& scope, const string& ver_type);
|
|
|
|
static string make_version_str(const string& scope,
|
2005-09-27 06:06:05 +04:00
|
|
|
int major, int minor, int release,
|
|
|
|
const string& greek,
|
|
|
|
bool want_svn, const string& svn);
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// do_version
|
|
|
|
//
|
2004-07-14 00:25:12 +04:00
|
|
|
// Determines the version information related to the ompi components
|
2004-01-19 20:43:50 +03:00
|
|
|
// being used.
|
|
|
|
// Accepts:
|
2004-07-14 00:25:12 +04:00
|
|
|
// - want_all: True if all components' info is required.
|
2004-01-19 20:43:50 +03:00
|
|
|
// - cmd_line: The constructed command line argument
|
|
|
|
//
|
2005-07-04 04:13:44 +04:00
|
|
|
void ompi_info::do_version(bool want_all, opal_cmd_line_t *cmd_line)
|
2004-01-19 20:43:50 +03:00
|
|
|
{
|
|
|
|
unsigned int count;
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_info::type_vector_t::size_type i;
|
2004-07-14 00:25:12 +04:00
|
|
|
string arg1, scope, type, component;
|
2004-01-19 20:43:50 +03:00
|
|
|
string::size_type pos;
|
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
open_components();
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
if (want_all) {
|
2004-06-07 19:33:53 +04:00
|
|
|
show_ompi_version(ver_full);
|
2004-01-30 06:59:17 +03:00
|
|
|
for (i = 0; i < mca_types.size(); ++i) {
|
2004-07-14 00:25:12 +04:00
|
|
|
show_component_version(mca_types[i], component_all, ver_full, type_all);
|
2004-01-30 06:59:17 +03:00
|
|
|
}
|
2004-01-19 20:43:50 +03:00
|
|
|
} else {
|
2005-07-04 04:13:44 +04:00
|
|
|
count = opal_cmd_line_get_ninsts(cmd_line, "version");
|
2004-01-19 20:43:50 +03:00
|
|
|
for (i = 0; i < count; ++i) {
|
2005-07-04 04:13:44 +04:00
|
|
|
arg1 = opal_cmd_line_get_param(cmd_line, "version", i, 0);
|
|
|
|
scope = opal_cmd_line_get_param(cmd_line, "version", i, 1);
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-08-06 18:30:18 +04:00
|
|
|
// Version of Open MPI
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if (type_ompi == arg1) {
|
|
|
|
show_ompi_version(scope);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
// Specific type and component
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
else if (string::npos != (pos = arg1.find(':'))) {
|
|
|
|
type = arg1.substr(0, pos - 1);
|
2004-07-14 00:25:12 +04:00
|
|
|
component = arg1.substr(pos);
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
show_component_version(type, component, scope, ver_all);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
// All components of a specific type
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
else {
|
2004-07-14 00:25:12 +04:00
|
|
|
show_component_version(arg1, component_all, scope, ver_all);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2004-08-06 18:30:18 +04:00
|
|
|
// Show the version of Open MPI
|
2004-01-19 20:43:50 +03:00
|
|
|
//
|
2004-06-07 19:33:53 +04:00
|
|
|
void ompi_info::show_ompi_version(const string& scope)
|
2004-01-19 20:43:50 +03:00
|
|
|
{
|
2005-03-25 06:19:46 +03:00
|
|
|
out("Open MPI", type_ompi + ":version:full",
|
2004-01-19 20:43:50 +03:00
|
|
|
make_version_str(scope,
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
|
|
|
OMPI_RELEASE_VERSION,
|
2005-09-27 06:06:05 +04:00
|
|
|
OMPI_GREEK_VERSION,
|
2005-03-25 06:19:46 +03:00
|
|
|
OMPI_WANT_SVN, OMPI_SVN_R));
|
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
|
|
|
out("Open MPI SVN revision", type_ompi + ":version:svn",
|
2005-03-25 06:19:46 +03:00
|
|
|
OMPI_SVN_R);
|
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
|
|
|
|
|
|
|
out("Open RTE", type_orte + ":version:full",
|
|
|
|
make_version_str(scope,
|
|
|
|
ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
|
|
|
|
ORTE_RELEASE_VERSION,
|
2005-09-27 06:06:05 +04:00
|
|
|
ORTE_GREEK_VERSION,
|
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
|
|
|
ORTE_WANT_SVN, ORTE_SVN_R));
|
|
|
|
out("Open RTE SVN revision", type_orte + ":version:svn",
|
|
|
|
ORTE_SVN_R);
|
|
|
|
|
|
|
|
out("OPAL", type_opal + ":version:full",
|
|
|
|
make_version_str(scope,
|
|
|
|
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
|
|
|
|
OPAL_RELEASE_VERSION,
|
2005-09-27 06:06:05 +04:00
|
|
|
OPAL_GREEK_VERSION,
|
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
|
|
|
OPAL_WANT_SVN, OPAL_SVN_R));
|
|
|
|
out("OPAL SVN revision", type_opal + ":version:svn",
|
|
|
|
OPAL_SVN_R);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2004-07-14 00:25:12 +04:00
|
|
|
// Show all the components of a specific type/component combo (component may be
|
2004-01-19 20:43:50 +03:00
|
|
|
// a wildcard)
|
|
|
|
//
|
2004-07-14 00:25:12 +04:00
|
|
|
void ompi_info::show_component_version(const string& type_name,
|
|
|
|
const string& component_name,
|
2004-01-29 05:51:20 +03:00
|
|
|
const string& scope, const string& ver_type)
|
2004-01-19 20:43:50 +03:00
|
|
|
{
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_info::type_vector_t::size_type i;
|
2004-07-14 00:25:12 +04:00
|
|
|
bool want_all_components = (type_all == component_name);
|
2004-01-19 20:43:50 +03:00
|
|
|
bool found;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_component_list_item_t *cli;
|
|
|
|
const mca_base_component_t *component;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *components;
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
// 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
|
2004-06-07 19:33:53 +04:00
|
|
|
show_help("ompi_info", "usage");
|
2004-01-19 20:43:50 +03:00
|
|
|
#endif
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
// Now that we have a valid type, find the right component list
|
2004-01-19 20:43:50 +03:00
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
components = component_map[type_name];
|
|
|
|
if (NULL != components) {
|
2005-07-14 22:05:30 +04:00
|
|
|
if (opal_list_get_size(components) > 0){
|
|
|
|
for (item = opal_list_get_first(components);
|
|
|
|
opal_list_get_end(components) != item;
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = cli->cli_component;
|
|
|
|
if (want_all_components ||
|
|
|
|
component->mca_component_name == component_name) {
|
|
|
|
show_mca_version(component, scope, ver_type);
|
|
|
|
}
|
|
|
|
}
|
2004-02-14 01:17:42 +03:00
|
|
|
}
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2004-07-14 00:25:12 +04:00
|
|
|
// Given a component, display its relevant version(s)
|
2004-01-19 20:43:50 +03:00
|
|
|
//
|
2004-08-02 04:24:22 +04:00
|
|
|
static void show_mca_version(const mca_base_component_t* component,
|
2004-01-19 20:43:50 +03:00
|
|
|
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);
|
2004-07-14 00:25:12 +04:00
|
|
|
bool want_component = (ver_all == ver_type || ver_type == ver_component);
|
2004-01-19 20:43:50 +03:00
|
|
|
string message, content;
|
|
|
|
string mca_version;
|
|
|
|
string api_version;
|
2004-07-14 00:25:12 +04:00
|
|
|
string component_version;
|
2004-01-19 20:43:50 +03:00
|
|
|
string empty;
|
|
|
|
|
2004-07-14 00:25:12 +04:00
|
|
|
mca_version = make_version_str(scope, component->mca_major_version,
|
|
|
|
component->mca_minor_version,
|
2005-09-27 06:06:05 +04:00
|
|
|
component->mca_release_version, "",
|
2005-03-25 06:19:46 +03:00
|
|
|
false, "");
|
2004-07-14 00:25:12 +04:00
|
|
|
api_version = make_version_str(scope, component->mca_type_major_version,
|
|
|
|
component->mca_type_minor_version,
|
2005-09-27 06:06:05 +04:00
|
|
|
component->mca_type_release_version, "",
|
2005-03-25 06:19:46 +03:00
|
|
|
false, "");
|
2004-08-02 04:24:22 +04:00
|
|
|
component_version = make_version_str(scope, component->mca_component_major_version,
|
|
|
|
component->mca_component_minor_version,
|
|
|
|
component->mca_component_release_version,
|
2005-09-27 06:06:05 +04:00
|
|
|
"", false, "");
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
if (pretty) {
|
|
|
|
message = "MCA ";
|
2004-07-14 00:25:12 +04:00
|
|
|
message += component->mca_type_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
printed = false;
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
content = component->mca_component_name + string(" (");
|
2004-01-19 20:43:50 +03:00
|
|
|
if (want_mca) {
|
|
|
|
content += "MCA v" + mca_version;
|
|
|
|
printed = true;
|
|
|
|
}
|
|
|
|
if (want_type) {
|
|
|
|
if (printed)
|
|
|
|
content += ", ";
|
|
|
|
content += "API v" + api_version;
|
|
|
|
printed = true;
|
|
|
|
}
|
2004-07-14 00:25:12 +04:00
|
|
|
if (want_component) {
|
2004-01-19 20:43:50 +03:00
|
|
|
if (printed)
|
|
|
|
content += ", ";
|
2004-07-14 00:25:12 +04:00
|
|
|
content += "Component v" + component_version;
|
2004-01-19 20:43:50 +03:00
|
|
|
printed = true;
|
|
|
|
}
|
|
|
|
out(message, empty, content + ")");
|
|
|
|
} else {
|
|
|
|
message = "mca:";
|
2004-07-14 00:25:12 +04:00
|
|
|
message += component->mca_type_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
message += ":";
|
2004-08-02 04:24:22 +04:00
|
|
|
message += component->mca_component_name;
|
2004-01-19 20:43:50 +03:00
|
|
|
message += ":version";
|
|
|
|
if (want_mca)
|
|
|
|
out(empty, message, "mca:" + mca_version);
|
|
|
|
if (want_type)
|
|
|
|
out(empty, message, "api:" + api_version);
|
2004-07-14 00:25:12 +04:00
|
|
|
if (want_component)
|
|
|
|
out(empty, message, "component:" + component_version);
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static string make_version_str(const string& scope,
|
2005-09-27 06:06:05 +04:00
|
|
|
int major, int minor, int release,
|
|
|
|
const string &greek,
|
|
|
|
bool want_svn, const string& svn)
|
2004-01-19 20:43:50 +03:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2005-09-27 06:06:05 +04:00
|
|
|
if (!greek.empty()) {
|
|
|
|
str += greek;
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
2005-03-25 06:19:46 +03:00
|
|
|
if (want_svn && !svn.empty()) {
|
2004-07-07 16:45:36 +04:00
|
|
|
str += svn;
|
2004-01-19 20:43:50 +03:00
|
|
|
}
|
2005-03-25 06:19:46 +03:00
|
|
|
} else if (scope == ver_major) {
|
2004-01-19 20:43:50 +03:00
|
|
|
snprintf(temp, BUFSIZ - 1, "%d", major);
|
2005-03-25 06:19:46 +03:00
|
|
|
} else if (scope == ver_minor) {
|
2004-01-19 20:43:50 +03:00
|
|
|
snprintf(temp, BUFSIZ - 1, "%d", minor);
|
2005-03-25 06:19:46 +03:00
|
|
|
} else if (scope == ver_release) {
|
2004-01-19 20:43:50 +03:00
|
|
|
snprintf(temp, BUFSIZ - 1, "%d", release);
|
2005-09-27 06:06:05 +04:00
|
|
|
} else if (scope == ver_greek) {
|
|
|
|
str = greek;
|
2005-03-25 06:19:46 +03:00
|
|
|
} else if (scope == ver_svn) {
|
2004-07-07 16:45:36 +04:00
|
|
|
str = svn;
|
2005-03-25 06:19:46 +03:00
|
|
|
} else {
|
2004-01-19 20:43:50 +03:00
|
|
|
#if 0
|
2004-06-07 19:33:53 +04:00
|
|
|
show_help("ompi_info", "usage");
|
2004-01-19 20:43:50 +03:00
|
|
|
#endif
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2005-03-25 06:19:46 +03:00
|
|
|
if (str.empty()) {
|
2004-01-19 20:43:50 +03:00
|
|
|
str = temp;
|
2005-03-25 06:19:46 +03:00
|
|
|
}
|
2004-01-19 20:43:50 +03:00
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|