Re-implement ompi_info in C, replacing the prior C++ code. This removes the last C++ code from the OMPI code base, thus relieving the requirement for C++ support unless the user requests the C++ bindings.
Jeff will update the build system later to remove the C++ checks per the above caveat. This commit was SVN r21568.
Этот коммит содержится в:
родитель
cad12fda5f
Коммит
9e524a41cf
@ -18,7 +18,7 @@
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
AM_CFLAGS = \
|
||||
-DOMPI_CONFIGURE_USER="\"@OMPI_CONFIGURE_USER@\"" \
|
||||
-DOMPI_CONFIGURE_HOST="\"@OMPI_CONFIGURE_HOST@\"" \
|
||||
-DOMPI_CONFIGURE_DATE="\"@OMPI_CONFIGURE_DATE@\"" \
|
||||
@ -60,12 +60,13 @@ $(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h
|
||||
endif
|
||||
|
||||
ompi_info_SOURCES = \
|
||||
components.cc \
|
||||
ompi_info.h \
|
||||
ompi_info.cc \
|
||||
output.cc \
|
||||
param.cc \
|
||||
version.cc
|
||||
ompi_info.c \
|
||||
output.c \
|
||||
param.c \
|
||||
components.c \
|
||||
version.c
|
||||
|
||||
ompi_info_LDADD = $(top_builddir)/ompi/libmpi.la
|
||||
|
||||
clean-local:
|
||||
|
673
ompi/tools/ompi_info/components.c
Обычный файл
673
ompi/tools/ompi_info/components.c
Обычный файл
@ -0,0 +1,673 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "orte/runtime/runtime.h"
|
||||
|
||||
#include "opal/util/argv.h"
|
||||
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/backtrace/backtrace.h"
|
||||
#include "opal/mca/backtrace/base/base.h"
|
||||
#include "opal/mca/paffinity/paffinity.h"
|
||||
#include "opal/mca/paffinity/base/base.h"
|
||||
#include "opal/mca/carto/carto.h"
|
||||
#include "opal/mca/carto/base/base.h"
|
||||
#include "opal/mca/maffinity/maffinity.h"
|
||||
#include "opal/mca/maffinity/base/base.h"
|
||||
#include "opal/mca/memory/memory.h"
|
||||
#include "opal/mca/memory/base/base.h"
|
||||
#include "opal/mca/memchecker/memchecker.h"
|
||||
#include "opal/mca/memchecker/base/base.h"
|
||||
#include "opal/mca/timer/timer.h"
|
||||
#include "opal/mca/timer/base/base.h"
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/mca/installdirs/base/base.h"
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "opal/mca/crs/crs.h"
|
||||
#include "opal/mca/crs/base/base.h"
|
||||
#endif
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#include "ompi/mca/allocator/base/base.h"
|
||||
#include "ompi/mca/coll/base/base.h"
|
||||
#include "ompi/mca/io/io.h"
|
||||
#include "ompi/mca/io/base/base.h"
|
||||
#include "ompi/mca/mpool/base/base.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/mca/pml/base/base.h"
|
||||
#include "ompi/mca/bml/base/base.h"
|
||||
#include "ompi/mca/rcache/rcache.h"
|
||||
#include "ompi/mca/rcache/base/base.h"
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
#include "ompi/mca/mtl/mtl.h"
|
||||
#include "ompi/mca/mtl/base/base.h"
|
||||
#include "ompi/mca/topo/base/base.h"
|
||||
#include "ompi/mca/osc/osc.h"
|
||||
#include "ompi/mca/osc/base/base.h"
|
||||
#include "ompi/mca/pubsub/base/base.h"
|
||||
#include "ompi/mca/dpm/base/base.h"
|
||||
#include "ompi/mca/op/base/base.h"
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "ompi/mca/crcp/crcp.h"
|
||||
#include "ompi/mca/crcp/base/base.h"
|
||||
#endif
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/mca/grpcomm/grpcomm.h"
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "orte/mca/ess/base/base.h"
|
||||
#include "orte/mca/notifier/notifier.h"
|
||||
#include "orte/mca/notifier/base/base.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/oob/oob.h"
|
||||
#include "orte/mca/oob/base/base.h"
|
||||
#include "orte/mca/odls/odls.h"
|
||||
#include "orte/mca/odls/base/base.h"
|
||||
#include "orte/mca/ras/ras.h"
|
||||
#include "orte/mca/ras/base/ras_private.h"
|
||||
#include "orte/mca/rmaps/rmaps.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/base/base.h"
|
||||
#include "orte/mca/routed/routed.h"
|
||||
#include "orte/mca/routed/base/base.h"
|
||||
#include "orte/mca/plm/plm.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "orte/mca/snapc/snapc.h"
|
||||
#include "orte/mca/snapc/base/base.h"
|
||||
#endif
|
||||
#include "orte/mca/filem/filem.h"
|
||||
#include "orte/mca/filem/base/base.h"
|
||||
#endif
|
||||
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
/*
|
||||
* Public variables
|
||||
*/
|
||||
|
||||
static void component_map_construct(ompi_info_component_map_t *map)
|
||||
{
|
||||
map->type = NULL;
|
||||
}
|
||||
static void component_map_destruct(ompi_info_component_map_t *map)
|
||||
{
|
||||
if (NULL != map->type) {
|
||||
free(map->type);
|
||||
}
|
||||
/* the type close functions will release the
|
||||
* list of components
|
||||
*/
|
||||
}
|
||||
OBJ_CLASS_INSTANCE(ompi_info_component_map_t,
|
||||
opal_list_item_t,
|
||||
component_map_construct,
|
||||
component_map_destruct);
|
||||
|
||||
opal_pointer_array_t component_map;
|
||||
|
||||
/*
|
||||
* Private variables
|
||||
*/
|
||||
|
||||
static bool opened_components = false;
|
||||
|
||||
|
||||
/*
|
||||
* Open all MCA components so that they can register their MCA
|
||||
* parameters. Take a shotgun approach here and indiscriminately open
|
||||
* all components -- don't be selective. To this end, we need to clear
|
||||
* out the environment of all OMPI_MCA_<type> variables to ensure
|
||||
* that the open algorithms don't try to only open one component.
|
||||
*/
|
||||
void ompi_info_open_components(void)
|
||||
{
|
||||
int i;
|
||||
char *env, *str;
|
||||
char *target, *save, *type;
|
||||
char **env_save=NULL;
|
||||
bool need_close_components = false;
|
||||
ompi_info_component_map_t *map;
|
||||
|
||||
if (opened_components) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* init the map */
|
||||
OBJ_CONSTRUCT(&component_map, opal_pointer_array_t);
|
||||
opal_pointer_array_init(&component_map, 256, INT_MAX, 128);
|
||||
|
||||
/* 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) {
|
||||
if (NULL == (type = (char*)opal_pointer_array_get_item(&mca_types, i))) {
|
||||
continue;
|
||||
}
|
||||
asprintf(&env, "OMPI_MCA_%s", type);
|
||||
if (NULL != (save = getenv(env))) {
|
||||
/* save this param so it can later be restored */
|
||||
asprintf(&str, "%s=%s", env, save);
|
||||
opal_argv_append_nosize(&env_save, str);
|
||||
free(str);
|
||||
/* can't manipulate it directly, so make a copy first */
|
||||
asprintf(&target, "%s=", env);
|
||||
putenv(target);
|
||||
free(target);
|
||||
}
|
||||
}
|
||||
|
||||
/* some components require the event library be active, so activate it */
|
||||
if (OPAL_SUCCESS != opal_event_init()) {
|
||||
str = "opal_event_init failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Open the DSS */
|
||||
|
||||
if (ORTE_SUCCESS != opal_dss_open()) {
|
||||
str = "Unable to initialize the DSS";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Open up the MCA */
|
||||
|
||||
if (OPAL_SUCCESS != mca_base_open()) {
|
||||
str = "mca_base_open failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Register the OPAL layer's MCA parameters */
|
||||
|
||||
if (OPAL_SUCCESS != opal_register_params()) {
|
||||
str = "opal_register_params failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Register the ORTE layer's MCA parameters */
|
||||
|
||||
if (ORTE_SUCCESS != orte_register_params()) {
|
||||
str = "orte_register_params failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Initialize the opal_output system */
|
||||
if (!opal_output_init()) {
|
||||
str = "opal_output_init failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Register the MPI layer's MCA parameters */
|
||||
|
||||
if (OMPI_SUCCESS != ompi_mpi_register_params()) {
|
||||
str = "ompi_mpi_Register_params failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Find / open all components */
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("base");
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
/* flag that we need to close components */
|
||||
need_close_components = true;
|
||||
/* set default error message from here forward */
|
||||
str = "A component framework failed to open properly.";
|
||||
|
||||
/* OPAL frameworks */
|
||||
|
||||
if (OPAL_SUCCESS != opal_backtrace_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("backtrace");
|
||||
map->components = &opal_backtrace_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_memory_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("memory");
|
||||
map->components = &opal_memory_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_memchecker_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("memchecker");
|
||||
map->components = &opal_memchecker_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_paffinity_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("paffinity");
|
||||
map->components = &opal_paffinity_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_carto_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("carto");
|
||||
map->components = &opal_carto_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_maffinity_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("maffinity");
|
||||
map->components = &opal_maffinity_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OPAL_SUCCESS != opal_timer_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("timer");
|
||||
map->components = &opal_timer_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (OPAL_SUCCESS != opal_crs_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("crs");
|
||||
map->components = &opal_crs_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
#endif
|
||||
|
||||
/* OPAL's installdirs base open has already been called as part of
|
||||
* opal_init_util() back in main().
|
||||
*/
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("installdirs");
|
||||
map->components = &opal_installdirs_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
/* ORTE frameworks
|
||||
* Set orte_process_info.proc_type to HNP to force all frameworks to
|
||||
* open components
|
||||
*/
|
||||
orte_process_info.proc_type = ORTE_PROC_HNP;
|
||||
|
||||
if (ORTE_SUCCESS != orte_errmgr_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("errmgr");
|
||||
map->components = &orte_errmgr_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_grpcomm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("grpcomm");
|
||||
map->components = &mca_grpcomm_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_ess_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("ess");
|
||||
map->components = &orte_ess_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_notifier_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("notifier");
|
||||
map->components = &mca_notifier_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
if (ORTE_SUCCESS != mca_oob_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("oob");
|
||||
map->components = &mca_oob_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_odls_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("odls");
|
||||
map->components = &orte_odls_base.available_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_iof_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("iof");
|
||||
map->components = &orte_iof_base.iof_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_ras_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("ras");
|
||||
map->components = &orte_ras_base.ras_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_rmaps_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("rmaps");
|
||||
map->components = &orte_rmaps_base.available_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_rml_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("rml");
|
||||
map->components = &orte_rml_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_routed_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("routed");
|
||||
map->components = &orte_routed_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != orte_plm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("plm");
|
||||
map->components = &orte_plm_base.available_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (ORTE_SUCCESS != orte_snapc_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("snapc");
|
||||
map->components = &orte_snapc_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
#endif
|
||||
|
||||
if (ORTE_SUCCESS != orte_filem_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("filem");
|
||||
map->components = &orte_filem_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
#endif
|
||||
|
||||
/* MPI frameworks */
|
||||
|
||||
if (OMPI_SUCCESS != mca_allocator_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("allocator");
|
||||
map->components = &mca_allocator_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_coll_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("coll");
|
||||
map->components = &mca_coll_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_io_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("io");
|
||||
map->components = &mca_io_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_rcache_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("rcache");
|
||||
map->components = &mca_rcache_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_mpool_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("mpool");
|
||||
map->components = &mca_mpool_base_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_pml_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("pml");
|
||||
map->components = &mca_pml_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
/* No need to call the bml_base_open() because the ob1 pml calls it.
|
||||
* mca_bml_base_open();
|
||||
*/
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("bml");
|
||||
map->components = &mca_bml_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != ompi_osc_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("osc");
|
||||
map->components = &ompi_osc_base_open_components;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_btl_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("btl");
|
||||
map->components = &mca_btl_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != ompi_mtl_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("mtl");
|
||||
map->components = &ompi_mtl_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != mca_topo_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("topo");
|
||||
map->components = &mca_topo_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pubsub_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("pubsub");
|
||||
map->components = &ompi_pubsub_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (OMPI_SUCCESS != ompi_dpm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("dpm");
|
||||
map->components = &ompi_dpm_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
ompi_op_base_open();
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("op");
|
||||
map->components = &ompi_op_base_components_opened;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (OMPI_SUCCESS != ompi_crcp_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("crcp");
|
||||
map->components = &ompi_crcp_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
#endif
|
||||
|
||||
/* Restore the environment to what it was before we started so that
|
||||
* if users setenv OMPI_MCA_<framework name> to some value, they'll
|
||||
* see that value when it is shown via --param output.
|
||||
*/
|
||||
|
||||
if (NULL != env_save) {
|
||||
for (i = 0; i < opal_argv_count(env_save); ++i) {
|
||||
putenv(env_save[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
opened_components = true;
|
||||
return;
|
||||
|
||||
error:
|
||||
fprintf(stderr, "%s\n", str);
|
||||
fprintf(stderr, "ompi_info will likely not display all configuration information\n");
|
||||
if (need_close_components) {
|
||||
opened_components = true;
|
||||
ompi_info_close_components();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_close_components()
|
||||
{
|
||||
int i;
|
||||
ompi_info_component_map_t *map;
|
||||
|
||||
if (opened_components) {
|
||||
|
||||
/* Note that the order of shutdown here doesn't matter because
|
||||
* we aren't *using* any components -- none were selected, so
|
||||
* there are no dependencies between the frameworks. We list
|
||||
* them generally "in order", but it doesn't really matter.
|
||||
|
||||
* We also explicitly ignore the return values from the
|
||||
* close() functions -- what would we do if there was an
|
||||
* error?
|
||||
*/
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) ompi_crcp_base_close();
|
||||
#endif
|
||||
(void) ompi_op_base_close();
|
||||
(void) ompi_dpm_base_close();
|
||||
(void) ompi_pubsub_base_close();
|
||||
(void) mca_topo_base_close();
|
||||
(void) mca_btl_base_close();
|
||||
(void) ompi_mtl_base_close();
|
||||
(void) mca_pml_base_close();
|
||||
(void) mca_mpool_base_close();
|
||||
(void) mca_rcache_base_close();
|
||||
(void) mca_io_base_close();
|
||||
(void) mca_coll_base_close();
|
||||
(void) mca_allocator_base_close();
|
||||
(void) ompi_osc_base_close();
|
||||
(void) orte_grpcomm_base_close();
|
||||
(void) orte_notifier_base_close();
|
||||
(void) orte_ess_base_close();
|
||||
(void) orte_show_help_finalize();
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) orte_snapc_base_close();
|
||||
#endif
|
||||
(void) orte_filem_base_close();
|
||||
(void) orte_iof_base_close();
|
||||
(void) orte_plm_base_close();
|
||||
(void) orte_odls_base_close();
|
||||
(void) orte_rmaps_base_close();
|
||||
(void) orte_ras_base_close();
|
||||
(void) orte_rml_base_close();
|
||||
(void) orte_routed_base_close();
|
||||
(void) mca_oob_base_close();
|
||||
#endif
|
||||
(void) orte_errmgr_base_close();
|
||||
|
||||
(void) opal_backtrace_base_close();
|
||||
(void) opal_memory_base_close();
|
||||
(void) opal_memchecker_base_close();
|
||||
(void) opal_paffinity_base_close();
|
||||
(void) opal_carto_base_close();
|
||||
(void) opal_maffinity_base_close();
|
||||
(void) opal_timer_base_close();
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) opal_crs_base_close();
|
||||
#endif
|
||||
|
||||
/* Do not call OPAL's installdirs close; it will be handled in
|
||||
* opal_finalize_util().
|
||||
*/
|
||||
for (i=0; i < component_map.size; i++) {
|
||||
if (NULL != (map = (ompi_info_component_map_t*)opal_pointer_array_get_item(&component_map, i))) {
|
||||
OBJ_RELEASE(map);
|
||||
}
|
||||
}
|
||||
OBJ_DESTRUCT(&component_map);
|
||||
}
|
||||
|
||||
opened_components = false;
|
||||
}
|
@ -1,521 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "orte/runtime/runtime.h"
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/backtrace/backtrace.h"
|
||||
#include "opal/mca/backtrace/base/base.h"
|
||||
#include "opal/mca/paffinity/paffinity.h"
|
||||
#include "opal/mca/paffinity/base/base.h"
|
||||
#include "opal/mca/carto/carto.h"
|
||||
#include "opal/mca/carto/base/base.h"
|
||||
#include "opal/mca/maffinity/maffinity.h"
|
||||
#include "opal/mca/maffinity/base/base.h"
|
||||
#include "opal/mca/memory/memory.h"
|
||||
#include "opal/mca/memory/base/base.h"
|
||||
#include "opal/mca/memchecker/memchecker.h"
|
||||
#include "opal/mca/memchecker/base/base.h"
|
||||
#include "opal/mca/timer/timer.h"
|
||||
#include "opal/mca/timer/base/base.h"
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/mca/installdirs/base/base.h"
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "opal/mca/crs/crs.h"
|
||||
#include "opal/mca/crs/base/base.h"
|
||||
#endif
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "opal/dss/dss.h"
|
||||
|
||||
#include "ompi/mca/allocator/base/base.h"
|
||||
#include "ompi/mca/coll/base/base.h"
|
||||
#include "ompi/mca/io/io.h"
|
||||
#include "ompi/mca/io/base/base.h"
|
||||
#include "ompi/mca/mpool/base/base.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/mca/pml/base/base.h"
|
||||
#include "ompi/mca/bml/base/base.h"
|
||||
#include "ompi/mca/rcache/rcache.h"
|
||||
#include "ompi/mca/rcache/base/base.h"
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
#include "ompi/mca/mtl/mtl.h"
|
||||
#include "ompi/mca/mtl/base/base.h"
|
||||
#include "ompi/mca/topo/base/base.h"
|
||||
#include "ompi/mca/osc/osc.h"
|
||||
#include "ompi/mca/osc/base/base.h"
|
||||
#include "ompi/mca/pubsub/base/base.h"
|
||||
#include "ompi/mca/dpm/base/base.h"
|
||||
#include "ompi/mca/op/base/base.h"
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "ompi/mca/crcp/crcp.h"
|
||||
#include "ompi/mca/crcp/base/base.h"
|
||||
#endif
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/mca/grpcomm/grpcomm.h"
|
||||
#include "orte/mca/grpcomm/base/base.h"
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "orte/mca/ess/base/base.h"
|
||||
#include "orte/mca/notifier/notifier.h"
|
||||
#include "orte/mca/notifier/base/base.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/oob/oob.h"
|
||||
#include "orte/mca/oob/base/base.h"
|
||||
#include "orte/mca/odls/odls.h"
|
||||
#include "orte/mca/odls/base/base.h"
|
||||
#include "orte/mca/ras/ras.h"
|
||||
#include "orte/mca/ras/base/ras_private.h"
|
||||
#include "orte/mca/rmaps/rmaps.h"
|
||||
#include "orte/mca/rmaps/base/base.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/base/base.h"
|
||||
#include "orte/mca/routed/routed.h"
|
||||
#include "orte/mca/routed/base/base.h"
|
||||
#include "orte/mca/plm/plm.h"
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#include "orte/mca/snapc/snapc.h"
|
||||
#include "orte/mca/snapc/base/base.h"
|
||||
#endif
|
||||
#include "orte/mca/filem/filem.h"
|
||||
#include "orte/mca/filem/base/base.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace ompi_info;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
ompi_info::component_map_t ompi_info::component_map;
|
||||
|
||||
|
||||
//
|
||||
// Private variables
|
||||
//
|
||||
|
||||
static bool opened_components = false;
|
||||
|
||||
|
||||
//
|
||||
// Open all MCA components so that they can register their MCA
|
||||
// parameters. Take a shotgun approach here and indiscriminately open
|
||||
// all components -- don't be selective. To this end, we need to clear
|
||||
// out the environment of all OMPI_MCA_<type> variables to ensure
|
||||
// that the open algorithms don't try to only open one component.
|
||||
//
|
||||
void ompi_info::open_components()
|
||||
{
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
string env, str;
|
||||
char *target, *save;
|
||||
vector<std::string> env_save;
|
||||
vector<std::string>::iterator esi;
|
||||
bool need_close_components = false;
|
||||
|
||||
if (opened_components) {
|
||||
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 = "OMPI_MCA_" + mca_types[i];
|
||||
if (NULL != (save = getenv(env.c_str()))) {
|
||||
env += "=";
|
||||
env_save.push_back(env + save);
|
||||
target = strdup(env.c_str());
|
||||
putenv(target);
|
||||
}
|
||||
}
|
||||
|
||||
// some components require the event library be active, so activate
|
||||
// it.
|
||||
if (OPAL_SUCCESS != opal_event_init()) {
|
||||
str = "opal_event_init failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the DSS
|
||||
|
||||
if (ORTE_SUCCESS != opal_dss_open()) {
|
||||
str = "Unable to initialize the DSS";
|
||||
return;
|
||||
}
|
||||
|
||||
// Open up the MCA
|
||||
|
||||
if (OPAL_SUCCESS != mca_base_open()) {
|
||||
str = "mca_base_open failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the OPAL layer's MCA parameters
|
||||
|
||||
if (OPAL_SUCCESS != opal_register_params()) {
|
||||
str = "opal_register_params failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the ORTE layer's MCA parameters
|
||||
|
||||
if (ORTE_SUCCESS != orte_register_params()) {
|
||||
str = "orte_register_params failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize the opal_output system
|
||||
if (!opal_output_init()) {
|
||||
str = "opal_output_init failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the MPI layer's MCA parameters
|
||||
|
||||
if (OMPI_SUCCESS != ompi_mpi_register_params()) {
|
||||
str = "ompi_mpi_Register_params failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Find / open all components
|
||||
|
||||
component_map["base"] = NULL;
|
||||
need_close_components = true;
|
||||
|
||||
// OPAL frameworks
|
||||
|
||||
str = "A component framework failed to open properly.";
|
||||
if (OPAL_SUCCESS != opal_backtrace_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["backtrace"] = &opal_backtrace_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_memory_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["memory"] = &opal_memory_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_memchecker_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["memchecker"] = &opal_memchecker_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_paffinity_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["paffinity"] = &opal_paffinity_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_carto_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["carto"] = &opal_carto_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_maffinity_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["maffinity"] = &opal_maffinity_base_components_opened;
|
||||
|
||||
if (OPAL_SUCCESS != opal_timer_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["timer"] = &opal_timer_base_components_opened;
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (OPAL_SUCCESS != opal_crs_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["crs"] = &opal_crs_base_components_available;
|
||||
#endif
|
||||
|
||||
// OPAL's installdirs base open has already been called as part of
|
||||
// opal_init_util() back in main().
|
||||
component_map["installdirs"] = &opal_installdirs_components;
|
||||
|
||||
// ORTE frameworks
|
||||
// Set orte_process_info.proc_type to HNP to force all frameworks to
|
||||
// open components
|
||||
orte_process_info.proc_type = ORTE_PROC_HNP;
|
||||
|
||||
if (ORTE_SUCCESS != orte_errmgr_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["errmgr"] = &orte_errmgr_base_components_available;
|
||||
|
||||
if (ORTE_SUCCESS != orte_grpcomm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["grpcomm"] = &mca_grpcomm_base_components_available;
|
||||
|
||||
if (ORTE_SUCCESS != orte_ess_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["ess"] = &orte_ess_base_components_available;
|
||||
|
||||
if (ORTE_SUCCESS != orte_notifier_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["notifier"] = &mca_notifier_base_components_available;
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
if (ORTE_SUCCESS != mca_oob_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["oob"] = &mca_oob_base_components;
|
||||
|
||||
if (ORTE_SUCCESS != orte_odls_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["odls"] = &orte_odls_base.available_components;
|
||||
|
||||
if (ORTE_SUCCESS != orte_iof_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["iof"] = &orte_iof_base.iof_components_opened;
|
||||
|
||||
if (ORTE_SUCCESS != orte_ras_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["ras"] = &orte_ras_base.ras_opened;
|
||||
|
||||
if (ORTE_SUCCESS != orte_rmaps_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["rmaps"] = &orte_rmaps_base.available_components;
|
||||
|
||||
if (ORTE_SUCCESS != orte_rml_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["rml"] = &orte_rml_base_components;
|
||||
|
||||
if (ORTE_SUCCESS != orte_routed_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["routed"] = &orte_routed_base_components;
|
||||
|
||||
if (ORTE_SUCCESS != orte_plm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["plm"] = &orte_plm_base.available_components;
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (ORTE_SUCCESS != orte_snapc_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["snapc"] = &orte_snapc_base_components_available;
|
||||
#endif
|
||||
|
||||
if (ORTE_SUCCESS != orte_filem_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["filem"] = &orte_filem_base_components_available;
|
||||
#endif
|
||||
|
||||
// MPI frameworks
|
||||
|
||||
if (OMPI_SUCCESS != mca_allocator_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["allocator"] = &mca_allocator_base_components;
|
||||
|
||||
if (OMPI_SUCCESS != mca_coll_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["coll"] = &mca_coll_base_components_opened;
|
||||
|
||||
if (OMPI_SUCCESS != mca_io_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["io"] = &mca_io_base_components_opened;
|
||||
|
||||
if (OMPI_SUCCESS != mca_rcache_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["rcache"] = &mca_rcache_base_components;
|
||||
|
||||
if (OMPI_SUCCESS != mca_mpool_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["mpool"] = &mca_mpool_base_components;
|
||||
|
||||
if (OMPI_SUCCESS != mca_pml_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["pml"] = &mca_pml_base_components_available;
|
||||
|
||||
// No need to call the bml_base_open() because the ob1 pml calls it.
|
||||
//mca_bml_base_open();
|
||||
component_map["bml"] = &mca_bml_base_components_available;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_osc_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["osc"] = &ompi_osc_base_open_components;
|
||||
|
||||
if (OMPI_SUCCESS != mca_btl_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["btl"] = &mca_btl_base_components_opened;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_mtl_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["mtl"] = &ompi_mtl_base_components_opened;
|
||||
|
||||
if (OMPI_SUCCESS != mca_topo_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["topo"] = &mca_topo_base_components_opened;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pubsub_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["pubsub"] = &ompi_pubsub_base_components_available;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_dpm_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["dpm"] = &ompi_dpm_base_components_available;
|
||||
|
||||
ompi_op_base_open();
|
||||
component_map["op"] = &ompi_op_base_components_opened;
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
if (OMPI_SUCCESS != ompi_crcp_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
component_map["crcp"] = &ompi_crcp_base_components_available;
|
||||
#endif
|
||||
|
||||
// Restore the environment to what it was before we started so that
|
||||
// if users setenv OMPI_MCA_<framework name> to some value, they'll
|
||||
// see that value when it is shown via --param output.
|
||||
|
||||
if (!env_save.empty()) {
|
||||
for (esi = env_save.begin(); esi != env_save.end(); ++esi) {
|
||||
target = strdup(esi->c_str());
|
||||
putenv(target);
|
||||
}
|
||||
}
|
||||
|
||||
// All done
|
||||
|
||||
opened_components = true;
|
||||
return;
|
||||
|
||||
error:
|
||||
cerr << str << endl;
|
||||
cerr << "ompi_info will likely not display all configuration information"
|
||||
<< endl;
|
||||
if (need_close_components) {
|
||||
opened_components = true;
|
||||
ompi_info::close_components();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::close_components()
|
||||
{
|
||||
if (opened_components) {
|
||||
|
||||
// Note that the order of shutdown here doesn't matter because
|
||||
// we aren't *using* any components -- none were selected, so
|
||||
// there are no dependencies between the frameworks. We list
|
||||
// them generally "in order", but it doesn't really matter.
|
||||
|
||||
// We also explicitly ignore the return values from the
|
||||
// close() functions -- what would we do if there was an
|
||||
// error?
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) ompi_crcp_base_close();
|
||||
#endif
|
||||
(void) ompi_op_base_close();
|
||||
(void) ompi_dpm_base_close();
|
||||
(void) ompi_pubsub_base_close();
|
||||
(void) mca_topo_base_close();
|
||||
(void) mca_btl_base_close();
|
||||
(void) ompi_mtl_base_close();
|
||||
(void) mca_pml_base_close();
|
||||
(void) mca_mpool_base_close();
|
||||
(void) mca_rcache_base_close();
|
||||
(void) mca_io_base_close();
|
||||
(void) mca_coll_base_close();
|
||||
(void) mca_allocator_base_close();
|
||||
(void) ompi_osc_base_close();
|
||||
(void) orte_grpcomm_base_close();
|
||||
(void) orte_notifier_base_close();
|
||||
(void) orte_ess_base_close();
|
||||
(void) orte_show_help_finalize();
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) orte_snapc_base_close();
|
||||
#endif
|
||||
(void) orte_filem_base_close();
|
||||
(void) orte_iof_base_close();
|
||||
(void) orte_plm_base_close();
|
||||
(void) orte_odls_base_close();
|
||||
(void) orte_rmaps_base_close();
|
||||
(void) orte_ras_base_close();
|
||||
(void) orte_rml_base_close();
|
||||
(void) orte_routed_base_close();
|
||||
(void) mca_oob_base_close();
|
||||
#endif
|
||||
(void) orte_errmgr_base_close();
|
||||
|
||||
(void) opal_backtrace_base_close();
|
||||
(void) opal_memory_base_close();
|
||||
(void) opal_memchecker_base_close();
|
||||
(void) opal_paffinity_base_close();
|
||||
(void) opal_carto_base_close();
|
||||
(void) opal_maffinity_base_close();
|
||||
(void) opal_timer_base_close();
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
(void) opal_crs_base_close();
|
||||
#endif
|
||||
|
||||
// Do not call OPAL's installdirs close; it will be handled in
|
||||
// opal_finalize_util().
|
||||
|
||||
component_map.clear();
|
||||
}
|
||||
|
||||
opened_components = false;
|
||||
}
|
309
ompi/tools/ompi_info/ompi_info.c
Обычный файл
309
ompi/tools/ompi_info/ompi_info.c
Обычный файл
@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copryight (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/class/opal_object.h"
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "opal/util/cmd_line.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
#include "orte/util/show_help.h"
|
||||
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
/*
|
||||
* Public variables
|
||||
*/
|
||||
|
||||
bool ompi_info_pretty = true;
|
||||
opal_cmd_line_t *ompi_info_cmd_line = NULL;
|
||||
|
||||
const char *ompi_info_type_all = "all";
|
||||
const char *ompi_info_type_ompi = "ompi";
|
||||
const char *ompi_info_type_orte = "orte";
|
||||
const char *ompi_info_type_opal = "opal";
|
||||
const char *ompi_info_type_base = "base";
|
||||
|
||||
opal_pointer_array_t mca_types;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
bool want_help = false;
|
||||
bool cmd_error = false;
|
||||
bool acted = false;
|
||||
bool want_all = false;
|
||||
char **app_env = NULL, **global_env = NULL;
|
||||
int i, len;
|
||||
char *str;
|
||||
|
||||
/* Initialize the argv parsing handle */
|
||||
if (OMPI_SUCCESS != opal_init_util()) {
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true,
|
||||
"opal_init_util", __FILE__, __LINE__, NULL);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
ompi_info_cmd_line = OBJ_NEW(opal_cmd_line_t);
|
||||
if (NULL == ompi_info_cmd_line) {
|
||||
ret = errno;
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true,
|
||||
"opal_cmd_line_create", __FILE__, __LINE__, NULL);
|
||||
opal_finalize_util();
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, 'v', NULL, "version", 2,
|
||||
"Show version of Open MPI or a component. The first parameter can be the keywords \"ompi\" or \"all\", a framework name (indicating all components in a framework), or a framework:component string (indicating a specific component). The second parameter can be one of: full, major, minor, release, greek, svn.");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "param", 2,
|
||||
"Show MCA parameters. The first parameter is the framework (or the keyword \"all\"); the second parameter is the specific component name (or the keyword \"all\").");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "internal", 0,
|
||||
"Show internal MCA parameters (not meant to be modified by users)");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "path", 1,
|
||||
"Show paths that Open MPI was configured with. Accepts the following parameters: prefix, bindir, libdir, incdir, mandir, pkglibdir, sysconfdir");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "arch", 0,
|
||||
"Show architecture Open MPI was compiled on");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, 'c', NULL, "config", 0,
|
||||
"Show configuration options");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, 'h', NULL, "help", 0,
|
||||
"Show this help message");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "ompi_info_pretty", 0,
|
||||
"When used in conjunction with other parameters, the output is displayed in 'ompi_info_prettyprint' format (default)");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "parsable", 0,
|
||||
"When used in conjunction with other parameters, the output is displayed in a machine-parsable format");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "parseable", 0,
|
||||
"Synonym for --parsable");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, '\0', NULL, "hostname", 0,
|
||||
"Show the hostname that Open MPI was configured "
|
||||
"and built on");
|
||||
opal_cmd_line_make_opt3(ompi_info_cmd_line, 'a', NULL, "all", 0,
|
||||
"Show all configuration options and MCA parameters");
|
||||
|
||||
/* Call some useless functions in order to guarantee to link in some
|
||||
* global variables. Only check the return value so that the
|
||||
* compiler doesn't optimize out the useless function.
|
||||
*/
|
||||
|
||||
if (OMPI_SUCCESS != ompi_comm_link_function()) {
|
||||
/* Stop .. or I'll say stop again! */
|
||||
++ret;
|
||||
} else {
|
||||
--ret;
|
||||
}
|
||||
|
||||
/* set our threading level */
|
||||
opal_set_using_threads(false);
|
||||
|
||||
/* Get MCA parameters, if any */
|
||||
|
||||
if( OMPI_SUCCESS != mca_base_open() ) {
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true, "mca_base_open", __FILE__, __LINE__ );
|
||||
OBJ_RELEASE(ompi_info_cmd_line);
|
||||
opal_finalize_util();
|
||||
exit(1);
|
||||
}
|
||||
mca_base_cmd_line_setup(ompi_info_cmd_line);
|
||||
|
||||
/* Do the parsing */
|
||||
|
||||
if (OMPI_SUCCESS != opal_cmd_line_parse(ompi_info_cmd_line, false, argc, argv)) {
|
||||
cmd_error = true;
|
||||
}
|
||||
if (!cmd_error &&
|
||||
(opal_cmd_line_is_taken(ompi_info_cmd_line, "help") ||
|
||||
opal_cmd_line_is_taken(ompi_info_cmd_line, "h"))) {
|
||||
want_help = true;
|
||||
}
|
||||
if (cmd_error || want_help) {
|
||||
char *usage = opal_cmd_line_get_usage_msg(ompi_info_cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
mca_base_close();
|
||||
OBJ_RELEASE(ompi_info_cmd_line);
|
||||
opal_finalize_util();
|
||||
exit(cmd_error ? 1 : 0);
|
||||
}
|
||||
|
||||
mca_base_cmd_line_process_args(ompi_info_cmd_line, &app_env, &global_env);
|
||||
|
||||
/* putenv() all the stuff that we got back from env (in case the
|
||||
* user specified some --mca params on the command line). This
|
||||
* creates a memory leak, but that's unfortunately how putenv()
|
||||
* works. :-(
|
||||
*/
|
||||
|
||||
len = opal_argv_count(app_env);
|
||||
for (i = 0; i < len; ++i) {
|
||||
putenv(app_env[i]);
|
||||
}
|
||||
len = opal_argv_count(global_env);
|
||||
for (i = 0; i < len; ++i) {
|
||||
putenv(global_env[i]);
|
||||
}
|
||||
|
||||
/* setup the mca_types array */
|
||||
OBJ_CONSTRUCT(&mca_types, opal_pointer_array_t);
|
||||
opal_pointer_array_init(&mca_types, 256, INT_MAX, 128);
|
||||
|
||||
opal_pointer_array_add(&mca_types, "mca");
|
||||
opal_pointer_array_add(&mca_types, "mpi");
|
||||
opal_pointer_array_add(&mca_types, "orte");
|
||||
opal_pointer_array_add(&mca_types, "opal");
|
||||
|
||||
opal_pointer_array_add(&mca_types, "filter");
|
||||
opal_pointer_array_add(&mca_types, "backtrace");
|
||||
opal_pointer_array_add(&mca_types, "memchecker");
|
||||
opal_pointer_array_add(&mca_types, "memory");
|
||||
opal_pointer_array_add(&mca_types, "paffinity");
|
||||
opal_pointer_array_add(&mca_types, "carto");
|
||||
opal_pointer_array_add(&mca_types, "maffinity");
|
||||
opal_pointer_array_add(&mca_types, "timer");
|
||||
opal_pointer_array_add(&mca_types, "installdirs");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
opal_pointer_array_add(&mca_types, "crs");
|
||||
#endif
|
||||
opal_pointer_array_add(&mca_types, "dpm");
|
||||
opal_pointer_array_add(&mca_types, "pubsub");
|
||||
opal_pointer_array_add(&mca_types, "allocator");
|
||||
opal_pointer_array_add(&mca_types, "coll");
|
||||
opal_pointer_array_add(&mca_types, "io");
|
||||
opal_pointer_array_add(&mca_types, "mpool");
|
||||
opal_pointer_array_add(&mca_types, "pml");
|
||||
opal_pointer_array_add(&mca_types, "bml");
|
||||
opal_pointer_array_add(&mca_types, "rcache");
|
||||
opal_pointer_array_add(&mca_types, "btl");
|
||||
opal_pointer_array_add(&mca_types, "mtl");
|
||||
opal_pointer_array_add(&mca_types, "topo");
|
||||
opal_pointer_array_add(&mca_types, "osc");
|
||||
opal_pointer_array_add(&mca_types, "op");
|
||||
opal_pointer_array_add(&mca_types, "common");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
opal_pointer_array_add(&mca_types, "crcp");
|
||||
#endif
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
opal_pointer_array_add(&mca_types, "iof");
|
||||
opal_pointer_array_add(&mca_types, "oob");
|
||||
opal_pointer_array_add(&mca_types, "odls");
|
||||
opal_pointer_array_add(&mca_types, "ras");
|
||||
opal_pointer_array_add(&mca_types, "rmaps");
|
||||
opal_pointer_array_add(&mca_types, "rml");
|
||||
opal_pointer_array_add(&mca_types, "routed");
|
||||
opal_pointer_array_add(&mca_types, "plm");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
opal_pointer_array_add(&mca_types, "snapc");
|
||||
#endif
|
||||
opal_pointer_array_add(&mca_types, "filem");
|
||||
#endif
|
||||
/* these are always included */
|
||||
opal_pointer_array_add(&mca_types, "errmgr");
|
||||
opal_pointer_array_add(&mca_types, "ess");
|
||||
opal_pointer_array_add(&mca_types, "grpcomm");
|
||||
opal_pointer_array_add(&mca_types, "notifier");
|
||||
|
||||
/* Execute the desired action(s) */
|
||||
|
||||
if (opal_cmd_line_is_taken(ompi_info_cmd_line, "ompi_info_pretty")) {
|
||||
ompi_info_pretty = true;
|
||||
} else if (opal_cmd_line_is_taken(ompi_info_cmd_line, "parsable") || opal_cmd_line_is_taken(ompi_info_cmd_line, "parseable")) {
|
||||
ompi_info_pretty = false;
|
||||
}
|
||||
|
||||
want_all = opal_cmd_line_is_taken(ompi_info_cmd_line, "all");
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "version")) {
|
||||
ompi_info_do_version(want_all, ompi_info_cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "path")) {
|
||||
ompi_info_do_path(want_all, ompi_info_cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "arch")) {
|
||||
ompi_info_do_arch();
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "hostname")) {
|
||||
ompi_info_do_hostname();
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "config")) {
|
||||
ompi_info_do_config(true);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "param")) {
|
||||
ompi_info_do_params(want_all, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"));
|
||||
acted = true;
|
||||
}
|
||||
|
||||
/* If no command line args are specified, show default set */
|
||||
|
||||
if (!acted) {
|
||||
ompi_info_show_ompi_version(ompi_info_ver_full);
|
||||
ompi_info_show_path(ompi_info_path_prefix, opal_install_dirs.prefix);
|
||||
ompi_info_do_arch();
|
||||
ompi_info_do_hostname();
|
||||
ompi_info_do_config(false);
|
||||
ompi_info_open_components();
|
||||
for (i = 0; i < mca_types.size; ++i) {
|
||||
if (NULL == (str = (char*)opal_pointer_array_get_item(&mca_types, i))) {
|
||||
continue;
|
||||
}
|
||||
if (0 != strcmp("mpi", str)) {
|
||||
ompi_info_show_component_version(str, ompi_info_component_all,
|
||||
ompi_info_ver_full, ompi_info_type_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
if (NULL != app_env) {
|
||||
opal_argv_free(app_env);
|
||||
}
|
||||
if (NULL != global_env) {
|
||||
opal_argv_free(global_env);
|
||||
}
|
||||
ompi_info_close_components();
|
||||
OBJ_RELEASE(ompi_info_cmd_line);
|
||||
OBJ_DESTRUCT(&mca_types);
|
||||
mca_base_close();
|
||||
|
||||
opal_finalize_util();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copryight (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <list>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/class/opal_object.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "opal/util/cmd_line.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ompi_info;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
bool ompi_info::pretty = true;
|
||||
opal_cmd_line_t *ompi_info::cmd_line = NULL;
|
||||
|
||||
const string ompi_info::type_all = "all";
|
||||
const string ompi_info::type_ompi = "ompi";
|
||||
const string ompi_info::type_orte = "orte";
|
||||
const string ompi_info::type_opal = "opal";
|
||||
const string ompi_info::type_base = "base";
|
||||
ompi_info::type_vector_t ompi_info::mca_types;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
bool want_help = false;
|
||||
bool cmd_error = false;
|
||||
bool acted = false;
|
||||
bool want_all = false;
|
||||
char **app_env = NULL, **global_env = NULL;
|
||||
int i, len;
|
||||
|
||||
// Initialize the argv parsing handle
|
||||
if (OMPI_SUCCESS != opal_init_util()) {
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true,
|
||||
"opal_init_util", __FILE__, __LINE__, NULL);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
cmd_line = OBJ_NEW(opal_cmd_line_t);
|
||||
if (NULL == cmd_line) {
|
||||
ret = errno;
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true,
|
||||
"opal_cmd_line_create", __FILE__, __LINE__, NULL);
|
||||
opal_finalize_util();
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
opal_cmd_line_make_opt3(cmd_line, 'v', NULL, "version", 2,
|
||||
"Show version of Open MPI or a component. The first parameter can be the keywords \"ompi\" or \"all\", a framework name (indicating all components in a framework), or a framework:component string (indicating a specific component). The second parameter can be one of: full, major, minor, release, greek, svn.");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "param", 2,
|
||||
"Show MCA parameters. The first parameter is the framework (or the keyword \"all\"); the second parameter is the specific component name (or the keyword \"all\").");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "internal", 0,
|
||||
"Show internal MCA parameters (not meant to be modified by users)");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "path", 1,
|
||||
"Show paths that Open MPI was configured with. Accepts the following parameters: prefix, bindir, libdir, incdir, mandir, pkglibdir, sysconfdir");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "arch", 0,
|
||||
"Show architecture Open MPI was compiled on");
|
||||
opal_cmd_line_make_opt3(cmd_line, 'c', NULL, "config", 0,
|
||||
"Show configuration options");
|
||||
opal_cmd_line_make_opt3(cmd_line, 'h', NULL, "help", 0,
|
||||
"Show this help message");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "pretty", 0,
|
||||
"When used in conjunction with other parameters, the output is displayed in 'prettyprint' format (default)");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "parsable", 0,
|
||||
"When used in conjunction with other parameters, the output is displayed in a machine-parsable format");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "parseable", 0,
|
||||
"Synonym for --parsable");
|
||||
opal_cmd_line_make_opt3(cmd_line, '\0', NULL, "hostname", 0,
|
||||
"Show the hostname that Open MPI was configured "
|
||||
"and built on");
|
||||
opal_cmd_line_make_opt3(cmd_line, 'a', NULL, "all", 0,
|
||||
"Show all configuration options and MCA parameters");
|
||||
|
||||
// Call some useless functions in order to guarantee to link in some
|
||||
// global variables. Only check the return value so that the
|
||||
// compiler doesn't optimize out the useless function.
|
||||
|
||||
if (OMPI_SUCCESS != ompi_comm_link_function()) {
|
||||
// Stop .. or I'll say stop again!
|
||||
++ret;
|
||||
} else {
|
||||
--ret;
|
||||
}
|
||||
|
||||
// set our threading level
|
||||
opal_set_using_threads(false);
|
||||
|
||||
// Get MCA parameters, if any */
|
||||
|
||||
if( OMPI_SUCCESS != mca_base_open() ) {
|
||||
orte_show_help("help-ompi_info.txt", "lib-call-fail", true, "mca_base_open", __FILE__, __LINE__ );
|
||||
OBJ_RELEASE(cmd_line);
|
||||
opal_finalize_util();
|
||||
exit(1);
|
||||
}
|
||||
mca_base_cmd_line_setup(cmd_line);
|
||||
|
||||
// Do the parsing
|
||||
|
||||
if (OMPI_SUCCESS != opal_cmd_line_parse(cmd_line, false, argc, argv)) {
|
||||
cmd_error = true;
|
||||
}
|
||||
if (!cmd_error &&
|
||||
(opal_cmd_line_is_taken(cmd_line, "help") ||
|
||||
opal_cmd_line_is_taken(cmd_line, "h"))) {
|
||||
want_help = true;
|
||||
}
|
||||
if (cmd_error || want_help) {
|
||||
char *usage = opal_cmd_line_get_usage_msg(cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
mca_base_close();
|
||||
OBJ_RELEASE(cmd_line);
|
||||
opal_finalize_util();
|
||||
exit(cmd_error ? 1 : 0);
|
||||
}
|
||||
|
||||
mca_base_cmd_line_process_args(cmd_line, &app_env, &global_env);
|
||||
|
||||
// putenv() all the stuff that we got back from env (in case the
|
||||
// user specified some --mca params on the command line). This
|
||||
// creates a memory leak, but that's unfortunately how putenv()
|
||||
// works. :-(
|
||||
|
||||
len = opal_argv_count(app_env);
|
||||
for (i = 0; i < len; ++i) {
|
||||
putenv(app_env[i]);
|
||||
}
|
||||
len = opal_argv_count(global_env);
|
||||
for (i = 0; i < len; ++i) {
|
||||
putenv(global_env[i]);
|
||||
}
|
||||
|
||||
ompi_info::mca_types.push_back("mca");
|
||||
ompi_info::mca_types.push_back("mpi");
|
||||
ompi_info::mca_types.push_back("orte");
|
||||
ompi_info::mca_types.push_back("opal");
|
||||
|
||||
ompi_info::mca_types.push_back("filter");
|
||||
ompi_info::mca_types.push_back("backtrace");
|
||||
ompi_info::mca_types.push_back("memchecker");
|
||||
ompi_info::mca_types.push_back("memory");
|
||||
ompi_info::mca_types.push_back("paffinity");
|
||||
ompi_info::mca_types.push_back("carto");
|
||||
ompi_info::mca_types.push_back("maffinity");
|
||||
ompi_info::mca_types.push_back("timer");
|
||||
ompi_info::mca_types.push_back("installdirs");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
ompi_info::mca_types.push_back("crs");
|
||||
#endif
|
||||
ompi_info::mca_types.push_back("dpm");
|
||||
ompi_info::mca_types.push_back("pubsub");
|
||||
ompi_info::mca_types.push_back("allocator");
|
||||
ompi_info::mca_types.push_back("coll");
|
||||
ompi_info::mca_types.push_back("io");
|
||||
ompi_info::mca_types.push_back("mpool");
|
||||
ompi_info::mca_types.push_back("pml");
|
||||
ompi_info::mca_types.push_back("bml");
|
||||
ompi_info::mca_types.push_back("rcache");
|
||||
ompi_info::mca_types.push_back("btl");
|
||||
ompi_info::mca_types.push_back("mtl");
|
||||
ompi_info::mca_types.push_back("topo");
|
||||
ompi_info::mca_types.push_back("osc");
|
||||
ompi_info::mca_types.push_back("op");
|
||||
ompi_info::mca_types.push_back("common");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
ompi_info::mca_types.push_back("crcp");
|
||||
#endif
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
ompi_info::mca_types.push_back("iof");
|
||||
ompi_info::mca_types.push_back("oob");
|
||||
ompi_info::mca_types.push_back("odls");
|
||||
ompi_info::mca_types.push_back("ras");
|
||||
ompi_info::mca_types.push_back("rmaps");
|
||||
ompi_info::mca_types.push_back("rml");
|
||||
ompi_info::mca_types.push_back("routed");
|
||||
ompi_info::mca_types.push_back("plm");
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
ompi_info::mca_types.push_back("snapc");
|
||||
#endif
|
||||
ompi_info::mca_types.push_back("filem");
|
||||
#endif
|
||||
/* these are always included */
|
||||
ompi_info::mca_types.push_back("errmgr");
|
||||
ompi_info::mca_types.push_back("ess");
|
||||
ompi_info::mca_types.push_back("grpcomm");
|
||||
ompi_info::mca_types.push_back("notifier");
|
||||
|
||||
// Execute the desired action(s)
|
||||
|
||||
if (opal_cmd_line_is_taken(cmd_line, "pretty")) {
|
||||
ompi_info::pretty = true;
|
||||
} else if (opal_cmd_line_is_taken(cmd_line, "parsable") || opal_cmd_line_is_taken(cmd_line, "parseable")) {
|
||||
ompi_info::pretty = false;
|
||||
}
|
||||
|
||||
want_all = opal_cmd_line_is_taken(cmd_line, "all");
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "version")) {
|
||||
do_version(want_all, cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "path")) {
|
||||
do_path(want_all, cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "arch")) {
|
||||
do_arch();
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "hostname")) {
|
||||
do_hostname();
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "config")) {
|
||||
do_config(true);
|
||||
acted = true;
|
||||
}
|
||||
if (want_all || opal_cmd_line_is_taken(cmd_line, "param")) {
|
||||
do_params(want_all, opal_cmd_line_is_taken(cmd_line, "internal"));
|
||||
acted = true;
|
||||
}
|
||||
|
||||
// If no command line args are specified, show default set
|
||||
|
||||
if (!acted) {
|
||||
ompi_info::show_ompi_version(ver_full);
|
||||
ompi_info::show_path(path_prefix, opal_install_dirs.prefix);
|
||||
ompi_info::do_arch();
|
||||
ompi_info::do_hostname();
|
||||
ompi_info::do_config(false);
|
||||
ompi_info::open_components();
|
||||
for (ompi_info::type_vector_t::size_type i = 0;
|
||||
i < mca_types.size(); ++i) {
|
||||
if ("mpi" != mca_types[i]) {
|
||||
ompi_info::show_component_version(mca_types[i], component_all,
|
||||
ver_full, type_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All done
|
||||
|
||||
if (NULL != app_env) {
|
||||
opal_argv_free(app_env);
|
||||
}
|
||||
if (NULL != global_env) {
|
||||
opal_argv_free(global_env);
|
||||
}
|
||||
ompi_info::close_components();
|
||||
OBJ_RELEASE(cmd_line);
|
||||
mca_base_close();
|
||||
|
||||
opal_finalize_util();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,130 +1,128 @@
|
||||
//
|
||||
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
/*
|
||||
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OMPI_INFO_H
|
||||
#define OMPI_INFO_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#ifndef OMPI_INFO_C_H
|
||||
#define OMPI_INFO_C_H
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
#include "opal/util/cmd_line.h"
|
||||
#include "opal/mca/mca.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
namespace ompi_info {
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern bool ompi_info_pretty;
|
||||
extern opal_cmd_line_t *ompi_info_cmd_line;
|
||||
|
||||
typedef std::vector<std::string> type_vector_t;
|
||||
extern const char *ompi_info_type_all;
|
||||
extern const char *ompi_info_type_ompi;
|
||||
extern const char *ompi_info_type_orte;
|
||||
extern const char *ompi_info_type_opal;
|
||||
extern const char *ompi_info_type_base;
|
||||
|
||||
extern bool pretty;
|
||||
extern opal_cmd_line_t *cmd_line;
|
||||
extern opal_pointer_array_t mca_types;
|
||||
|
||||
extern const std::string type_all;
|
||||
extern const std::string type_ompi;
|
||||
extern const std::string type_orte;
|
||||
extern const std::string type_opal;
|
||||
extern const std::string type_base;
|
||||
extern type_vector_t mca_types;
|
||||
|
||||
//
|
||||
// Version-related strings and functions
|
||||
//
|
||||
/*
|
||||
* Version-related strings and functions
|
||||
*/
|
||||
|
||||
extern const std::string ver_full;
|
||||
extern const std::string ver_major;
|
||||
extern const std::string ver_minor;
|
||||
extern const std::string ver_release;
|
||||
extern const std::string ver_greek;
|
||||
extern const std::string ver_svn;
|
||||
extern const char *ompi_info_ver_full;
|
||||
extern const char *ompi_info_ver_major;
|
||||
extern const char *ompi_info_ver_minor;
|
||||
extern const char *ompi_info_ver_release;
|
||||
extern const char *ompi_info_ver_greek;
|
||||
extern const char *ompi_info_ver_svn;
|
||||
|
||||
void do_version(bool want_all, opal_cmd_line_t *cmd_line);
|
||||
void show_ompi_version(const std::string& scope);
|
||||
void show_component_version(const std::string& type_name,
|
||||
const std::string& component_name,
|
||||
const std::string& scope,
|
||||
const std::string& ver_type);
|
||||
void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line);
|
||||
void ompi_info_show_ompi_version(const char *scope);
|
||||
void ompi_info_show_component_version(const char *type_name,
|
||||
const char *component_name,
|
||||
const char *scope,
|
||||
const char *ver_type);
|
||||
|
||||
//
|
||||
// Parameter/configuration-related functions
|
||||
//
|
||||
/*
|
||||
* Parameter/configuration-related functions
|
||||
*/
|
||||
|
||||
extern const std::string component_all;
|
||||
extern const std::string param_all;
|
||||
extern const char *ompi_info_component_all;
|
||||
extern const char *ompi_info_param_all;
|
||||
|
||||
extern const std::string path_prefix;
|
||||
extern const std::string path_bindir;
|
||||
extern const std::string path_libdir;
|
||||
extern const std::string path_incdir;
|
||||
extern const std::string path_mandir;
|
||||
extern const std::string path_pkglibdir;
|
||||
extern const std::string path_sysconfdir;
|
||||
extern const std::string path_exec_prefix;
|
||||
extern const std::string path_sbindir;
|
||||
extern const std::string path_libexecdir;
|
||||
extern const std::string path_datarootdir;
|
||||
extern const std::string path_datadir;
|
||||
extern const std::string path_sharedstatedir;
|
||||
extern const std::string path_localstatedir;
|
||||
extern const std::string path_infodir;
|
||||
extern const std::string path_pkgdatadir;
|
||||
extern const std::string path_pkgincludedir;
|
||||
extern const char *ompi_info_path_prefix;
|
||||
extern const char *ompi_info_path_bindir;
|
||||
extern const char *ompi_info_path_libdir;
|
||||
extern const char *ompi_info_path_incdir;
|
||||
extern const char *ompi_info_path_mandir;
|
||||
extern const char *ompi_info_path_pkglibdir;
|
||||
extern const char *ompi_info_path_sysconfdir;
|
||||
extern const char *ompi_info_path_exec_prefix;
|
||||
extern const char *ompi_info_path_sbindir;
|
||||
extern const char *ompi_info_path_libexecdir;
|
||||
extern const char *ompi_info_path_datarootdir;
|
||||
extern const char *ompi_info_path_datadir;
|
||||
extern const char *ompi_info_path_sharedstatedir;
|
||||
extern const char *ompi_info_path_localstatedir;
|
||||
extern const char *ompi_info_path_infodir;
|
||||
extern const char *ompi_info_path_pkgdatadir;
|
||||
extern const char *ompi_info_path_pkgincludedir;
|
||||
|
||||
void do_params(bool want_all, bool want_internal);
|
||||
void show_mca_params(opal_list_t *info,
|
||||
const std::string& type, const std::string& component,
|
||||
bool want_internal);
|
||||
void ompi_info_do_params(bool want_all, bool want_internal);
|
||||
void ompi_info_show_mca_params(opal_list_t *info,
|
||||
const char *type, const char *component,
|
||||
bool want_internal);
|
||||
|
||||
void do_path(bool want_all, opal_cmd_line_t *cmd_line);
|
||||
void show_path(const std::string& type, const std::string& value);
|
||||
void ompi_info_do_path(bool want_all, opal_cmd_line_t *cmd_line);
|
||||
void ompi_info_show_path(const char *type, const char *value);
|
||||
|
||||
void do_arch();
|
||||
void do_hostname();
|
||||
void do_config(bool want_all);
|
||||
void ompi_info_do_arch(void);
|
||||
void ompi_info_do_hostname(void);
|
||||
void ompi_info_do_config(bool want_all);
|
||||
|
||||
//
|
||||
// Output-related functions
|
||||
//
|
||||
void out(const std::string& pretty_message,
|
||||
const std::string &plain_message,
|
||||
int value);
|
||||
void out(const std::string& pretty_message,
|
||||
const std::string &plain_message,
|
||||
const std::string& value,
|
||||
bool strip_leading_whitespace = true,
|
||||
bool strip_trailing_whitespace = true);
|
||||
/*
|
||||
* Output-related functions
|
||||
*/
|
||||
void ompi_info_out(const char *pretty_message,
|
||||
const char *plain_message,
|
||||
const char *value);
|
||||
void ompi_info_out_int(const char *pretty_message,
|
||||
const char *plain_message,
|
||||
int value);
|
||||
/*
|
||||
* Component-related functions
|
||||
*/
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
char *type;
|
||||
opal_list_t *components;
|
||||
} ompi_info_component_map_t;
|
||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_info_component_map_t);
|
||||
|
||||
//
|
||||
// Component-related functions
|
||||
//
|
||||
extern opal_pointer_array_t component_map;
|
||||
|
||||
typedef std::map<std::string, opal_list_t *> component_map_t;
|
||||
void ompi_info_open_components(void);
|
||||
void ompi_info_close_components(void);
|
||||
|
||||
extern component_map_t component_map;
|
||||
|
||||
void open_components();
|
||||
void close_components();
|
||||
|
||||
}
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* OMPI_INFO_H */
|
||||
|
202
ompi/tools/ompi_info/output.c
Обычный файл
202
ompi/tools/ompi_info/output.c
Обычный файл
@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <io.h>
|
||||
#endif /* __WINDOWS__ */
|
||||
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
#define OMPI_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
||||
/*
|
||||
* Private variables - set some reasonable screen size defaults
|
||||
*/
|
||||
|
||||
static int centerpoint = 24;
|
||||
static int screen_width = 78;
|
||||
|
||||
/*
|
||||
* Prints the passed integer in a pretty or parsable format.
|
||||
*/
|
||||
void ompi_info_out(const char *pretty_message, const char *plain_message, const char *value)
|
||||
{
|
||||
size_t i, len, max_value_width;
|
||||
char *spaces = NULL;
|
||||
char *filler = NULL;
|
||||
char *pos, *v, savev;
|
||||
|
||||
#ifdef HAVE_ISATTY
|
||||
/* If we have isatty(), if this is not a tty, then disable
|
||||
* wrapping for grep-friendly behavior
|
||||
*/
|
||||
if (0 == isatty(STDOUT_FILENO)) {
|
||||
screen_width = INT_MAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
if (screen_width < INT_MAX) {
|
||||
struct winsize size;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, (char*) &size) >= 0) {
|
||||
screen_width = size.ws_col;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Strip leading and trailing whitespace from the string value */
|
||||
v = strdup(value);
|
||||
len = strlen(v);
|
||||
if (isspace(v[0])) {
|
||||
char *newv;
|
||||
i = 0;
|
||||
while (isspace(v[i]) && i < len) {
|
||||
++i;
|
||||
}
|
||||
newv = strdup(v + i);
|
||||
free(v);
|
||||
v = newv;
|
||||
len = strlen(v);
|
||||
}
|
||||
if (len > 0 && isspace(v[len - 1])) {
|
||||
i = len - 1;
|
||||
/* Note that i is size_t (unsigned), so we can't check for i
|
||||
>= 0. But we don't need to, because if the value was all
|
||||
whitespace, stripping whitespace from the left (above)
|
||||
would have resulted in an empty string, and we wouldn't
|
||||
have gotten into this block. */
|
||||
while (isspace(v[i]) && i > 0) {
|
||||
--i;
|
||||
}
|
||||
v[i] = '\0';
|
||||
}
|
||||
|
||||
if (ompi_info_pretty && NULL != pretty_message) {
|
||||
if (centerpoint > (int)strlen(pretty_message)) {
|
||||
asprintf(&spaces, "%*s", centerpoint -
|
||||
(int)strlen(pretty_message), " ");
|
||||
} else {
|
||||
spaces = strdup("");
|
||||
#if OPAL_ENABLE_DEBUG
|
||||
if (centerpoint < (int)strlen(pretty_message)) {
|
||||
opal_show_help("help-ompi_info.txt",
|
||||
"developer warning: field too long", false,
|
||||
pretty_message, centerpoint);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
max_value_width = screen_width - strlen(spaces) - strlen(pretty_message) - 2;
|
||||
if (0 < strlen(pretty_message)) {
|
||||
asprintf(&filler, "%s%s: ", spaces, pretty_message);
|
||||
} else {
|
||||
asprintf(&filler, "%s ", spaces);
|
||||
}
|
||||
free(spaces);
|
||||
spaces = NULL;
|
||||
|
||||
while (true) {
|
||||
if (strlen(v) < max_value_width) {
|
||||
printf("%s%s\n", filler, v);
|
||||
break;
|
||||
} else {
|
||||
asprintf(&spaces, "%*s", centerpoint + 2, " ");
|
||||
|
||||
/* Work backwards to find the first space before
|
||||
* max_value_width
|
||||
*/
|
||||
savev = v[max_value_width];
|
||||
v[max_value_width] = '\0';
|
||||
pos = (char*)strrchr(v, (int)' ');
|
||||
v[max_value_width] = savev;
|
||||
if (NULL == pos) {
|
||||
/* No space found < max_value_width. Look for the first
|
||||
* space after max_value_width.
|
||||
*/
|
||||
pos = strchr(&v[max_value_width], ' ');
|
||||
|
||||
if (NULL == pos) {
|
||||
|
||||
/* There's just no spaces. So just print it and be done. */
|
||||
|
||||
printf("%s%s\n", filler, v);
|
||||
break;
|
||||
} else {
|
||||
*pos = '\0';
|
||||
printf("%s%s\n", filler, v);
|
||||
v = pos + 1;
|
||||
}
|
||||
} else {
|
||||
*pos = '\0';
|
||||
printf("%s%s\n", filler, v);
|
||||
v = pos + 1;
|
||||
}
|
||||
|
||||
/* Reset for the next iteration */
|
||||
free(filler);
|
||||
filler = strdup(spaces);
|
||||
free(spaces);
|
||||
spaces = NULL;
|
||||
}
|
||||
}
|
||||
if (NULL != filler) {
|
||||
free(filler);
|
||||
}
|
||||
if (NULL != spaces) {
|
||||
free(spaces);
|
||||
}
|
||||
} else {
|
||||
if (NULL != plain_message && 0 < strlen(plain_message)) {
|
||||
printf("%s:%s\n", plain_message, value);
|
||||
} else {
|
||||
printf(" %s\n", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ompi_info_out_int(const char *pretty_message,
|
||||
const char *plain_message,
|
||||
int value)
|
||||
{
|
||||
char *valstr;
|
||||
|
||||
asprintf(&valstr, "%d", (int)value);
|
||||
ompi_info_out(pretty_message, plain_message, valstr);
|
||||
free(valstr);
|
||||
}
|
@ -1,214 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <io.h>
|
||||
#endif /* __WINDOWS__ */
|
||||
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ompi_info;
|
||||
|
||||
#define OMPI_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
||||
//
|
||||
// Private variables - set some reasonable screen size defaults
|
||||
//
|
||||
|
||||
static unsigned int centerpoint = 24;
|
||||
static unsigned int screen_width = 78;
|
||||
|
||||
//
|
||||
// Prints the passed strings in a pretty or parsable format.
|
||||
//
|
||||
void ompi_info::out(const string& pretty_message, const string &plain_message,
|
||||
const string& value, bool strip_leading_whitespace,
|
||||
bool strip_trailing_whitespace)
|
||||
{
|
||||
string local_value = value;
|
||||
|
||||
#ifdef HAVE_ISATTY
|
||||
// If we have isatty(), if this is not a tty, then disable
|
||||
// wrapping for grep-friendly behavior
|
||||
if (0 == isatty(STDOUT_FILENO)) {
|
||||
screen_width = INT_MAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
if (screen_width < INT_MAX) {
|
||||
struct winsize size;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, (char*) &size) >= 0) {
|
||||
screen_width = size.ws_col;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strip_leading_whitespace) {
|
||||
string::size_type i = 0;
|
||||
while (i < local_value.length() && isspace(local_value[i])) {
|
||||
++i;
|
||||
}
|
||||
if (i > local_value.length()) {
|
||||
local_value = "";
|
||||
} else if (i > 0) {
|
||||
local_value = local_value.substr(i);
|
||||
}
|
||||
}
|
||||
if (strip_trailing_whitespace) {
|
||||
string::size_type i = local_value.length();
|
||||
if (i > 0) {
|
||||
// Note that string::size_type is unsigned, so we can't
|
||||
// check for i<0
|
||||
while (i > 0 && isspace(local_value[i])) {
|
||||
--i;
|
||||
}
|
||||
// Instead, just check to see if we got down to 0 and the
|
||||
// last character is also a space
|
||||
if (i > 0) {
|
||||
local_value = local_value.substr(0, i);
|
||||
} else {
|
||||
if (isspace(local_value[0])) {
|
||||
local_value = "";
|
||||
} else {
|
||||
local_value = local_value[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pretty) {
|
||||
string::size_type pos, max_value_width;
|
||||
string spaces;
|
||||
string v = local_value;
|
||||
string filler;
|
||||
|
||||
if (centerpoint > pretty_message.length()) {
|
||||
spaces = string(centerpoint - pretty_message.length(), ' ');
|
||||
}
|
||||
|
||||
max_value_width = screen_width - spaces.length() -
|
||||
pretty_message.length() - 2;
|
||||
if (!pretty_message.empty()) {
|
||||
filler = spaces + pretty_message + ": ";
|
||||
} else {
|
||||
filler = spaces + " ";
|
||||
}
|
||||
|
||||
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 {
|
||||
if (!plain_message.empty()) {
|
||||
cout << plain_message << ":" << local_value << endl;
|
||||
} else {
|
||||
cout << local_value << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Prints the passed integer in a pretty or parsable format.
|
||||
//
|
||||
void ompi_info::out(const string& pretty_message, const string &plain_message,
|
||||
int value)
|
||||
{
|
||||
if (ompi_info::pretty) {
|
||||
if (centerpoint > pretty_message.length()) {
|
||||
string spaces(centerpoint - pretty_message.length(), ' ');
|
||||
cout << spaces;
|
||||
}
|
||||
#if OPAL_ENABLE_DEBUG
|
||||
else {
|
||||
opal_show_help("help-ompi_info.txt",
|
||||
"developer warning: field too long", false,
|
||||
pretty_message.c_str(), centerpoint);
|
||||
}
|
||||
#endif
|
||||
if (!pretty_message.empty()) {
|
||||
cout << pretty_message << ": " << value << endl;
|
||||
} else {
|
||||
cout << " " << value << endl;
|
||||
}
|
||||
} else {
|
||||
if (!plain_message.empty()) {
|
||||
cout << plain_message << ":" << value << endl;
|
||||
} else {
|
||||
cout << value << endl;
|
||||
}
|
||||
}
|
||||
}
|
840
ompi/tools/ompi_info/param.c
Обычный файл
840
ompi/tools/ompi_info/param.c
Обычный файл
@ -0,0 +1,840 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include MCA_timer_IMPLEMENTATION_HEADER
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
#include "opal/util/printf.h"
|
||||
#include "opal/memoryhooks/memory.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
|
||||
#include "orte/util/show_help.h"
|
||||
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
#include "ompi/include/mpi_portable_platform.h"
|
||||
|
||||
|
||||
/*
|
||||
* Public variables
|
||||
*/
|
||||
|
||||
const char *ompi_info_component_all = "all";
|
||||
const char *ompi_info_param_all = "all";
|
||||
|
||||
const char *ompi_info_path_prefix = "prefix";
|
||||
const char *ompi_info_path_bindir = "bindir";
|
||||
const char *ompi_info_path_libdir = "libdir";
|
||||
const char *ompi_info_path_incdir = "incdir";
|
||||
const char *ompi_info_path_mandir = "mandir";
|
||||
const char *ompi_info_path_pkglibdir = "pkglibdir";
|
||||
const char *ompi_info_path_sysconfdir = "sysconfdir";
|
||||
const char *ompi_info_path_exec_prefix = "exec_prefix";
|
||||
const char *ompi_info_path_sbindir = "sbindir";
|
||||
const char *ompi_info_path_libexecdir = "libexecdir";
|
||||
const char *ompi_info_path_datarootdir = "datarootdir";
|
||||
const char *ompi_info_path_datadir = "datadir";
|
||||
const char *ompi_info_path_sharedstatedir = "sharedstatedir";
|
||||
const char *ompi_info_path_localstatedir = "localstatedir";
|
||||
const char *ompi_info_path_infodir = "infodir";
|
||||
const char *ompi_info_path_pkgdatadir = "pkgdatadir";
|
||||
const char *ompi_info_path_pkgincludedir = "pkgincludedir";
|
||||
|
||||
/*
|
||||
* External variables
|
||||
*
|
||||
* This exists in mca/base/mca_base_param.c. It's not extern'ed
|
||||
* in mca_base_param.h so that no one else will use it.
|
||||
*/
|
||||
|
||||
extern opal_value_array_t mca_base_params;
|
||||
|
||||
|
||||
void ompi_info_do_params(bool want_all_in, bool want_internal)
|
||||
{
|
||||
int count;
|
||||
char *type, *component, *str;
|
||||
bool found;
|
||||
int i;
|
||||
bool want_all = false;
|
||||
opal_list_t *info;
|
||||
|
||||
ompi_info_open_components();
|
||||
|
||||
if (want_all_in) {
|
||||
want_all = true;
|
||||
} else {
|
||||
/* See if the special param "all" was givin to --param; that
|
||||
* superceeds any individual type
|
||||
*/
|
||||
count = opal_cmd_line_get_ninsts(ompi_info_cmd_line, "param");
|
||||
for (i = 0; i < count; ++i) {
|
||||
type = opal_cmd_line_get_param(ompi_info_cmd_line, "param", (int)i, 0);
|
||||
if (0 == strcmp(ompi_info_type_all, type)) {
|
||||
want_all = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get a dump of all the MCA params */
|
||||
mca_base_param_dump(&info, want_internal);
|
||||
|
||||
/* Show the params */
|
||||
|
||||
if (want_all) {
|
||||
for (i = 0; i < mca_types.size; ++i) {
|
||||
if (NULL == (type = opal_pointer_array_get_item(&mca_types, i))) {
|
||||
continue;
|
||||
}
|
||||
ompi_info_show_mca_params(info, type, ompi_info_component_all, want_internal);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < count; ++i) {
|
||||
type = opal_cmd_line_get_param(ompi_info_cmd_line, "param", (int)i, 0);
|
||||
component = opal_cmd_line_get_param(ompi_info_cmd_line, "param", (int)i, 1);
|
||||
|
||||
for (found = false, i = 0; i < mca_types.size; ++i) {
|
||||
if (NULL == (str = opal_pointer_array_get_item(&mca_types, i))) {
|
||||
continue;
|
||||
}
|
||||
if (0 == strcmp(str, type)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
char *usage = opal_cmd_line_get_usage_msg(ompi_info_cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ompi_info_show_mca_params(info, type, component, want_internal);
|
||||
}
|
||||
}
|
||||
|
||||
/* Release all the MCA param memory */
|
||||
mca_base_param_dump_release(info);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_show_mca_params(opal_list_t *info,
|
||||
const char *type, const char *component,
|
||||
bool want_internal)
|
||||
{
|
||||
opal_list_item_t *i;
|
||||
mca_base_param_info_t *p;
|
||||
char *value_string, *empty = "";
|
||||
char *message, *content, *tmp;
|
||||
int value_int, j;
|
||||
mca_base_param_source_t source;
|
||||
char *src_file;
|
||||
|
||||
for (i = opal_list_get_first(info); i != opal_list_get_last(info);
|
||||
i = opal_list_get_next(i)) {
|
||||
p = (mca_base_param_info_t*) i;
|
||||
|
||||
if (NULL != p->mbpp_type_name && 0 == strcmp(type, p->mbpp_type_name)) {
|
||||
if (0 == strcmp(component, ompi_info_component_all) ||
|
||||
NULL == p->mbpp_component_name ||
|
||||
(NULL != p->mbpp_component_name &&
|
||||
0 == strcmp(component, p->mbpp_component_name))) {
|
||||
|
||||
/* Find the source of the value */
|
||||
if (OPAL_SUCCESS !=
|
||||
mca_base_param_lookup_source(p->mbpp_index, &source, &src_file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Make a char *for the default value. Invoke a
|
||||
* lookup because it may transform the char *("~/" ->
|
||||
* "<home dir>/") or get the value from the
|
||||
* environment, a file, etc.
|
||||
*/
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
|
||||
mca_base_param_lookup_string(p->mbpp_index,
|
||||
&value_string);
|
||||
|
||||
/* Can't let the char *be NULL because we
|
||||
* assign it to a std::string, below
|
||||
*/
|
||||
if (NULL == value_string) {
|
||||
value_string = strdup(empty);
|
||||
}
|
||||
} else {
|
||||
mca_base_param_lookup_int(p->mbpp_index, &value_int);
|
||||
asprintf(&value_string, "%d", value_int);
|
||||
}
|
||||
|
||||
/* Build up the strings to ompi_info_output. */
|
||||
|
||||
if (ompi_info_pretty) {
|
||||
asprintf(&message, "MCA %s", p->mbpp_type_name);
|
||||
|
||||
/* Put in the real, full name (which may be
|
||||
* different than the categorization).
|
||||
*/
|
||||
asprintf(&content, "%s \"%s\" (%s: <%s>, data source: ",
|
||||
p->mbpp_read_only ? "information" : "parameter",
|
||||
p->mbpp_full_name,
|
||||
p->mbpp_read_only ? "value" : "current value",
|
||||
(0 == strlen(value_string)) ? "none" : value_string);
|
||||
|
||||
/* Indicate where the param was set from */
|
||||
switch(source) {
|
||||
case MCA_BASE_PARAM_SOURCE_DEFAULT:
|
||||
asprintf(&tmp, "%sdefault value", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_ENV:
|
||||
asprintf(&tmp, "%senvironment or cmdline", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_FILE:
|
||||
asprintf(&tmp, "%sfile [%s]", content, src_file);
|
||||
free(content);
|
||||
content = tmp;
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_OVERRIDE:
|
||||
asprintf(&tmp, "%sAPI override", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Is this parameter deprecated? */
|
||||
if (p->mbpp_deprecated) {
|
||||
asprintf(&tmp, "%s, deprecated", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
}
|
||||
|
||||
/* Does this parameter have any synonyms? */
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
asprintf(&tmp, "%s, synonyms: ", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
if (j > 0) {
|
||||
asprintf(&tmp, "%s, %s", content, p->mbpp_synonyms[j]->mbpp_full_name);
|
||||
free(content);
|
||||
content = tmp;
|
||||
} else {
|
||||
asprintf(&tmp, "%s%s", content, p->mbpp_synonyms[j]->mbpp_full_name);
|
||||
free(content);
|
||||
content = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Is this parameter a synonym of something else? */
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
asprintf(&tmp, "%s, synonym of: %s", content, p->mbpp_synonym_parent->mbpp_full_name);
|
||||
free(content);
|
||||
content = tmp;
|
||||
}
|
||||
asprintf(&tmp, "%s)", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
free(content);
|
||||
|
||||
/* If we have a help message, ompi_info_output it */
|
||||
if (NULL != p->mbpp_help_msg) {
|
||||
ompi_info_out("", "", p->mbpp_help_msg);
|
||||
}
|
||||
} else {
|
||||
/* build the message*/
|
||||
asprintf(&tmp, "mca:%s:%s:param:%s:", p->mbpp_type_name,
|
||||
(NULL == p->mbpp_component_name) ? "base" : p->mbpp_component_name,
|
||||
p->mbpp_full_name);
|
||||
|
||||
/* Output the value */
|
||||
asprintf(&message, "%svalue", tmp);
|
||||
ompi_info_out(message, message, value_string);
|
||||
free(message);
|
||||
|
||||
/* Indicate where the param was set from */
|
||||
|
||||
asprintf(&message, "%sdata_source", tmp);
|
||||
switch(source) {
|
||||
case MCA_BASE_PARAM_SOURCE_DEFAULT:
|
||||
content = strdup("default value");
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_ENV:
|
||||
content = strdup("environment-cmdline");
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_FILE:
|
||||
asprintf(&content, "file: %s", src_file);
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_OVERRIDE:
|
||||
content = strdup("API override");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
free(content);
|
||||
|
||||
/* Output whether it's read only or writable */
|
||||
|
||||
asprintf(&message, "%sstatus", tmp);
|
||||
content = p->mbpp_read_only ? "read-only" : "writable";
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
|
||||
/* If it has a help message, ompi_info_output that */
|
||||
|
||||
if (NULL != p->mbpp_help_msg) {
|
||||
asprintf(&message, "%shelp", tmp);
|
||||
content = p->mbpp_help_msg;
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
}
|
||||
|
||||
/* Is this parameter deprecated? */
|
||||
asprintf(&message, "%sdeprecated", tmp);
|
||||
content = p->mbpp_deprecated ? "yes" : "no";
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
|
||||
/* Does this parameter have any synonyms? */
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
asprintf(&message, "%ssynonym:name", tmp);
|
||||
content = p->mbpp_synonyms[j]->mbpp_full_name;
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
}
|
||||
}
|
||||
|
||||
/* Is this parameter a synonym of something else? */
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
asprintf(&message, "%ssynonym_of:name", tmp);
|
||||
content = p->mbpp_synonym_parent->mbpp_full_name;
|
||||
ompi_info_out(message, message, content);
|
||||
free(message);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we allocated the string, then free it */
|
||||
|
||||
if (NULL != value_string) {
|
||||
free(value_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_do_path(bool want_all, opal_cmd_line_t *cmd_line)
|
||||
{
|
||||
int i, count;
|
||||
char *scope;
|
||||
|
||||
/* Check bozo case */
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "path");
|
||||
for (i = 0; i < count; ++i) {
|
||||
scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
|
||||
if (0 == strcmp("all", scope)) {
|
||||
want_all = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (want_all) {
|
||||
ompi_info_show_path(ompi_info_path_prefix, opal_install_dirs.prefix);
|
||||
ompi_info_show_path(ompi_info_path_exec_prefix, opal_install_dirs.exec_prefix);
|
||||
ompi_info_show_path(ompi_info_path_bindir, opal_install_dirs.bindir);
|
||||
ompi_info_show_path(ompi_info_path_sbindir, opal_install_dirs.sbindir);
|
||||
ompi_info_show_path(ompi_info_path_libdir, opal_install_dirs.libdir);
|
||||
ompi_info_show_path(ompi_info_path_incdir, opal_install_dirs.includedir);
|
||||
ompi_info_show_path(ompi_info_path_mandir, opal_install_dirs.mandir);
|
||||
ompi_info_show_path(ompi_info_path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
ompi_info_show_path(ompi_info_path_libexecdir, opal_install_dirs.libexecdir);
|
||||
ompi_info_show_path(ompi_info_path_datarootdir, opal_install_dirs.datarootdir);
|
||||
ompi_info_show_path(ompi_info_path_datadir, opal_install_dirs.datadir);
|
||||
ompi_info_show_path(ompi_info_path_sysconfdir, opal_install_dirs.sysconfdir);
|
||||
ompi_info_show_path(ompi_info_path_sharedstatedir, opal_install_dirs.sharedstatedir);
|
||||
ompi_info_show_path(ompi_info_path_localstatedir, opal_install_dirs.localstatedir);
|
||||
ompi_info_show_path(ompi_info_path_infodir, opal_install_dirs.infodir);
|
||||
ompi_info_show_path(ompi_info_path_pkgdatadir, opal_install_dirs.pkgdatadir);
|
||||
ompi_info_show_path(ompi_info_path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
ompi_info_show_path(ompi_info_path_pkgincludedir, opal_install_dirs.pkgincludedir);
|
||||
} else {
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "path");
|
||||
for (i = 0; i < count; ++i) {
|
||||
scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
|
||||
|
||||
if (0 == strcmp(ompi_info_path_prefix, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_prefix, opal_install_dirs.prefix);
|
||||
} else if (0 == strcmp(ompi_info_path_bindir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_bindir, opal_install_dirs.bindir);
|
||||
} else if (0 == strcmp(ompi_info_path_libdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_libdir, opal_install_dirs.libdir);
|
||||
} else if (0 == strcmp(ompi_info_path_incdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_incdir, opal_install_dirs.includedir);
|
||||
} else if (0 == strcmp(ompi_info_path_mandir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_mandir, opal_install_dirs.mandir);
|
||||
} else if (0 == strcmp(ompi_info_path_pkglibdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
} else if (0 == strcmp(ompi_info_path_sysconfdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_sysconfdir, opal_install_dirs.sysconfdir);
|
||||
} else if (0 == strcmp(ompi_info_path_exec_prefix, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_exec_prefix, opal_install_dirs.exec_prefix);
|
||||
} else if (0 == strcmp(ompi_info_path_sbindir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_sbindir, opal_install_dirs.sbindir);
|
||||
} else if (0 == strcmp(ompi_info_path_libexecdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_libexecdir, opal_install_dirs.libexecdir);
|
||||
} else if (0 == strcmp(ompi_info_path_datarootdir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_datarootdir, opal_install_dirs.datarootdir);
|
||||
} else if (0 == strcmp(ompi_info_path_datadir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_datadir, opal_install_dirs.datadir);
|
||||
} else if (0 == strcmp(ompi_info_path_sharedstatedir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_sharedstatedir, opal_install_dirs.sharedstatedir);
|
||||
} else if (0 == strcmp(ompi_info_path_localstatedir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_localstatedir, opal_install_dirs.localstatedir);
|
||||
} else if (0 == strcmp(ompi_info_path_infodir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_infodir, opal_install_dirs.infodir);
|
||||
} else if (0 == strcmp(ompi_info_path_pkgdatadir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_pkgdatadir, opal_install_dirs.pkgdatadir);
|
||||
} else if (0 == strcmp(ompi_info_path_pkgincludedir, scope)) {
|
||||
ompi_info_show_path(ompi_info_path_pkgincludedir, opal_install_dirs.pkgincludedir);
|
||||
} else {
|
||||
char *usage = opal_cmd_line_get_usage_msg(cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_show_path(const char *type, const char *value)
|
||||
{
|
||||
char *pretty, *path;
|
||||
|
||||
pretty = strdup(type);
|
||||
pretty[0] = toupper(pretty[0]);
|
||||
|
||||
asprintf(&path, "path:%s", type);
|
||||
ompi_info_out(pretty, path, value);
|
||||
free(pretty);
|
||||
free(path);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_do_arch()
|
||||
{
|
||||
ompi_info_out("Configured architecture", "config:arch", OPAL_ARCH);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info_do_hostname()
|
||||
{
|
||||
ompi_info_out("Configure host", "config:host", OMPI_CONFIGURE_HOST);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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 ompi was configured. There are many options here
|
||||
* that are carried forward from OMPI-7 and are not mca parameters
|
||||
* in OMPI-10. I have to dig through the invalid options and replace
|
||||
* them with OMPI-10 options.
|
||||
*/
|
||||
void ompi_info_do_config(bool want_all)
|
||||
{
|
||||
char *cxx;
|
||||
char *f77;
|
||||
char *f90;
|
||||
char *f90_size;
|
||||
char *heterogeneous;
|
||||
char *memprofile;
|
||||
char *memdebug;
|
||||
char *debug;
|
||||
char *mpi_interface_warning;
|
||||
char *cprofiling;
|
||||
char *cxxprofiling;
|
||||
char *f77profiling;
|
||||
char *f90profiling;
|
||||
char *cxxexceptions;
|
||||
char *threads;
|
||||
char *want_libltdl;
|
||||
char *mpirun_prefix_by_default;
|
||||
char *sparse_groups;
|
||||
char *have_mpi_io;
|
||||
char *wtime_support;
|
||||
char *symbol_visibility;
|
||||
char *ft_support;
|
||||
/* Do a little preprocessor trickery here to figure ompi_info_out the
|
||||
* tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or
|
||||
* ompi_mpi_param_check). The preprocessor will only allow
|
||||
* comparisons against constants, so you'll get a warning if you
|
||||
* check MPI_PARAM_CHECK against 0 or 1, but its real value is the
|
||||
* char *ompi_mpi_param_check. So define ompi_mpi_param_check to
|
||||
* be a constant, and then all the preprocessor comparisons work ompi_info_out
|
||||
* ok. Note that we chose the preprocessor comparison rompi_info_oute because
|
||||
* it is not sufficient to simply set the variable
|
||||
* ompi_mpi_param_check to a non-0/non-1 value. This is because the
|
||||
* compiler will generate a warning that that C variable is unused
|
||||
* when MPI_PARAM_CHECK is hard-coded to 0 or 1.
|
||||
*/
|
||||
char *paramcheck;
|
||||
#define ompi_mpi_param_check 999
|
||||
#if 0 == MPI_PARAM_CHECK
|
||||
paramcheck = "never";
|
||||
#elif 1 == MPI_PARAM_CHECK
|
||||
paramcheck = "always";
|
||||
#else
|
||||
paramcheck = "runtime";
|
||||
#endif
|
||||
|
||||
/* setup the strings that don't require allocations*/
|
||||
cxx = OMPI_WANT_CXX_BINDINGS ? "yes" : "no";
|
||||
f90 = OMPI_WANT_F90_BINDINGS ? "yes" : "no";
|
||||
f90_size = OMPI_F90_BUILD_SIZE;
|
||||
heterogeneous = OPAL_ENABLE_HETEROGENEOUS_SUPPORT ? "yes" : "no";
|
||||
memprofile = OPAL_ENABLE_MEM_PROFILE ? "yes" : "no";
|
||||
memdebug = OPAL_ENABLE_MEM_DEBUG ? "yes" : "no";
|
||||
debug = OPAL_ENABLE_DEBUG ? "yes" : "no";
|
||||
mpi_interface_warning = OMPI_WANT_MPI_INTERFACE_WARNING ? "yes" : "no";
|
||||
cprofiling = OMPI_ENABLE_MPI_PROFILING ? "yes" : "no";
|
||||
cxxprofiling = OMPI_ENABLE_MPI_PROFILING ? "yes" : "no";
|
||||
cxxexceptions = OMPI_HAVE_CXX_EXCEPTION_SUPPORT ? "yes" : "no";
|
||||
f77profiling = (OMPI_ENABLE_MPI_PROFILING && OMPI_WANT_F77_BINDINGS) ? "yes" : "no";
|
||||
f90profiling = (OMPI_ENABLE_MPI_PROFILING && OMPI_WANT_F90_BINDINGS) ? "yes" : "no";
|
||||
want_libltdl = OPAL_WANT_LIBLTDL ? "yes" : "no";
|
||||
mpirun_prefix_by_default = ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT ? "yes" : "no";
|
||||
sparse_groups = OMPI_GROUP_SPARSE ? "yes" : "no";
|
||||
have_mpi_io = OMPI_PROVIDE_MPI_FILE_INTERFACE ? "yes" : "no";
|
||||
wtime_support = OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday";
|
||||
symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no";
|
||||
|
||||
/* setup strings that require allocation */
|
||||
if (OMPI_WANT_F77_BINDINGS) {
|
||||
asprintf(&f77, "yes (%s)",
|
||||
(OPAL_HAVE_WEAK_SYMBOLS ? "all" :
|
||||
(OMPI_F77_CAPS ? "caps" :
|
||||
(OMPI_F77_PLAIN ? "lower case" :
|
||||
(OMPI_F77_SINGLE_UNDERSCORE ? "single underscore" : "double underscore")))));
|
||||
} else {
|
||||
f77 = strdup("no");
|
||||
}
|
||||
|
||||
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) {
|
||||
asprintf(&threads, "%s (mpi: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
|
||||
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"),
|
||||
OPAL_ENABLE_MPI_THREADS ? "yes" : "no",
|
||||
OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no");
|
||||
} else {
|
||||
threads = strdup("no");
|
||||
}
|
||||
|
||||
asprintf(&ft_support, "%s (checkpoint thread: %s)",
|
||||
OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no");;
|
||||
|
||||
/* output values */
|
||||
ompi_info_out("Configured by", "config:user", OMPI_CONFIGURE_USER);
|
||||
ompi_info_out("Configured on", "config:timestamp", OMPI_CONFIGURE_DATE);
|
||||
ompi_info_out("Configure host", "config:host", OMPI_CONFIGURE_HOST);
|
||||
|
||||
ompi_info_out("Built by", "build:user", OMPI_BUILD_USER);
|
||||
ompi_info_out("Built on", "build:timestamp", OMPI_BUILD_DATE);
|
||||
ompi_info_out("Built host", "build:host", OMPI_BUILD_HOST);
|
||||
|
||||
ompi_info_out("C bindings", "bindings:c", "yes");
|
||||
ompi_info_out("C++ bindings", "bindings:cxx", cxx);
|
||||
ompi_info_out("Fortran77 bindings", "bindings:f77", f77);
|
||||
free(f77);
|
||||
ompi_info_out("Fortran90 bindings", "bindings:f90", f90);
|
||||
ompi_info_out("Fortran90 bindings size", "bindings:f90:size",
|
||||
OMPI_WANT_F90_BINDINGS ? f90_size : "na");
|
||||
|
||||
ompi_info_out("C compiler", "compiler:c:command", OPAL_CC);
|
||||
ompi_info_out("C compiler absolute", "compiler:c:absolute", OPAL_CC_ABSOLUTE);
|
||||
ompi_info_out("C compiler family name", "compiler:c:familyname", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
|
||||
ompi_info_out("C compiler version", "compiler:c:version", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
|
||||
|
||||
if (want_all) {
|
||||
ompi_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char));
|
||||
ompi_info_out_int("C bool size", "compiler:c:sizeof:bool", sizeof(bool));
|
||||
ompi_info_out_int("C short size", "compiler:c:sizeof:short", sizeof(short));
|
||||
ompi_info_out_int("C int size", "compiler:c:sizeof:int", sizeof(int));
|
||||
ompi_info_out_int("C long size", "compiler:c:sizeof:long", sizeof(long));
|
||||
ompi_info_out_int("C float size", "compiler:c:sizeof:float", sizeof(float));
|
||||
ompi_info_out_int("C double size", "compiler:c:sizeof:double", sizeof(double));
|
||||
ompi_info_out_int("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *));
|
||||
ompi_info_out_int("C char align", "compiler:c:align:char", OPAL_ALIGNMENT_CHAR);
|
||||
ompi_info_out_int("C bool align", "compiler:c:align:bool", OMPI_ALIGNMENT_CXX_BOOL);
|
||||
ompi_info_out_int("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT);
|
||||
ompi_info_out_int("C float align", "compiler:c:align:float", OMPI_ALIGNMENT_FLOAT);
|
||||
ompi_info_out_int("C double align", "compiler:c:align:double", OMPI_ALIGNMENT_DOUBLE);
|
||||
}
|
||||
|
||||
ompi_info_out("C++ compiler", "compiler:cxx:command", OMPI_CXX);
|
||||
ompi_info_out("C++ compiler absolute", "compiler:cxx:absolute", OMPI_CXX_ABSOLUTE);
|
||||
|
||||
ompi_info_out("Fortran77 compiler", "compiler:f77:command", OMPI_F77);
|
||||
ompi_info_out("Fortran77 compiler abs", "compiler:f77:absolute",
|
||||
OMPI_F77_ABSOLUTE);
|
||||
ompi_info_out("Fortran90 compiler", "compiler:f90:command", OMPI_F90);
|
||||
ompi_info_out("Fortran90 compiler abs", "compiler:f90:absolute",
|
||||
OMPI_F90_ABSOLUTE);
|
||||
|
||||
if (want_all) {
|
||||
|
||||
/* Will always have the size of Fortran integer */
|
||||
|
||||
ompi_info_out_int("Fort integer size", "compiler:fortran:sizeof:integer",
|
||||
OMPI_SIZEOF_FORTRAN_INTEGER);
|
||||
|
||||
ompi_info_out_int("Fort logical size", "compiler:fortran:sizeof:logical",
|
||||
OMPI_SIZEOF_FORTRAN_LOGICAL);
|
||||
ompi_info_out_int("Fort logical value true", "compiler:fortran:value:true",
|
||||
OMPI_FORTRAN_VALUE_TRUE);
|
||||
|
||||
|
||||
/* May or may not have the other Fortran sizes */
|
||||
|
||||
if (OMPI_WANT_F77_BINDINGS || OMPI_WANT_F90_BINDINGS) {
|
||||
ompi_info_out("Fort have integer1", "compiler:fortran:have:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? "yes" : "no");
|
||||
ompi_info_out("Fort have integer2", "compiler:fortran:have:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? "yes" : "no");
|
||||
ompi_info_out("Fort have integer4", "compiler:fortran:have:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? "yes" : "no");
|
||||
ompi_info_out("Fort have integer8", "compiler:fortran:have:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? "yes" : "no");
|
||||
ompi_info_out("Fort have integer16", "compiler:fortran:have:integer16",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? "yes" : "no");
|
||||
|
||||
ompi_info_out("Fort have real4", "compiler:fortran:have:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? "yes" : "no");
|
||||
ompi_info_out("Fort have real8", "compiler:fortran:have:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? "yes" : "no");
|
||||
ompi_info_out("Fort have real16", "compiler:fortran:have:real16",
|
||||
OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
ompi_info_out("Fort have complex8", "compiler:fortran:have:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? "yes" : "no");
|
||||
ompi_info_out("Fort have complex16", "compiler:fortran:have:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? "yes" : "no");
|
||||
ompi_info_out("Fort have complex32", "compiler:fortran:have:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
ompi_info_out_int("Fort integer1 size", "compiler:fortran:sizeof:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? OMPI_SIZEOF_FORTRAN_INTEGER1 : -1);
|
||||
ompi_info_out_int("Fort integer2 size", "compiler:fortran:sizeof:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? OMPI_SIZEOF_FORTRAN_INTEGER2 : -1);
|
||||
ompi_info_out_int("Fort integer4 size", "compiler:fortran:sizeof:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? OMPI_SIZEOF_FORTRAN_INTEGER4 : -1);
|
||||
ompi_info_out_int("Fort integer8 size", "compiler:fortran:sizeof:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? OMPI_SIZEOF_FORTRAN_INTEGER8 : -1);
|
||||
ompi_info_out_int("Fort integer16 size", "compiler:fortran:sizeof:integer17",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? OMPI_SIZEOF_FORTRAN_INTEGER16 : -1);
|
||||
|
||||
ompi_info_out_int("Fort real size", "compiler:fortran:sizeof:real",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort real4 size", "compiler:fortran:sizeof:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? OMPI_SIZEOF_FORTRAN_REAL4 : -1);
|
||||
ompi_info_out_int("Fort real8 size", "compiler:fortran:sizeof:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? OMPI_SIZEOF_FORTRAN_REAL8 : -1);
|
||||
ompi_info_out_int("Fort real16 size", "compiler:fortran:sizeof:real17",
|
||||
OMPI_HAVE_FORTRAN_REAL16 ? OMPI_SIZEOF_FORTRAN_REAL16 : -1);
|
||||
|
||||
ompi_info_out_int("Fort dbl prec size",
|
||||
"compiler:fortran:sizeof:double_precision",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
|
||||
ompi_info_out_int("Fort cplx size", "compiler:fortran:sizeof:complex",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort dbl cplx size",
|
||||
"compiler:fortran:sizeof:double_complex",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort cplx8 size", "compiler:fortran:sizeof:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? OMPI_SIZEOF_FORTRAN_COMPLEX8 : -1);
|
||||
ompi_info_out_int("Fort cplx16 size", "compiler:fortran:sizeof:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? OMPI_SIZEOF_FORTRAN_COMPLEX16 : -1);
|
||||
ompi_info_out_int("Fort cplx32 size", "compiler:fortran:sizeof:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 ? OMPI_SIZEOF_FORTRAN_COMPLEX32 : -1);
|
||||
|
||||
ompi_info_out_int("Fort integer align", "compiler:fortran:align:integer",
|
||||
OMPI_ALIGNMENT_FORTRAN_INTEGER);
|
||||
ompi_info_out_int("Fort integer1 align", "compiler:fortran:align:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? OMPI_ALIGNMENT_FORTRAN_INTEGER1 : -1);
|
||||
ompi_info_out_int("Fort integer2 align", "compiler:fortran:align:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? OMPI_ALIGNMENT_FORTRAN_INTEGER2 : -1);
|
||||
ompi_info_out_int("Fort integer4 align", "compiler:fortran:align:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? OMPI_ALIGNMENT_FORTRAN_INTEGER4 : -1);
|
||||
ompi_info_out_int("Fort integer8 align", "compiler:fortran:align:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? OMPI_ALIGNMENT_FORTRAN_INTEGER8 : -1);
|
||||
ompi_info_out_int("Fort integer16 align", "compiler:fortran:align:integer16",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? OMPI_ALIGNMENT_FORTRAN_INTEGER16 : -1);
|
||||
|
||||
ompi_info_out_int("Fort real align", "compiler:fortran:align:real",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort real4 align", "compiler:fortran:align:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? OMPI_ALIGNMENT_FORTRAN_REAL4 : -1);
|
||||
ompi_info_out_int("Fort real8 align", "compiler:fortran:align:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? OMPI_ALIGNMENT_FORTRAN_REAL8 : -1);
|
||||
ompi_info_out_int("Fort real16 align", "compiler:fortran:align:real16",
|
||||
OMPI_HAVE_FORTRAN_REAL16 ? OMPI_ALIGNMENT_FORTRAN_REAL16 : -1);
|
||||
|
||||
ompi_info_out_int("Fort dbl prec align",
|
||||
"compiler:fortran:align:double_precision",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
|
||||
ompi_info_out_int("Fort cplx align", "compiler:fortran:align:complex",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort dbl cplx align",
|
||||
"compiler:fortran:align:double_complex",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
ompi_info_out_int("Fort cplx8 align", "compiler:fortran:align:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX8 : -1);
|
||||
ompi_info_out_int("Fort cplx16 align", "compiler:fortran:align:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX16 : -1);
|
||||
ompi_info_out_int("Fort cplx32 align", "compiler:fortran:align:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX32 : -1);
|
||||
|
||||
} else {
|
||||
ompi_info_out("Fort real size", "compiler:fortran:sizeof:real", "skipped");
|
||||
ompi_info_out("Fort dbl prec size",
|
||||
"compiler:fortran:sizeof:double_precision", "skipped");
|
||||
ompi_info_out("Fort cplx size", "compiler:fortran:sizeof:complex", "skipped");
|
||||
ompi_info_out("Fort dbl cplx size",
|
||||
"compiler:fortran:sizeof:double_complex", "skipped");
|
||||
|
||||
ompi_info_out("Fort integer align", "compiler:fortran:align:integer", "skipped");
|
||||
ompi_info_out("Fort real align", "compiler:fortran:align:real", "skipped");
|
||||
ompi_info_out("Fort dbl prec align",
|
||||
"compiler:fortran:align:double_precision","skipped");
|
||||
ompi_info_out("Fort cplx align", "compiler:fortran:align:complex", "skipped");
|
||||
ompi_info_out("Fort dbl cplx align",
|
||||
"compiler:fortran:align:double_complex", "skipped");
|
||||
}
|
||||
}
|
||||
|
||||
ompi_info_out("C profiling", "option:profiling:c", cprofiling);
|
||||
ompi_info_out("C++ profiling", "option:profiling:cxx", cxxprofiling);
|
||||
ompi_info_out("Fortran77 profiling", "option:profiling:f77", f77profiling);
|
||||
ompi_info_out("Fortran90 profiling", "option:profiling:f90", f90profiling);
|
||||
|
||||
ompi_info_out("C++ exceptions", "option:cxx_exceptions", cxxexceptions);
|
||||
ompi_info_out("Thread support", "option:threads", threads);
|
||||
free(threads);
|
||||
ompi_info_out("Sparse Groups", "option:sparse:groups", sparse_groups);
|
||||
|
||||
if (want_all) {
|
||||
|
||||
/* Don't display the build CPPFLAGS or CXXCPPFLAGS because they're
|
||||
* just -I$(top_srcdir)/include, etc. Hence, they're a) boring,
|
||||
* and c) specific for ompi_info.
|
||||
*/
|
||||
|
||||
ompi_info_out("Build CFLAGS", "option:build:cflags", OMPI_BUILD_CFLAGS);
|
||||
ompi_info_out("Build CXXFLAGS", "option:build:cxxflags", OMPI_BUILD_CXXFLAGS);
|
||||
ompi_info_out("Build FFLAGS", "option:build:fflags", OMPI_BUILD_FFLAGS);
|
||||
ompi_info_out("Build FCFLAGS", "option:build:fcflags", OMPI_BUILD_FCFLAGS);
|
||||
ompi_info_out("Build LDFLAGS", "option:build:ldflags", OMPI_BUILD_LDFLAGS);
|
||||
ompi_info_out("Build LIBS", "option:build:libs", OMPI_BUILD_LIBS);
|
||||
|
||||
ompi_info_out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags",
|
||||
WRAPPER_EXTRA_CFLAGS);
|
||||
ompi_info_out("Wrapper extra CXXFLAGS", "option:wrapper:extra_cxxflags",
|
||||
WRAPPER_EXTRA_CXXFLAGS);
|
||||
ompi_info_out("Wrapper extra FFLAGS", "option:wrapper:extra_fflags",
|
||||
WRAPPER_EXTRA_FFLAGS);
|
||||
ompi_info_out("Wrapper extra FCFLAGS", "option:wrapper:extra_fcflags",
|
||||
WRAPPER_EXTRA_FCFLAGS);
|
||||
ompi_info_out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags",
|
||||
WRAPPER_EXTRA_LDFLAGS);
|
||||
ompi_info_out("Wrapper extra LIBS", "option:wrapper:extra_libs",
|
||||
WRAPPER_EXTRA_LIBS);
|
||||
}
|
||||
|
||||
ompi_info_out("Internal debug support", "option:debug", debug);
|
||||
ompi_info_out("MPI interface warnings", "option:mpi-interface-warning", mpi_interface_warning);
|
||||
ompi_info_out("MPI parameter check", "option:mpi-param-check", paramcheck);
|
||||
ompi_info_out("Memory profiling support", "option:mem-profile", memprofile);
|
||||
ompi_info_out("Memory debugging support", "option:mem-debug", memdebug);
|
||||
ompi_info_out("libltdl support", "option:dlopen", want_libltdl);
|
||||
ompi_info_out("Heterogeneous support", "options:heterogeneous", heterogeneous);
|
||||
ompi_info_out("mpirun default --prefix", "mpirun:prefix_by_default",
|
||||
mpirun_prefix_by_default);
|
||||
ompi_info_out("MPI I/O support", "options:mpi-io", have_mpi_io);
|
||||
ompi_info_out("MPI_WTIME support", "options:mpi-wtime", wtime_support);
|
||||
ompi_info_out("Symbol visibility support", "options:visibility", symbol_visibility);
|
||||
|
||||
ompi_info_out("MPI extensions", "options:mpi_ext", OMPI_EXT_COMPONENTS);
|
||||
|
||||
ompi_info_out("FT Checkpoint support", "options:ft_support", ft_support);
|
||||
free(ft_support);
|
||||
|
||||
ompi_info_out_int("MPI_MAX_PROCESSOR_NAME", "options:mpi-max-processor-name",
|
||||
MPI_MAX_PROCESSOR_NAME);
|
||||
ompi_info_out_int("MPI_MAX_ERROR_STRING", "options:mpi-max-error-string",
|
||||
MPI_MAX_ERROR_STRING);
|
||||
ompi_info_out_int("MPI_MAX_OBJECT_NAME", "options:mpi-max-object-name",
|
||||
MPI_MAX_OBJECT_NAME);
|
||||
ompi_info_out_int("MPI_MAX_INFO_KEY", "options:mpi-max-info-key",
|
||||
MPI_MAX_INFO_KEY);
|
||||
ompi_info_out_int("MPI_MAX_INFO_VAL", "options:mpi-max-info-val",
|
||||
MPI_MAX_INFO_VAL);
|
||||
ompi_info_out_int("MPI_MAX_PORT_NAME", "options:mpi-max-port-name",
|
||||
MPI_MAX_PORT_NAME);
|
||||
ompi_info_out_int("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string",
|
||||
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
||||
MPI_MAX_DATAREP_STRING
|
||||
#else
|
||||
"IO interface not provided"
|
||||
#endif
|
||||
);
|
||||
|
||||
}
|
@ -1,809 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
// Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include MCA_timer_IMPLEMENTATION_HEADER
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "opal/util/printf.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "opal/memoryhooks/memory.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
#include "ompi/include/mpi_portable_platform.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ompi_info;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
const string ompi_info::component_all = "all";
|
||||
const string ompi_info::param_all = "all";
|
||||
|
||||
const string ompi_info::path_prefix = "prefix";
|
||||
const string ompi_info::path_bindir = "bindir";
|
||||
const string ompi_info::path_libdir = "libdir";
|
||||
const string ompi_info::path_incdir = "incdir";
|
||||
const string ompi_info::path_mandir = "mandir";
|
||||
const string ompi_info::path_pkglibdir = "pkglibdir";
|
||||
const string ompi_info::path_sysconfdir = "sysconfdir";
|
||||
const string ompi_info::path_exec_prefix = "exec_prefix";
|
||||
const string ompi_info::path_sbindir = "sbindir";
|
||||
const string ompi_info::path_libexecdir = "libexecdir";
|
||||
const string ompi_info::path_datarootdir = "datarootdir";
|
||||
const string ompi_info::path_datadir = "datadir";
|
||||
const string ompi_info::path_sharedstatedir = "sharedstatedir";
|
||||
const string ompi_info::path_localstatedir = "localstatedir";
|
||||
const string ompi_info::path_infodir = "infodir";
|
||||
const string ompi_info::path_pkgdatadir = "pkgdatadir";
|
||||
const string ompi_info::path_pkgincludedir = "pkgincludedir";
|
||||
|
||||
//
|
||||
// External variables
|
||||
//
|
||||
// This exists in mca/base/mca_base_param.c. It's not extern'ed
|
||||
// in mca_base_param.h so that no one else will use it.
|
||||
//
|
||||
|
||||
extern opal_value_array_t mca_base_params;
|
||||
|
||||
|
||||
void ompi_info::do_params(bool want_all, bool want_internal)
|
||||
{
|
||||
unsigned int count;
|
||||
string type, component;
|
||||
bool found;
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
opal_list_t *info;
|
||||
|
||||
ompi_info::open_components();
|
||||
|
||||
// See if the special param "all" was givin to --param; that
|
||||
// superceeds any individual type
|
||||
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "param");
|
||||
for (i = 0; i < count; ++i) {
|
||||
type = opal_cmd_line_get_param(cmd_line, "param", (int)i, 0);
|
||||
if (type_all == type) {
|
||||
want_all = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get a dump of all the MCA params
|
||||
mca_base_param_dump(&info, want_internal);
|
||||
|
||||
// Show the params
|
||||
|
||||
if (want_all) {
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
show_mca_params(info, mca_types[i], component_all, want_internal);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < count; ++i) {
|
||||
type = opal_cmd_line_get_param(cmd_line, "param", (int)i, 0);
|
||||
component = opal_cmd_line_get_param(cmd_line, "param", (int)i, 1);
|
||||
|
||||
for (found = false, i = 0; i < mca_types.size(); ++i) {
|
||||
if (mca_types[i] == type) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
char *usage = opal_cmd_line_get_usage_msg(cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
show_mca_params(info, type, component, want_internal);
|
||||
}
|
||||
}
|
||||
|
||||
// Release all the MCA param memory
|
||||
mca_base_param_dump_release(info);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::show_mca_params(opal_list_t *info,
|
||||
const string& type, const string& component,
|
||||
bool want_internal)
|
||||
{
|
||||
opal_list_item_t *i;
|
||||
mca_base_param_info_t *p;
|
||||
char *value_string, empty[] = "\0";
|
||||
string message, content, tmp;
|
||||
int value_int, j;
|
||||
mca_base_param_source_t source;
|
||||
char *src_file;
|
||||
|
||||
for (i = opal_list_get_first(info); i != opal_list_get_last(info);
|
||||
i = opal_list_get_next(i)) {
|
||||
p = (mca_base_param_info_t*) i;
|
||||
|
||||
if (NULL != p->mbpp_type_name && type == p->mbpp_type_name) {
|
||||
if (component == component_all ||
|
||||
NULL == p->mbpp_component_name ||
|
||||
(NULL != p->mbpp_component_name &&
|
||||
component == p->mbpp_component_name)) {
|
||||
|
||||
// Find the source of the value
|
||||
if (OPAL_SUCCESS !=
|
||||
mca_base_param_lookup_source(p->mbpp_index, &source, &src_file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make a string for the default value. Invoke a
|
||||
// lookup because it may transform the string ("~/" ->
|
||||
// "<home dir>/") or get the value from the
|
||||
// environment, a file, etc.
|
||||
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
|
||||
mca_base_param_lookup_string(p->mbpp_index,
|
||||
&value_string);
|
||||
|
||||
// Can't let the string be NULL because we
|
||||
// assign it to a std::string, below
|
||||
|
||||
if (NULL == value_string) {
|
||||
value_string = empty;
|
||||
}
|
||||
} else {
|
||||
mca_base_param_lookup_int(p->mbpp_index, &value_int);
|
||||
asprintf(&value_string, "%d", value_int);
|
||||
}
|
||||
content = value_string;
|
||||
|
||||
// Build up the strings to output.
|
||||
|
||||
if (pretty) {
|
||||
message = "MCA ";
|
||||
message += p->mbpp_type_name;
|
||||
|
||||
// Put in the real, full name (which may be
|
||||
// different than the categorization).
|
||||
|
||||
content = p->mbpp_read_only ?
|
||||
"information \"" : "parameter \"";
|
||||
content += p->mbpp_full_name;
|
||||
content += "\" (";
|
||||
content += p->mbpp_read_only ?
|
||||
"value: " : "current value: ";
|
||||
|
||||
if (strlen(value_string) == 0) {
|
||||
content += "<none>";
|
||||
} else {
|
||||
content += "\"";
|
||||
content += value_string;
|
||||
content += "\"";
|
||||
}
|
||||
|
||||
// Indicate where the param was set from
|
||||
content += ", data source: ";
|
||||
switch(source) {
|
||||
case MCA_BASE_PARAM_SOURCE_DEFAULT:
|
||||
content += "default value";
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_ENV:
|
||||
content += "environment or cmdline";
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_FILE:
|
||||
content += "file [";
|
||||
content += src_file;
|
||||
content += "]";
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_OVERRIDE:
|
||||
content += "API override";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Is this parameter deprecated?
|
||||
if (p->mbpp_deprecated) {
|
||||
content += ", deprecated";
|
||||
}
|
||||
|
||||
// Does this parameter have any synonyms?
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
content += ", synonyms: ";
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
if (j > 0) {
|
||||
content += ", ";
|
||||
}
|
||||
content += p->mbpp_synonyms[j]->mbpp_full_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Is this parameter a synonym of something else?
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
content += ", synonym of: ";
|
||||
content += p->mbpp_synonym_parent->mbpp_full_name;
|
||||
}
|
||||
content += ")";
|
||||
out(message, message, content);
|
||||
|
||||
// If we have a help message, output it
|
||||
if (NULL != p->mbpp_help_msg) {
|
||||
out("", "", p->mbpp_help_msg);
|
||||
}
|
||||
} else {
|
||||
tmp = "mca:";
|
||||
tmp += p->mbpp_type_name;
|
||||
tmp += ":";
|
||||
|
||||
if (p->mbpp_component_name != NULL) {
|
||||
tmp += p->mbpp_component_name;
|
||||
} else {
|
||||
tmp += "base";
|
||||
}
|
||||
tmp += ":param:";
|
||||
|
||||
// Put in the real, full name (which may be
|
||||
// different than the categorization).
|
||||
|
||||
tmp += p->mbpp_full_name;
|
||||
tmp += ":";
|
||||
|
||||
// Output the value
|
||||
|
||||
message = tmp;
|
||||
message += "value";
|
||||
content = value_string;
|
||||
out(message, message, content);
|
||||
|
||||
// Indicate where the param was set from
|
||||
|
||||
message = tmp;
|
||||
message += "data_source";
|
||||
switch(source) {
|
||||
case MCA_BASE_PARAM_SOURCE_DEFAULT:
|
||||
content = "default value";
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_ENV:
|
||||
content = "environment-cmdline";
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_FILE:
|
||||
content = "file:";
|
||||
content += src_file;
|
||||
break;
|
||||
case MCA_BASE_PARAM_SOURCE_OVERRIDE:
|
||||
content = "API override";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
out(message, message, content);
|
||||
|
||||
// Output whether it's read only or writable
|
||||
|
||||
message = tmp;
|
||||
message += "status";
|
||||
content = p->mbpp_read_only ? "read-only" : "writable";
|
||||
out(message, message, content);
|
||||
|
||||
// If it has a help message, output that
|
||||
|
||||
if (NULL != p->mbpp_help_msg) {
|
||||
message = tmp;
|
||||
message += "help";
|
||||
content = p->mbpp_help_msg;
|
||||
out(message, message, content);
|
||||
}
|
||||
|
||||
// Is this parameter deprecated?
|
||||
message = tmp;
|
||||
message += "deprecated";
|
||||
content = p->mbpp_deprecated ? "yes" : "no";
|
||||
out(message, message, content);
|
||||
|
||||
// Does this parameter have any synonyms?
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
message = tmp;
|
||||
message += "synonym:name";
|
||||
content = p->mbpp_synonyms[j]->mbpp_full_name;
|
||||
out(message, message, content);
|
||||
}
|
||||
}
|
||||
|
||||
// Is this parameter a synonym of something else?
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
message = tmp;
|
||||
message += "synonym_of:name";
|
||||
content = p->mbpp_synonym_parent->mbpp_full_name;
|
||||
out(message, message, content);
|
||||
}
|
||||
}
|
||||
|
||||
// If we allocated the string, then free it
|
||||
|
||||
if (value_string != empty) {
|
||||
free(value_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::do_path(bool want_all, opal_cmd_line_t *cmd_line)
|
||||
{
|
||||
int i, count;
|
||||
string scope;
|
||||
|
||||
// Check bozo case
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "path");
|
||||
for (i = 0; i < count; ++i) {
|
||||
scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
|
||||
if ("all" == scope) {
|
||||
want_all = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (want_all) {
|
||||
show_path(path_prefix, opal_install_dirs.prefix);
|
||||
show_path(path_exec_prefix, opal_install_dirs.exec_prefix);
|
||||
show_path(path_bindir, opal_install_dirs.bindir);
|
||||
show_path(path_sbindir, opal_install_dirs.sbindir);
|
||||
show_path(path_libdir, opal_install_dirs.libdir);
|
||||
show_path(path_incdir, opal_install_dirs.includedir);
|
||||
show_path(path_mandir, opal_install_dirs.mandir);
|
||||
show_path(path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
show_path(path_libexecdir, opal_install_dirs.libexecdir);
|
||||
show_path(path_datarootdir, opal_install_dirs.datarootdir);
|
||||
show_path(path_datadir, opal_install_dirs.datadir);
|
||||
show_path(path_sysconfdir, opal_install_dirs.sysconfdir);
|
||||
show_path(path_sharedstatedir, opal_install_dirs.sharedstatedir);
|
||||
show_path(path_localstatedir, opal_install_dirs.localstatedir);
|
||||
show_path(path_infodir, opal_install_dirs.infodir);
|
||||
show_path(path_pkgdatadir, opal_install_dirs.pkgdatadir);
|
||||
show_path(path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
show_path(path_pkgincludedir, opal_install_dirs.pkgincludedir);
|
||||
} else {
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "path");
|
||||
for (i = 0; i < count; ++i) {
|
||||
scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
|
||||
|
||||
if (path_prefix == scope) {
|
||||
show_path(path_prefix, opal_install_dirs.prefix);
|
||||
} else if (path_bindir == scope) {
|
||||
show_path(path_bindir, opal_install_dirs.bindir);
|
||||
} else if (path_libdir == scope) {
|
||||
show_path(path_libdir, opal_install_dirs.libdir);
|
||||
} else if (path_incdir == scope) {
|
||||
show_path(path_incdir, opal_install_dirs.includedir);
|
||||
} else if (path_mandir == scope) {
|
||||
show_path(path_mandir, opal_install_dirs.mandir);
|
||||
} else if (path_pkglibdir == scope) {
|
||||
show_path(path_pkglibdir, opal_install_dirs.pkglibdir);
|
||||
} else if (path_sysconfdir == scope) {
|
||||
show_path(path_sysconfdir, opal_install_dirs.sysconfdir);
|
||||
} else if (path_exec_prefix == scope) {
|
||||
show_path(path_exec_prefix, opal_install_dirs.exec_prefix);
|
||||
} else if (path_sbindir == scope) {
|
||||
show_path(path_sbindir, opal_install_dirs.sbindir);
|
||||
} else if (path_libexecdir == scope) {
|
||||
show_path(path_libexecdir, opal_install_dirs.libexecdir);
|
||||
} else if (path_datarootdir == scope) {
|
||||
show_path(path_datarootdir, opal_install_dirs.datarootdir);
|
||||
} else if (path_datadir == scope) {
|
||||
show_path(path_datadir, opal_install_dirs.datadir);
|
||||
} else if (path_sharedstatedir == scope) {
|
||||
show_path(path_sharedstatedir, opal_install_dirs.sharedstatedir);
|
||||
} else if (path_localstatedir == scope) {
|
||||
show_path(path_localstatedir, opal_install_dirs.localstatedir);
|
||||
} else if (path_infodir == scope) {
|
||||
show_path(path_infodir, opal_install_dirs.infodir);
|
||||
} else if (path_pkgdatadir == scope) {
|
||||
show_path(path_pkgdatadir, opal_install_dirs.pkgdatadir);
|
||||
} else if (path_pkgincludedir == scope) {
|
||||
show_path(path_pkgincludedir, opal_install_dirs.pkgincludedir);
|
||||
} else {
|
||||
char *usage = opal_cmd_line_get_usage_msg(cmd_line);
|
||||
orte_show_help("help-ompi_info.txt", "usage", true, usage);
|
||||
free(usage);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::show_path(const string& type, const string& value)
|
||||
{
|
||||
string pretty(type);
|
||||
pretty[0] &= toupper(pretty[0]);
|
||||
|
||||
out(pretty, "path:" + type, value);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::do_arch()
|
||||
{
|
||||
out("Configured architecture", "config:arch", OPAL_ARCH);
|
||||
}
|
||||
|
||||
|
||||
void ompi_info::do_hostname()
|
||||
{
|
||||
out("Configure host", "config:host", OMPI_CONFIGURE_HOST);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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 ompi was configured. There are many options here
|
||||
// that are carried forward from OMPI-7 and are not mca parameters
|
||||
// in OMPI-10. I have to dig through the invalid options and replace
|
||||
// them with OMPI-10 options.
|
||||
//
|
||||
void ompi_info::do_config(bool want_all)
|
||||
{
|
||||
const string cxx(OMPI_WANT_CXX_BINDINGS ? "yes" : "no");
|
||||
const string f77(OMPI_WANT_F77_BINDINGS ? string("yes (") +
|
||||
(OPAL_HAVE_WEAK_SYMBOLS ? "all" :
|
||||
(OMPI_F77_CAPS ? "caps" :
|
||||
(OMPI_F77_PLAIN ? "lower case" :
|
||||
(OMPI_F77_SINGLE_UNDERSCORE ? "single underscore" :
|
||||
"double underscore")))) + string(")"): "no");
|
||||
const string f90(OMPI_WANT_F90_BINDINGS ? "yes" : "no");
|
||||
const string f90_size(OMPI_F90_BUILD_SIZE);
|
||||
const string heterogeneous(OPAL_ENABLE_HETEROGENEOUS_SUPPORT ? "yes" : "no");
|
||||
const string memprofile(OPAL_ENABLE_MEM_PROFILE ? "yes" : "no");
|
||||
const string memdebug(OPAL_ENABLE_MEM_DEBUG ? "yes" : "no");
|
||||
const string debug(OPAL_ENABLE_DEBUG ? "yes" : "no");
|
||||
const string mpi_interface_warning(OMPI_WANT_MPI_INTERFACE_WARNING ? "yes" : "no");
|
||||
const string cprofiling(OMPI_ENABLE_MPI_PROFILING ? "yes" : "no");
|
||||
const string cxxprofiling(OMPI_ENABLE_MPI_PROFILING ? "yes" : "no");
|
||||
const string f77profiling((OMPI_ENABLE_MPI_PROFILING &&
|
||||
OMPI_WANT_F77_BINDINGS) ? "yes" : "no");
|
||||
const string f90profiling((OMPI_ENABLE_MPI_PROFILING && OMPI_WANT_F90_BINDINGS) ?
|
||||
"yes" : "no");
|
||||
const string cxxexceptions(OMPI_HAVE_CXX_EXCEPTION_SUPPORT ? "yes" : "no");
|
||||
// Do a little preprocessor trickery here to figure out the
|
||||
// tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or
|
||||
// ompi_mpi_param_check). The preprocessor will only allow
|
||||
// comparisons against constants, so you'll get a warning if you
|
||||
// check MPI_PARAM_CHECK against 0 or 1, but its real value is the
|
||||
// string ompi_mpi_param_check. So define ompi_mpi_param_check to
|
||||
// be a constant, and then all the preprocessor comparisons work out
|
||||
// ok. Note that we chose the preprocessor comparison route because
|
||||
// it is not sufficient to simply set the variable
|
||||
// ompi_mpi_param_check to a non-0/non-1 value. This is because the
|
||||
// compiler will generate a warning that that C variable is unused
|
||||
// when MPI_PARAM_CHECK is hard-coded to 0 or 1.
|
||||
string paramcheck;
|
||||
#define ompi_mpi_param_check 999
|
||||
#if 0 == MPI_PARAM_CHECK
|
||||
paramcheck = "never";
|
||||
#elif 1 == MPI_PARAM_CHECK
|
||||
paramcheck = "always";
|
||||
#else
|
||||
paramcheck = "runtime";
|
||||
#endif
|
||||
string threads;
|
||||
const string want_libltdl(OPAL_WANT_LIBLTDL ? "yes" : "no");
|
||||
const string mpirun_prefix_by_default(ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT ?
|
||||
"yes" : "no");
|
||||
const string sparse_groups(OMPI_GROUP_SPARSE ? "yes" : "no");
|
||||
const string have_mpi_io(OMPI_PROVIDE_MPI_FILE_INTERFACE ? "yes" : "no");
|
||||
const string wtime_support(OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday");
|
||||
const string symbol_visibility(OPAL_C_HAVE_VISIBILITY ? "yes" : "no");
|
||||
|
||||
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) {
|
||||
threads = OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
|
||||
OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown";
|
||||
threads += " (";
|
||||
threads += "mpi: ";
|
||||
threads += OPAL_ENABLE_MPI_THREADS ? "yes" : "no";
|
||||
threads += ", progress: ";
|
||||
threads += OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no";
|
||||
threads += ")";
|
||||
} else {
|
||||
threads = "no";
|
||||
}
|
||||
|
||||
string ft_support;
|
||||
ft_support = OPAL_ENABLE_FT ? "yes" : "no";
|
||||
ft_support += " (checkpoint thread: ";
|
||||
ft_support += OPAL_ENABLE_FT_THREAD ? "yes" : "no";
|
||||
ft_support += ")";
|
||||
|
||||
out("Configured by", "config:user", OMPI_CONFIGURE_USER);
|
||||
out("Configured on", "config:timestamp", OMPI_CONFIGURE_DATE);
|
||||
out("Configure host", "config:host", OMPI_CONFIGURE_HOST);
|
||||
|
||||
out("Built by", "build:user", OMPI_BUILD_USER);
|
||||
out("Built on", "build:timestamp", OMPI_BUILD_DATE);
|
||||
out("Built host", "build:host", OMPI_BUILD_HOST);
|
||||
|
||||
out("C bindings", "bindings:c", "yes");
|
||||
out("C++ bindings", "bindings:cxx", cxx);
|
||||
out("Fortran77 bindings", "bindings:f77", f77);
|
||||
out("Fortran90 bindings", "bindings:f90", f90);
|
||||
out("Fortran90 bindings size", "bindings:f90:size",
|
||||
OMPI_WANT_F90_BINDINGS ? f90_size : "na");
|
||||
|
||||
out("C compiler", "compiler:c:command", OPAL_CC);
|
||||
out("C compiler absolute", "compiler:c:absolute", OPAL_CC_ABSOLUTE);
|
||||
out("C compiler family name", "compiler:c:familyname", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
|
||||
out("C compiler version", "compiler:c:version", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
|
||||
|
||||
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", OPAL_ALIGNMENT_CHAR);
|
||||
out("C bool align", "compiler:c:align:bool", OMPI_ALIGNMENT_CXX_BOOL);
|
||||
out("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT);
|
||||
out("C float align", "compiler:c:align:float", OMPI_ALIGNMENT_FLOAT);
|
||||
out("C double align", "compiler:c:align:double", OMPI_ALIGNMENT_DOUBLE);
|
||||
}
|
||||
|
||||
out("C++ compiler", "compiler:cxx:command", OMPI_CXX);
|
||||
out("C++ compiler absolute", "compiler:cxx:absolute", OMPI_CXX_ABSOLUTE);
|
||||
|
||||
out("Fortran77 compiler", "compiler:f77:command", OMPI_F77);
|
||||
out("Fortran77 compiler abs", "compiler:f77:absolute",
|
||||
OMPI_F77_ABSOLUTE);
|
||||
out("Fortran90 compiler", "compiler:f90:command", OMPI_F90);
|
||||
out("Fortran90 compiler abs", "compiler:f90:absolute",
|
||||
OMPI_F90_ABSOLUTE);
|
||||
|
||||
if (want_all) {
|
||||
|
||||
// Will always have the size of Fortran integer
|
||||
|
||||
out("Fort integer size", "compiler:fortran:sizeof:integer",
|
||||
OMPI_SIZEOF_FORTRAN_INTEGER);
|
||||
|
||||
out("Fort logical size", "compiler:fortran:sizeof:logical",
|
||||
OMPI_SIZEOF_FORTRAN_LOGICAL);
|
||||
out("Fort logical value true", "compiler:fortran:value:true",
|
||||
OMPI_FORTRAN_VALUE_TRUE);
|
||||
|
||||
|
||||
// May or may not have the other Fortran sizes
|
||||
|
||||
if (OMPI_WANT_F77_BINDINGS || OMPI_WANT_F90_BINDINGS) {
|
||||
out("Fort have integer1", "compiler:fortran:have:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? "yes" : "no");
|
||||
out("Fort have integer2", "compiler:fortran:have:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? "yes" : "no");
|
||||
out("Fort have integer4", "compiler:fortran:have:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? "yes" : "no");
|
||||
out("Fort have integer8", "compiler:fortran:have:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? "yes" : "no");
|
||||
out("Fort have integer16", "compiler:fortran:have:integer16",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? "yes" : "no");
|
||||
|
||||
out("Fort have real4", "compiler:fortran:have:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? "yes" : "no");
|
||||
out("Fort have real8", "compiler:fortran:have:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? "yes" : "no");
|
||||
out("Fort have real16", "compiler:fortran:have:real16",
|
||||
OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
out("Fort have complex8", "compiler:fortran:have:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? "yes" : "no");
|
||||
out("Fort have complex16", "compiler:fortran:have:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? "yes" : "no");
|
||||
out("Fort have complex32", "compiler:fortran:have:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
out("Fort integer1 size", "compiler:fortran:sizeof:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? OMPI_SIZEOF_FORTRAN_INTEGER1 : -1);
|
||||
out("Fort integer2 size", "compiler:fortran:sizeof:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? OMPI_SIZEOF_FORTRAN_INTEGER2 : -1);
|
||||
out("Fort integer4 size", "compiler:fortran:sizeof:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? OMPI_SIZEOF_FORTRAN_INTEGER4 : -1);
|
||||
out("Fort integer8 size", "compiler:fortran:sizeof:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? OMPI_SIZEOF_FORTRAN_INTEGER8 : -1);
|
||||
out("Fort integer16 size", "compiler:fortran:sizeof:integer17",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? OMPI_SIZEOF_FORTRAN_INTEGER16 : -1);
|
||||
|
||||
out("Fort real size", "compiler:fortran:sizeof:real",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
out("Fort real4 size", "compiler:fortran:sizeof:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? OMPI_SIZEOF_FORTRAN_REAL4 : -1);
|
||||
out("Fort real8 size", "compiler:fortran:sizeof:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? OMPI_SIZEOF_FORTRAN_REAL8 : -1);
|
||||
out("Fort real16 size", "compiler:fortran:sizeof:real17",
|
||||
OMPI_HAVE_FORTRAN_REAL16 ? OMPI_SIZEOF_FORTRAN_REAL16 : -1);
|
||||
|
||||
out("Fort dbl prec size",
|
||||
"compiler:fortran:sizeof:double_precision",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
|
||||
out("Fort cplx size", "compiler:fortran:sizeof:complex",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
out("Fort dbl cplx size",
|
||||
"compiler:fortran:sizeof:double_complex",
|
||||
OMPI_SIZEOF_FORTRAN_REAL);
|
||||
out("Fort cplx8 size", "compiler:fortran:sizeof:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? OMPI_SIZEOF_FORTRAN_COMPLEX8 : -1);
|
||||
out("Fort cplx16 size", "compiler:fortran:sizeof:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? OMPI_SIZEOF_FORTRAN_COMPLEX16 : -1);
|
||||
out("Fort cplx32 size", "compiler:fortran:sizeof:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 ? OMPI_SIZEOF_FORTRAN_COMPLEX32 : -1);
|
||||
|
||||
out("Fort integer align", "compiler:fortran:align:integer",
|
||||
OMPI_ALIGNMENT_FORTRAN_INTEGER);
|
||||
out("Fort integer1 align", "compiler:fortran:align:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? OMPI_ALIGNMENT_FORTRAN_INTEGER1 : -1);
|
||||
out("Fort integer2 align", "compiler:fortran:align:integer2",
|
||||
OMPI_HAVE_FORTRAN_INTEGER2 ? OMPI_ALIGNMENT_FORTRAN_INTEGER2 : -1);
|
||||
out("Fort integer4 align", "compiler:fortran:align:integer4",
|
||||
OMPI_HAVE_FORTRAN_INTEGER4 ? OMPI_ALIGNMENT_FORTRAN_INTEGER4 : -1);
|
||||
out("Fort integer8 align", "compiler:fortran:align:integer8",
|
||||
OMPI_HAVE_FORTRAN_INTEGER8 ? OMPI_ALIGNMENT_FORTRAN_INTEGER8 : -1);
|
||||
out("Fort integer16 align", "compiler:fortran:align:integer16",
|
||||
OMPI_HAVE_FORTRAN_INTEGER16 ? OMPI_ALIGNMENT_FORTRAN_INTEGER16 : -1);
|
||||
|
||||
out("Fort real align", "compiler:fortran:align:real",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
out("Fort real4 align", "compiler:fortran:align:real4",
|
||||
OMPI_HAVE_FORTRAN_REAL4 ? OMPI_ALIGNMENT_FORTRAN_REAL4 : -1);
|
||||
out("Fort real8 align", "compiler:fortran:align:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? OMPI_ALIGNMENT_FORTRAN_REAL8 : -1);
|
||||
out("Fort real16 align", "compiler:fortran:align:real16",
|
||||
OMPI_HAVE_FORTRAN_REAL16 ? OMPI_ALIGNMENT_FORTRAN_REAL16 : -1);
|
||||
|
||||
out("Fort dbl prec align",
|
||||
"compiler:fortran:align:double_precision",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
|
||||
out("Fort cplx align", "compiler:fortran:align:complex",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
out("Fort dbl cplx align",
|
||||
"compiler:fortran:align:double_complex",
|
||||
OMPI_ALIGNMENT_FORTRAN_REAL);
|
||||
out("Fort cplx8 align", "compiler:fortran:align:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX8 : -1);
|
||||
out("Fort cplx16 align", "compiler:fortran:align:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX16 : -1);
|
||||
out("Fort cplx32 align", "compiler:fortran:align:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 ? OMPI_ALIGNMENT_FORTRAN_COMPLEX32 : -1);
|
||||
|
||||
} else {
|
||||
out("Fort real size", "compiler:fortran:sizeof:real", "skipped");
|
||||
out("Fort dbl prec size",
|
||||
"compiler:fortran:sizeof:double_precision", "skipped");
|
||||
out("Fort cplx size", "compiler:fortran:sizeof:complex", "skipped");
|
||||
out("Fort dbl cplx size",
|
||||
"compiler:fortran:sizeof:double_complex", "skipped");
|
||||
|
||||
out("Fort integer align", "compiler:fortran:align:integer", "skipped");
|
||||
out("Fort real align", "compiler:fortran:align:real", "skipped");
|
||||
out("Fort dbl prec align",
|
||||
"compiler:fortran:align:double_precision","skipped");
|
||||
out("Fort cplx align", "compiler:fortran:align:complex", "skipped");
|
||||
out("Fort dbl cplx align",
|
||||
"compiler:fortran:align:double_complex", "skipped");
|
||||
}
|
||||
}
|
||||
|
||||
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("Thread support", "option:threads", threads);
|
||||
out("Sparse Groups", "option:sparse:groups", sparse_groups);
|
||||
|
||||
if (want_all) {
|
||||
|
||||
// Don't display the build CPPFLAGS or CXXCPPFLAGS because they're
|
||||
// just -I$(top_srcdir)/include, etc. Hence, they're a) boring,
|
||||
// and c) specific for ompi_info.
|
||||
|
||||
out("Build CFLAGS", "option:build:cflags", OMPI_BUILD_CFLAGS);
|
||||
out("Build CXXFLAGS", "option:build:cxxflags", OMPI_BUILD_CXXFLAGS);
|
||||
out("Build FFLAGS", "option:build:fflags", OMPI_BUILD_FFLAGS);
|
||||
out("Build FCFLAGS", "option:build:fcflags", OMPI_BUILD_FCFLAGS);
|
||||
out("Build LDFLAGS", "option:build:ldflags", OMPI_BUILD_LDFLAGS);
|
||||
out("Build LIBS", "option:build:libs", OMPI_BUILD_LIBS);
|
||||
|
||||
out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags",
|
||||
WRAPPER_EXTRA_CFLAGS);
|
||||
out("Wrapper extra CXXFLAGS", "option:wrapper:extra_cxxflags",
|
||||
WRAPPER_EXTRA_CXXFLAGS);
|
||||
out("Wrapper extra FFLAGS", "option:wrapper:extra_fflags",
|
||||
WRAPPER_EXTRA_FFLAGS);
|
||||
out("Wrapper extra FCFLAGS", "option:wrapper:extra_fcflags",
|
||||
WRAPPER_EXTRA_FCFLAGS);
|
||||
out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags",
|
||||
WRAPPER_EXTRA_LDFLAGS);
|
||||
out("Wrapper extra LIBS", "option:wrapper:extra_libs",
|
||||
WRAPPER_EXTRA_LIBS);
|
||||
}
|
||||
|
||||
out("Internal debug support", "option:debug", debug);
|
||||
out("MPI interface warnings", "option:mpi-interface-warning", mpi_interface_warning);
|
||||
out("MPI parameter check", "option:mpi-param-check", paramcheck);
|
||||
out("Memory profiling support", "option:mem-profile", memprofile);
|
||||
out("Memory debugging support", "option:mem-debug", memdebug);
|
||||
out("libltdl support", "option:dlopen", want_libltdl);
|
||||
out("Heterogeneous support", "options:heterogeneous", heterogeneous);
|
||||
out("mpirun default --prefix", "mpirun:prefix_by_default",
|
||||
mpirun_prefix_by_default);
|
||||
out("MPI I/O support", "options:mpi-io", have_mpi_io);
|
||||
out("MPI_WTIME support", "options:mpi-wtime", wtime_support);
|
||||
out("Symbol visibility support", "options:visibility", symbol_visibility);
|
||||
|
||||
out("MPI extensions", "options:mpi_ext", OMPI_EXT_COMPONENTS);
|
||||
|
||||
out("FT Checkpoint support", "options:ft_support", ft_support);
|
||||
|
||||
out("MPI_MAX_PROCESSOR_NAME", "options:mpi-max-processor-name",
|
||||
MPI_MAX_PROCESSOR_NAME);
|
||||
out("MPI_MAX_ERROR_STRING", "options:mpi-max-error-string",
|
||||
MPI_MAX_ERROR_STRING);
|
||||
out("MPI_MAX_OBJECT_NAME", "options:mpi-max-object-name",
|
||||
MPI_MAX_OBJECT_NAME);
|
||||
out("MPI_MAX_INFO_KEY", "options:mpi-max-info-key",
|
||||
MPI_MAX_INFO_KEY);
|
||||
out("MPI_MAX_INFO_VAL", "options:mpi-max-info-val",
|
||||
MPI_MAX_INFO_VAL);
|
||||
out("MPI_MAX_PORT_NAME", "options:mpi-max-port-name",
|
||||
MPI_MAX_PORT_NAME);
|
||||
out("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string",
|
||||
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
||||
MPI_MAX_DATAREP_STRING
|
||||
#else
|
||||
"IO interface not provided"
|
||||
#endif
|
||||
);
|
||||
|
||||
}
|
412
ompi/tools/ompi_info/version.c
Обычный файл
412
ompi/tools/ompi_info/version.c
Обычный файл
@ -0,0 +1,412 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opal/version.h"
|
||||
#include "orte/version.h"
|
||||
#include "ompi/version.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/util/printf.h"
|
||||
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
|
||||
/*
|
||||
* Public variables
|
||||
*/
|
||||
|
||||
const char *ompi_info_ver_full = "full";
|
||||
const char *ompi_info_ver_major = "major";
|
||||
const char *ompi_info_ver_minor = "minor";
|
||||
const char *ompi_info_ver_release = "release";
|
||||
const char *ompi_info_ver_greek = "greek";
|
||||
const char *ompi_info_ver_svn = "svn";
|
||||
|
||||
/*
|
||||
* Private variables
|
||||
*/
|
||||
|
||||
static const char *ompi_info_ver_all = "all";
|
||||
static const char *ompi_info_ver_mca = "mca";
|
||||
static const char *ompi_info_ver_type = "type";
|
||||
static const char *ompi_info_ver_component = "component";
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*/
|
||||
|
||||
static void show_mca_version(const mca_base_component_t *component,
|
||||
const char *scope, const char *ver_type);
|
||||
static char *make_version_str(const char *scope,
|
||||
int major, int minor, int release,
|
||||
const char *greek,
|
||||
bool want_svn, const char *svn);
|
||||
|
||||
/*
|
||||
* do_version
|
||||
*
|
||||
* Determines the version information related to the ompi components
|
||||
* being used.
|
||||
* Accepts:
|
||||
* - want_all: True if all components' info is required.
|
||||
* - cmd_line: The constructed command line argument
|
||||
*/
|
||||
void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line)
|
||||
{
|
||||
unsigned int count;
|
||||
size_t i;
|
||||
char *arg1, *scope, *type, *component;
|
||||
char *pos;
|
||||
int j;
|
||||
|
||||
ompi_info_open_components();
|
||||
|
||||
if (want_all) {
|
||||
ompi_info_show_ompi_version(ompi_info_ver_full);
|
||||
for (j = 0; j < mca_types.size; ++j) {
|
||||
if (NULL == (pos = (char*)opal_pointer_array_get_item(&mca_types, j))) {
|
||||
continue;
|
||||
}
|
||||
ompi_info_show_component_version(pos, ompi_info_component_all, ompi_info_ver_full, ompi_info_type_all);
|
||||
}
|
||||
} else {
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "version");
|
||||
for (i = 0; i < count; ++i) {
|
||||
arg1 = opal_cmd_line_get_param(cmd_line, "version", (int)i, 0);
|
||||
scope = opal_cmd_line_get_param(cmd_line, "version", (int)i, 1);
|
||||
|
||||
/* Version of Open MPI */
|
||||
|
||||
if (0 == strcmp(ompi_info_type_ompi, arg1)) {
|
||||
ompi_info_show_ompi_version(scope);
|
||||
}
|
||||
|
||||
/* Specific type and component */
|
||||
|
||||
else if (NULL != (pos = strchr(arg1, ':'))) {
|
||||
*pos = '\0';
|
||||
type = arg1;
|
||||
pos++;
|
||||
component = pos;
|
||||
|
||||
ompi_info_show_component_version(type, component, scope, ompi_info_ver_all);
|
||||
|
||||
}
|
||||
|
||||
/* All components of a specific type */
|
||||
|
||||
else {
|
||||
ompi_info_show_component_version(arg1, ompi_info_component_all, scope, ompi_info_ver_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show the version of Open MPI
|
||||
*/
|
||||
void ompi_info_show_ompi_version(const char *scope)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
ompi_info_out("Package", "package", OPAL_PACKAGE_STRING);
|
||||
asprintf(&tmp, "%s:version:full", ompi_info_type_ompi);
|
||||
ompi_info_out("Open MPI", tmp,
|
||||
make_version_str(scope,
|
||||
OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION,
|
||||
OMPI_GREEK_VERSION,
|
||||
OMPI_WANT_SVN, OMPI_SVN_R));
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:svn", ompi_info_type_ompi);
|
||||
ompi_info_out("Open MPI SVN revision", tmp, OMPI_SVN_R);
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi);
|
||||
ompi_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%s:version:full", ompi_info_type_orte);
|
||||
ompi_info_out("Open RTE", tmp,
|
||||
make_version_str(scope,
|
||||
ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION,
|
||||
ORTE_GREEK_VERSION,
|
||||
ORTE_WANT_SVN, ORTE_SVN_R));
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:svn", ompi_info_type_orte);
|
||||
ompi_info_out("Open RTE SVN revision", tmp, ORTE_SVN_R);
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:release_date", ompi_info_type_orte);
|
||||
ompi_info_out("Open RTE release date", tmp, ORTE_RELEASE_DATE);
|
||||
free(tmp);
|
||||
|
||||
asprintf(&tmp, "%s:version:full", ompi_info_type_opal);
|
||||
ompi_info_out("OPAL", tmp,
|
||||
make_version_str(scope,
|
||||
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
OPAL_GREEK_VERSION,
|
||||
OPAL_WANT_SVN, OPAL_SVN_R));
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:svn", ompi_info_type_opal);
|
||||
ompi_info_out("OPAL SVN revision", tmp, OPAL_SVN_R);
|
||||
free(tmp);
|
||||
asprintf(&tmp, "%s:version:release_date", ompi_info_type_opal);
|
||||
ompi_info_out("OPAL release date", tmp, OPAL_RELEASE_DATE);
|
||||
free(tmp);
|
||||
|
||||
ompi_info_out("Ident string", "ident", OPAL_IDENT_STRING);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show all the components of a specific type/component combo (component may be
|
||||
* a wildcard)
|
||||
*/
|
||||
void ompi_info_show_component_version(const char *type_name,
|
||||
const char *component_name,
|
||||
const char *scope, const char *ver_type)
|
||||
{
|
||||
bool want_all_components = false;
|
||||
bool found;
|
||||
opal_list_item_t *item;
|
||||
mca_base_component_list_item_t *cli;
|
||||
const mca_base_component_t *component;
|
||||
opal_list_t *components;
|
||||
int j;
|
||||
char *pos;
|
||||
ompi_info_component_map_t *map;
|
||||
|
||||
/* see if all components wanted */
|
||||
if (0 == strcmp(ompi_info_type_all, component_name)) {
|
||||
want_all_components = true;
|
||||
}
|
||||
|
||||
/* Check to see if the type is valid */
|
||||
|
||||
for (found = false, j = 0; j < mca_types.size; ++j) {
|
||||
if (NULL == (pos = (char*)opal_pointer_array_get_item(&mca_types, j))) {
|
||||
continue;
|
||||
}
|
||||
if (0 == strcmp(pos, type_name)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Now that we have a valid type, find the right component list */
|
||||
components = NULL;
|
||||
for (j=0; j < component_map.size; j++) {
|
||||
if (NULL == (map = (ompi_info_component_map_t*)opal_pointer_array_get_item(&component_map, j))) {
|
||||
continue;
|
||||
}
|
||||
if (0 == strcmp(type_name, map->type)) {
|
||||
/* found it! */
|
||||
components = map->components;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != components) {
|
||||
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 ||
|
||||
0 == strcmp(component->mca_component_name, component_name)) {
|
||||
show_mca_version(component, scope, ver_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Given a component, display its relevant version(s)
|
||||
*/
|
||||
static void show_mca_version(const mca_base_component_t* component,
|
||||
const char *scope, const char *ver_type)
|
||||
{
|
||||
bool printed;
|
||||
bool want_mca = false;
|
||||
bool want_type = false;
|
||||
bool want_component = false;
|
||||
char *message, *content;
|
||||
char *mca_version;
|
||||
char *api_version;
|
||||
char *component_version;
|
||||
char *tmp;
|
||||
|
||||
if (0 == strcmp(ver_type, ompi_info_ver_all) ||
|
||||
0 == strcmp(ver_type, ompi_info_ver_mca)) {
|
||||
want_mca = true;
|
||||
}
|
||||
|
||||
if (0 == strcmp(ver_type, ompi_info_ver_all) ||
|
||||
0 == strcmp(ver_type, ompi_info_ver_type)) {
|
||||
want_type = true;
|
||||
}
|
||||
|
||||
if (0 == strcmp(ver_type, ompi_info_ver_all) ||
|
||||
0 == strcmp(ver_type, ompi_info_ver_component)) {
|
||||
want_component = true;
|
||||
}
|
||||
|
||||
mca_version = make_version_str(scope, component->mca_major_version,
|
||||
component->mca_minor_version,
|
||||
component->mca_release_version, "",
|
||||
false, "");
|
||||
api_version = make_version_str(scope, component->mca_type_major_version,
|
||||
component->mca_type_minor_version,
|
||||
component->mca_type_release_version, "",
|
||||
false, "");
|
||||
component_version = make_version_str(scope, component->mca_component_major_version,
|
||||
component->mca_component_minor_version,
|
||||
component->mca_component_release_version,
|
||||
"", false, "");
|
||||
|
||||
if (ompi_info_pretty) {
|
||||
asprintf(&message, "MCA %s", component->mca_type_name);
|
||||
printed = false;
|
||||
asprintf(&content, "%s (", component->mca_component_name);
|
||||
|
||||
if (want_mca) {
|
||||
asprintf(&tmp, "%sMCA v%s", content, mca_version);
|
||||
free(content);
|
||||
content = tmp;
|
||||
printed = true;
|
||||
}
|
||||
|
||||
if (want_type) {
|
||||
if (printed) {
|
||||
asprintf(&tmp, "%s, ", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
}
|
||||
asprintf(&tmp, "%sAPI v%s", content, api_version);
|
||||
free(content);
|
||||
content = tmp;
|
||||
printed = true;
|
||||
}
|
||||
|
||||
if (want_component) {
|
||||
if (printed) {
|
||||
asprintf(&tmp, "%s, ", content);
|
||||
free(content);
|
||||
content = tmp;
|
||||
}
|
||||
asprintf(&tmp, "%sComponent v%s", content, component_version);
|
||||
free(content);
|
||||
content = tmp;
|
||||
printed = true;
|
||||
}
|
||||
if (NULL != content) {
|
||||
asprintf(&tmp, "%s)", content);
|
||||
free(content);
|
||||
} else {
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
ompi_info_out(message, NULL, tmp);
|
||||
free(message);
|
||||
if (NULL != tmp) {
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
} else {
|
||||
asprintf(&message, "mca:%s:%s:version", component->mca_type_name, component->mca_component_name);
|
||||
if (want_mca) {
|
||||
asprintf(&tmp, "mca:%s", mca_version);
|
||||
ompi_info_out(NULL, message, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
if (want_type) {
|
||||
asprintf(&tmp, "api:%s", api_version);
|
||||
ompi_info_out(NULL, message, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
if (want_component) {
|
||||
asprintf(&tmp, "component:%s", component_version);
|
||||
ompi_info_out(NULL, message, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
free(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char *make_version_str(const char *scope,
|
||||
int major, int minor, int release,
|
||||
const char *greek,
|
||||
bool want_svn, const char *svn)
|
||||
{
|
||||
char *str = NULL, *tmp;
|
||||
char temp[BUFSIZ];
|
||||
|
||||
temp[BUFSIZ - 1] = '\0';
|
||||
if (0 == strcmp(scope, ompi_info_ver_full) ||
|
||||
0 == strcmp(scope, ompi_info_ver_all)) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d.%d", major, minor);
|
||||
str = strdup(temp);
|
||||
if (release > 0) {
|
||||
snprintf(temp, BUFSIZ - 1, ".%d", release);
|
||||
asprintf(&tmp, "%s%s", str, temp);
|
||||
free(str);
|
||||
str = tmp;
|
||||
}
|
||||
if (NULL != greek) {
|
||||
asprintf(&tmp, "%s%s", str, greek);
|
||||
free(str);
|
||||
str = tmp;
|
||||
}
|
||||
if (want_svn && NULL != svn) {
|
||||
asprintf(&tmp, "%s%s", str, svn);
|
||||
free(str);
|
||||
str = tmp;
|
||||
}
|
||||
} else if (0 == strcmp(scope, ompi_info_ver_major)) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d", major);
|
||||
} else if (0 == strcmp(scope, ompi_info_ver_minor)) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d", minor);
|
||||
} else if (0 == strcmp(scope, ompi_info_ver_release)) {
|
||||
snprintf(temp, BUFSIZ - 1, "%d", release);
|
||||
} else if (0 == strcmp(scope, ompi_info_ver_greek)) {
|
||||
str = strdup(greek);
|
||||
} else if (0 == strcmp(scope, ompi_info_ver_svn)) {
|
||||
str = strdup(svn);
|
||||
}
|
||||
|
||||
if (NULL == str) {
|
||||
str = strdup(temp);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
@ -1,326 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
// University Research and Technology
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
// of Tennessee Research Foundation. All rights
|
||||
// reserved.
|
||||
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
// Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
//
|
||||
// $HEADER$
|
||||
//
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opal/version.h"
|
||||
#include "orte/version.h"
|
||||
#include "ompi/version.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||
#include "opal/util/printf.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ompi_info;
|
||||
|
||||
|
||||
//
|
||||
// Public variables
|
||||
//
|
||||
|
||||
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";
|
||||
const string ompi_info::ver_greek = "greek";
|
||||
const string ompi_info::ver_svn = "svn";
|
||||
|
||||
//
|
||||
// Private variables
|
||||
//
|
||||
|
||||
static const string ver_all = "all";
|
||||
static const string ver_mca = "mca";
|
||||
static const string ver_type = "type";
|
||||
static const string ver_component = "component";
|
||||
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
||||
static void show_mca_version(const mca_base_component_t *component,
|
||||
const string& scope, const string& ver_type);
|
||||
static string make_version_str(const string& scope,
|
||||
int major, int minor, int release,
|
||||
const string& greek,
|
||||
bool want_svn, const string& svn);
|
||||
|
||||
//
|
||||
// do_version
|
||||
//
|
||||
// Determines the version information related to the ompi components
|
||||
// being used.
|
||||
// Accepts:
|
||||
// - want_all: True if all components' info is required.
|
||||
// - cmd_line: The constructed command line argument
|
||||
//
|
||||
void ompi_info::do_version(bool want_all, opal_cmd_line_t *cmd_line)
|
||||
{
|
||||
unsigned int count;
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
string arg1, scope, type, component;
|
||||
string::size_type pos;
|
||||
|
||||
open_components();
|
||||
|
||||
if (want_all) {
|
||||
show_ompi_version(ver_full);
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
show_component_version(mca_types[i], component_all, ver_full, type_all);
|
||||
}
|
||||
} else {
|
||||
count = opal_cmd_line_get_ninsts(cmd_line, "version");
|
||||
for (i = 0; i < count; ++i) {
|
||||
arg1 = opal_cmd_line_get_param(cmd_line, "version", (int)i, 0);
|
||||
scope = opal_cmd_line_get_param(cmd_line, "version", (int)i, 1);
|
||||
|
||||
// Version of Open MPI
|
||||
|
||||
if (type_ompi == arg1) {
|
||||
show_ompi_version(scope);
|
||||
}
|
||||
|
||||
// Specific type and component
|
||||
|
||||
else if (string::npos != (pos = arg1.find(':'))) {
|
||||
type = arg1.substr(0, pos);
|
||||
component = arg1.substr(pos + 1);
|
||||
|
||||
show_component_version(type, component, scope, ver_all);
|
||||
}
|
||||
|
||||
// All components of a specific type
|
||||
|
||||
else {
|
||||
show_component_version(arg1, component_all, scope, ver_all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Show the version of Open MPI
|
||||
//
|
||||
void ompi_info::show_ompi_version(const string& scope)
|
||||
{
|
||||
out("Package", "package", OPAL_PACKAGE_STRING);
|
||||
out("Open MPI", type_ompi + ":version:full",
|
||||
make_version_str(scope,
|
||||
OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION,
|
||||
OMPI_GREEK_VERSION,
|
||||
OMPI_WANT_SVN, OMPI_SVN_R));
|
||||
out("Open MPI SVN revision", type_ompi + ":version:svn",
|
||||
OMPI_SVN_R);
|
||||
out("Open MPI release date", type_ompi + ":version:release_date",
|
||||
OMPI_RELEASE_DATE);
|
||||
|
||||
out("Open RTE", type_orte + ":version:full",
|
||||
make_version_str(scope,
|
||||
ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION,
|
||||
ORTE_GREEK_VERSION,
|
||||
ORTE_WANT_SVN, ORTE_SVN_R));
|
||||
out("Open RTE SVN revision", type_orte + ":version:svn",
|
||||
ORTE_SVN_R);
|
||||
out("Open RTE release date", type_orte + ":version:release_date",
|
||||
ORTE_RELEASE_DATE);
|
||||
|
||||
out("OPAL", type_opal + ":version:full",
|
||||
make_version_str(scope,
|
||||
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
OPAL_GREEK_VERSION,
|
||||
OPAL_WANT_SVN, OPAL_SVN_R));
|
||||
out("OPAL SVN revision", type_opal + ":version:svn",
|
||||
OPAL_SVN_R);
|
||||
out("OPAL release date", type_opal + ":version:release_date",
|
||||
OPAL_RELEASE_DATE);
|
||||
out("Ident string", "ident", OPAL_IDENT_STRING);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Show all the components of a specific type/component combo (component may be
|
||||
// a wildcard)
|
||||
//
|
||||
void ompi_info::show_component_version(const string& type_name,
|
||||
const string& component_name,
|
||||
const string& scope, const string& ver_type)
|
||||
{
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
bool want_all_components = (type_all == component_name);
|
||||
bool found;
|
||||
opal_list_item_t *item;
|
||||
mca_base_component_list_item_t *cli;
|
||||
const mca_base_component_t *component;
|
||||
opal_list_t *components;
|
||||
|
||||
// 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("ompi_info", "usage");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Now that we have a valid type, find the right component list
|
||||
|
||||
components = component_map[type_name];
|
||||
if (NULL != components) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Given a component, display its relevant version(s)
|
||||
//
|
||||
static void show_mca_version(const mca_base_component_t* component,
|
||||
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_component = (ver_all == ver_type || ver_type == ver_component);
|
||||
string message, content;
|
||||
string mca_version;
|
||||
string api_version;
|
||||
string component_version;
|
||||
string empty;
|
||||
|
||||
mca_version = make_version_str(scope, component->mca_major_version,
|
||||
component->mca_minor_version,
|
||||
component->mca_release_version, "",
|
||||
false, "");
|
||||
api_version = make_version_str(scope, component->mca_type_major_version,
|
||||
component->mca_type_minor_version,
|
||||
component->mca_type_release_version, "",
|
||||
false, "");
|
||||
component_version = make_version_str(scope, component->mca_component_major_version,
|
||||
component->mca_component_minor_version,
|
||||
component->mca_component_release_version,
|
||||
"", false, "");
|
||||
|
||||
if (pretty) {
|
||||
message = "MCA ";
|
||||
message += component->mca_type_name;
|
||||
printed = false;
|
||||
|
||||
content = component->mca_component_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_component) {
|
||||
if (printed)
|
||||
content += ", ";
|
||||
content += "Component v" + component_version;
|
||||
printed = true;
|
||||
}
|
||||
out(message, empty, content + ")");
|
||||
} else {
|
||||
message = "mca:";
|
||||
message += component->mca_type_name;
|
||||
message += ":";
|
||||
message += component->mca_component_name;
|
||||
message += ":version";
|
||||
if (want_mca)
|
||||
out(empty, message, "mca:" + mca_version);
|
||||
if (want_type)
|
||||
out(empty, message, "api:" + api_version);
|
||||
if (want_component)
|
||||
out(empty, message, "component:" + component_version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static string make_version_str(const string& scope,
|
||||
int major, int minor, int release,
|
||||
const string &greek,
|
||||
bool want_svn, const string& svn)
|
||||
{
|
||||
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 (!greek.empty()) {
|
||||
str += greek;
|
||||
}
|
||||
if (want_svn && !svn.empty()) {
|
||||
str += svn;
|
||||
}
|
||||
} 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_greek) {
|
||||
str = greek;
|
||||
} else if (scope == ver_svn) {
|
||||
str = svn;
|
||||
}
|
||||
|
||||
if (str.empty()) {
|
||||
str = temp;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user