diff --git a/ompi/tools/ompi_info/CMakeLists.txt b/ompi/tools/ompi_info/CMakeLists.txt index 80c3485790..cd61c537d3 100644 --- a/ompi/tools/ompi_info/CMakeLists.txt +++ b/ompi/tools/ompi_info/CMakeLists.txt @@ -24,4 +24,3 @@ TARGET_LINK_LIBRARIES (ompi_info libmpi libopen-rte libopen-pal Ws2_32.lib shlwa INSTALL(TARGETS ompi_info DESTINATION bin) -INSTALL(FILES help-ompi_info.txt DESTINATION share/openmpi) diff --git a/ompi/tools/ompi_info/Makefile.am b/ompi/tools/ompi_info/Makefile.am index 2a6f8dd1fb..985675da5c 100644 --- a/ompi/tools/ompi_info/Makefile.am +++ b/ompi/tools/ompi_info/Makefile.am @@ -11,6 +11,8 @@ # All rights reserved. # Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2012 Los Alamos National Security, LLC. +# All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -45,8 +47,6 @@ if OMPI_INSTALL_BINARIES bin_PROGRAMS = ompi_info -dist_pkgdata_DATA = help-ompi_info.txt - nodist_man_MANS = $(man_pages) # Ensure that the man pages are rebuilt if the opal_config.h file @@ -59,7 +59,6 @@ endif ompi_info_SOURCES = \ ompi_info.h \ ompi_info.c \ - output.c \ param.c \ components.c \ version.c diff --git a/ompi/tools/ompi_info/components.c b/ompi/tools/ompi_info/components.c index eb06462257..f078ce08fb 100644 --- a/ompi/tools/ompi_info/components.c +++ b/ompi/tools/ompi_info/components.c @@ -25,36 +25,11 @@ #include #include -#include "ompi/runtime/params.h" -#include "orte/runtime/runtime.h" - #include "opal/util/argv.h" +#include "opal/runtime/opal_info_support.h" -#include "opal/mca/event/base/base.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/shmem/shmem.h" -#include "opal/mca/shmem/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" -#include "opal/mca/hwloc/base/base.h" -#if OPAL_ENABLE_FT_CR == 1 -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" -#include "opal/mca/compress/compress.h" -#include "opal/mca/compress/base/base.h" -#endif -#include "opal/runtime/opal.h" -#include "opal/dss/dss.h" -#include "opal/mca/if/base/base.h" +#include "orte/runtime/runtime.h" +#include "orte/runtime/orte_info_support.h" #include "ompi/mca/allocator/base/base.h" #include "ompi/mca/coll/base/base.h" @@ -84,80 +59,19 @@ #include "ompi/mca/fcoll/base/base.h" #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" - +#include "ompi/runtime/params.h" #if OPAL_ENABLE_FT_CR == 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/state/state.h" -#include "orte/mca/state/base/base.h" -#include "orte/mca/grpcomm/grpcomm.h" -#include "orte/mca/grpcomm/base/base.h" -#include "orte/mca/db/db.h" -#include "orte/mca/db/base/base.h" -#include "orte/mca/ess/ess.h" -#include "orte/mca/ess/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_CR == 1 -#include "orte/mca/snapc/snapc.h" -#include "orte/mca/snapc/base/base.h" -#include "orte/mca/sstore/sstore.h" -#include "orte/mca/sstore/base/base.h" -#endif -#if ORTE_ENABLE_SENSORS -#include "orte/mca/sensor/sensor.h" -#include "orte/mca/sensor/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 @@ -173,30 +87,23 @@ static bool opened_components = false; * out the environment of all OMPI_MCA_ variables to ensure * that the open algorithms don't try to only open one component. */ -void ompi_info_open_components(void) +int ompi_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map) { 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); + opal_info_component_map_t *map; /* 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))) { + 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); @@ -213,463 +120,182 @@ void ompi_info_open_components(void) free(env); } - /* some components require the event library be active, so activate it */ - if (OPAL_SUCCESS != opal_event_base_open()) { - str = "opal_event_base_open"; - goto error; - } - - /* Open the DSS */ - - if (OPAL_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 = OBJ_NEW(opal_info_component_map_t); map->type = strdup("base"); - opal_pointer_array_add(&component_map, map); + opal_pointer_array_add(component_map, map); /* 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); - - /* the event framework is already open - just get its components */ - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("event"); - map->components = &opal_event_components; - 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_shmem_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("shmem"); - map->components = &opal_shmem_base_components_opened; - opal_pointer_array_add(&component_map, map); - -#if OPAL_HAVE_HWLOC - if (OPAL_SUCCESS != opal_hwloc_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("hwloc"); - map->components = &opal_hwloc_base_components; - opal_pointer_array_add(&component_map, map); -#endif - - 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_CR == 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); - - if (OPAL_SUCCESS != opal_compress_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("compress"); - map->components = &opal_compress_base_components_available; - opal_pointer_array_add(&component_map, map); -#endif - - if (OPAL_SUCCESS != opal_if_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("if"); - map->components = &opal_if_components; - opal_pointer_array_add(&component_map, map); - - /* 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_state_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("state"); - map->components = &orte_state_base_components_available; - opal_pointer_array_add(&component_map, map); - - 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 = &orte_grpcomm_base.components_available; - opal_pointer_array_add(&component_map, map); - - if (ORTE_SUCCESS != orte_db_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("db"); - map->components = &orte_db_base.available_components; - 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_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_CR == 1 - if (ORTE_SUCCESS != orte_sstore_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("sstore"); - map->components = &orte_sstore_base_components_available; - opal_pointer_array_add(&component_map, map); - - 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_ENABLE_SENSORS - if (ORTE_SUCCESS != orte_sensor_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("sensor"); - map->components = &mca_sensor_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 = OBJ_NEW(opal_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_fcoll_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("fcoll"); - map->components = &mca_fcoll_base_components_opened; - opal_pointer_array_add(&component_map, map); - - if (OMPI_SUCCESS != mca_fs_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("fs"); - map->components = &mca_fs_base_components_opened; - opal_pointer_array_add(&component_map, map); - - if (OMPI_SUCCESS != mca_fbtl_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("fbtl"); - map->components = &mca_fbtl_base_components_opened; - opal_pointer_array_add(&component_map, map); - - if (OMPI_SUCCESS != mca_sharedfp_base_open()) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("sharedfp"); - map->components = &mca_sharedfp_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); + 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 = OBJ_NEW(opal_info_component_map_t); map->type = strdup("btl"); map->components = &mca_btl_base_components_opened; - opal_pointer_array_add(&component_map, map); + opal_pointer_array_add(component_map, map); - if (OMPI_SUCCESS != ompi_mtl_base_open()) { + if (OMPI_SUCCESS != mca_coll_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); + map = OBJ_NEW(opal_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_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 (OMPI_SUCCESS != mca_vprotocol_base_open(NULL)) { - goto error; - } - map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("vprotocol"); - map->components = &mca_vprotocol_base_components_available; - opal_pointer_array_add(&component_map, map); - #if OPAL_ENABLE_FT_CR == 1 if (OMPI_SUCCESS != ompi_crcp_base_open()) { goto error; } - map = OBJ_NEW(ompi_info_component_map_t); + map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("crcp"); map->components = &ompi_crcp_base_components_available; - opal_pointer_array_add(&component_map, map); + opal_pointer_array_add(component_map, map); #endif + if (OMPI_SUCCESS != ompi_dpm_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("dpm"); + map->components = &ompi_dpm_base_components_available; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != mca_fbtl_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("fbtl"); + map->components = &mca_fbtl_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != mca_fcoll_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("fcoll"); + map->components = &mca_fcoll_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != mca_fs_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("fs"); + map->components = &mca_fs_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != mca_io_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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_mpool_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("mpool"); + map->components = &mca_mpool_base_components; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != ompi_mtl_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("mtl"); + map->components = &ompi_mtl_base_components_opened; + opal_pointer_array_add(component_map, map); + + ompi_op_base_open(); + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("op"); + map->components = &ompi_op_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != ompi_osc_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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_pml_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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(opal_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_pubsub_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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 != mca_rcache_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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_sharedfp_base_open()) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("sharedfp"); + map->components = &mca_sharedfp_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OMPI_SUCCESS != mca_topo_base_open()) { + goto error; + } + map = OBJ_NEW(opal_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 != mca_vprotocol_base_open(NULL)) { + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("vprotocol"); + map->components = &mca_vprotocol_base_components_available; + opal_pointer_array_add(component_map, map); + /* flag that we need to close components */ need_close_components = true; @@ -687,7 +313,7 @@ void ompi_info_open_components(void) /* All done */ opened_components = true; - return; + return OMPI_SUCCESS; error: fprintf(stderr, "%s\n", str); @@ -696,93 +322,46 @@ error: opened_components = true; ompi_info_close_components(); } + return OMPI_ERROR; } 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. + /* 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? - */ + * We also explicitly ignore the return values from the + * close() functions -- what would we do if there was an + * error? + */ -#if OPAL_ENABLE_FT_CR == 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_fbtl_base_close(); - (void) mca_fcoll_base_close(); - (void) mca_fs_base_close(); - (void) mca_sharedfp_base_close(); - (void) mca_coll_base_close(); - (void) mca_allocator_base_close(); - (void) ompi_osc_base_close(); + /* close the OPAL components */ + (void) opal_info_close_components(); - (void) orte_grpcomm_base_close(); - (void) orte_db_base_close(); - (void) orte_ess_base_close(); - (void) orte_show_help_finalize(); -#if !ORTE_DISABLE_FULL_SUPPORT -#if OPAL_ENABLE_FT_CR == 1 - (void) orte_snapc_base_close(); - (void) orte_sstore_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(); + /* close the ORTE components */ + (void) orte_info_close_components(); -#endif - (void) orte_errmgr_base_close(); - (void) orte_state_base_close(); - - (void) opal_backtrace_base_close(); - (void) opal_memory_base_close(); - (void) opal_memchecker_base_close(); - (void) opal_timer_base_close(); -#if OPAL_HAVE_HWLOC - (void) opal_hwloc_base_close(); -#endif #if OPAL_ENABLE_FT_CR == 1 - (void) opal_crs_base_close(); + (void) ompi_crcp_base_close(); #endif - (void) opal_dss_close(); - (void) opal_event_base_close(); - - /* 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; + (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_fbtl_base_close(); + (void) mca_fcoll_base_close(); + (void) mca_fs_base_close(); + (void) mca_sharedfp_base_close(); + (void) mca_coll_base_close(); + (void) mca_allocator_base_close(); + (void) ompi_osc_base_close(); } diff --git a/ompi/tools/ompi_info/ompi_info.c b/ompi/tools/ompi_info/ompi_info.c index 6039387960..9891319b55 100644 --- a/ompi/tools/ompi_info/ompi_info.c +++ b/ompi/tools/ompi_info/ompi_info.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved. + * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,13 +43,11 @@ #if OPAL_ENABLE_FT_CR == 1 #include "opal/runtime/opal_cr.h" #endif -#include "opal/util/cmd_line.h" -#include "opal/util/error.h" -#include "opal/util/argv.h" -#include "opal/util/show_help.h" #include "opal/mca/base/base.h" +#include "opal/runtime/opal_info_support.h" +#include "opal/util/show_help.h" -#include "orte/util/show_help.h" +#include "orte/runtime/orte_info_support.h" #include "ompi/communicator/communicator.h" #include "ompi/tools/ompi_info/ompi_info.h" @@ -56,270 +56,146 @@ * 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; + int i; char *str; - + opal_cmd_line_t *ompi_info_cmd_line; + opal_pointer_array_t mca_types; + opal_pointer_array_t component_map; + opal_info_component_map_t *map; + /* Initialize the argv parsing handle */ - if (OMPI_SUCCESS != opal_init_util(&argc, &argv)) { - orte_show_help("help-ompi_info.txt", "lib-call-fail", true, + if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) { + opal_show_help("help-opal_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_show_help("help-opal_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 */ - - ret = opal_cmd_line_parse(ompi_info_cmd_line, false, argc, argv); - if (OMPI_SUCCESS != ret) { - cmd_error = true; - if (OPAL_ERR_SILENT != ret) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(ret)); - } - } - if (!cmd_error && - (opal_cmd_line_is_taken(ompi_info_cmd_line, "help") || - opal_cmd_line_is_taken(ompi_info_cmd_line, "h"))) { - char *str, *usage; - want_help = true; - usage = opal_cmd_line_get_usage_msg(ompi_info_cmd_line); - str = opal_show_help_string("help-ompi_info.txt", "usage", - true, usage); - if (NULL != str) { - printf("%s", str); - free(str); - } - free(usage); + /* initialize the command line, parse it, and return the directives + * telling us what the user wants output + */ + if (OPAL_SUCCESS != (ret = opal_info_init(argc, argv, ompi_info_cmd_line))) { + exit(ret); } - /* If we had a cmd line parse error, or we showed the help - message, it's time to exit. */ - if (cmd_error || want_help) { - 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, "shmem"); - opal_pointer_array_add(&mca_types, "timer"); - opal_pointer_array_add(&mca_types, "installdirs"); - opal_pointer_array_add(&mca_types, "hwloc"); -#if OPAL_ENABLE_FT_CR == 1 - opal_cr_set_enabled(true); - opal_pointer_array_add(&mca_types, "crs"); - opal_pointer_array_add(&mca_types, "compress"); -#endif - opal_pointer_array_add(&mca_types, "if"); - opal_pointer_array_add(&mca_types, "event"); + /* add in the opal frameworks */ + opal_info_register_types(&mca_types); - opal_pointer_array_add(&mca_types, "dpm"); - opal_pointer_array_add(&mca_types, "pubsub"); + /* add in the orte frameworks */ + orte_info_register_types(&mca_types); + + /* add in the ompi frameworks */ 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, "coll"); opal_pointer_array_add(&mca_types, "common"); - opal_pointer_array_add(&mca_types, "fbtl"); - opal_pointer_array_add(&mca_types, "fs"); - opal_pointer_array_add(&mca_types, "fcoll"); - opal_pointer_array_add(&mca_types, "sharedfp"); #if OPAL_ENABLE_FT_CR == 1 opal_pointer_array_add(&mca_types, "crcp"); #endif + opal_pointer_array_add(&mca_types, "dpm"); + opal_pointer_array_add(&mca_types, "fbtl"); + opal_pointer_array_add(&mca_types, "fcoll"); + opal_pointer_array_add(&mca_types, "fs"); + opal_pointer_array_add(&mca_types, "io"); + opal_pointer_array_add(&mca_types, "mpi"); + opal_pointer_array_add(&mca_types, "mpool"); + opal_pointer_array_add(&mca_types, "mtl"); + opal_pointer_array_add(&mca_types, "ompi"); + opal_pointer_array_add(&mca_types, "op"); + opal_pointer_array_add(&mca_types, "osc"); + opal_pointer_array_add(&mca_types, "pml"); + opal_pointer_array_add(&mca_types, "pubsub"); + opal_pointer_array_add(&mca_types, "rcache"); + opal_pointer_array_add(&mca_types, "sharedfp"); + opal_pointer_array_add(&mca_types, "topo"); -#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_CR == 1 - opal_pointer_array_add(&mca_types, "sstore"); - opal_pointer_array_add(&mca_types, "snapc"); -#endif -#if ORTE_ENABLE_SENSORS - opal_pointer_array_add(&mca_types, "sensor"); -#endif - opal_pointer_array_add(&mca_types, "filem"); -#endif - /* these are always included */ - opal_pointer_array_add(&mca_types, "state"); - 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, "db"); + /* init the component map */ + OBJ_CONSTRUCT(&component_map, opal_pointer_array_t); + opal_pointer_array_init(&component_map, 256, INT_MAX, 128); - /* 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; + /* Register OPAL's params */ + if (OPAL_SUCCESS != (ret = opal_info_register_components(&mca_types, &component_map))) { + exit(ret); } - + + /* Register ORTE's params */ + if (ORTE_SUCCESS != (ret = orte_info_register_components(&mca_types, &component_map))) { + exit(ret); + } + + /* Register OMPI's params */ + if (OMPI_SUCCESS != (ret = ompi_info_register_components(&mca_types, &component_map))) { + exit(ret); + } + + /* Execute the desired action(s) */ 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); + ompi_info_do_version(want_all, ompi_info_cmd_line, + &mca_types, &component_map); 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); + opal_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(); + opal_info_do_arch(); acted = true; } if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "hostname")) { - ompi_info_do_hostname(); + opal_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")); + if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "param") || + opal_cmd_line_is_taken(ompi_info_cmd_line, "params")) { + opal_info_do_params(want_all, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"), + &mca_types, ompi_info_cmd_line); 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_show_ompi_version(opal_info_ver_full); + opal_info_show_path(opal_info_path_prefix, opal_install_dirs.prefix); + opal_info_do_arch(); + opal_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); + opal_info_show_component_version(&mca_types, &component_map, + str, opal_info_component_all, + opal_info_ver_full, opal_info_type_all); } } } @@ -335,9 +211,14 @@ int main(int argc, char *argv[]) ompi_info_close_components(); OBJ_RELEASE(ompi_info_cmd_line); OBJ_DESTRUCT(&mca_types); - mca_base_close(); - - opal_finalize_util(); + for (i=0; i < component_map.size; i++) { + if (NULL != (map = (opal_info_component_map_t*)opal_pointer_array_get_item(&component_map, i))) { + OBJ_RELEASE(map); + } + } + OBJ_DESTRUCT(&component_map); + + opal_info_finalize(); return 0; } diff --git a/ompi/tools/ompi_info/ompi_info.h b/ompi/tools/ompi_info/ompi_info.h index 9cb89fb646..7fe5b20fe1 100644 --- a/ompi/tools/ompi_info/ompi_info.h +++ b/ompi/tools/ompi_info/ompi_info.h @@ -32,97 +32,21 @@ BEGIN_C_DECLS * Globals */ -extern bool ompi_info_pretty; -extern opal_cmd_line_t *ompi_info_cmd_line; - -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 opal_pointer_array_t mca_types; +void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line, + opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map); - -/* - * Version-related strings and functions - */ - -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 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 - */ - -extern const char *ompi_info_component_all; -extern const char *ompi_info_param_all; - -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 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 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 ompi_info_do_arch(void); -void ompi_info_do_hostname(void); -void ompi_info_do_config(bool want_all); - -/* - * 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); - -extern opal_pointer_array_t component_map; - -void ompi_info_open_components(void); +int ompi_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map); void ompi_info_close_components(void); +void ompi_info_do_config(bool want_all); + END_C_DECLS #endif /* OMPI_INFO_H */ diff --git a/ompi/tools/ompi_info/output.c b/ompi/tools/ompi_info/output.c deleted file mode 100644 index e26790e401..0000000000 --- a/ompi/tools/ompi_info/output.c +++ /dev/null @@ -1,203 +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 -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_TERMIOS_H -#include -#endif -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#include - -#ifdef __WINDOWS__ -#include -#endif /* __WINDOWS__ */ - -#include "ompi/tools/ompi_info/ompi_info.h" - -#include "opal/util/show_help.h" - - -/* - * 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, *v_to_free; - -#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 = v_to_free = 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_to_free); - v_to_free = 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 + 1] = '\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); - } - } - if (NULL != v_to_free) { - free(v_to_free); - } -} - -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); -} diff --git a/ompi/tools/ompi_info/param.c b/ompi/tools/ompi_info/param.c index 8eefbe5919..ea752960fe 100644 --- a/ompi/tools/ompi_info/param.c +++ b/ompi/tools/ompi_info/param.c @@ -34,12 +34,12 @@ #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 "opal/runtime/opal_info_support.h" #include "orte/util/show_help.h" @@ -47,439 +47,8 @@ #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"; - const char *ompi_info_deprecated_value = "deprecated-ompi-info-value"; -/* - * 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 = (char *)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 = (char *)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", "not-found", true, type); - 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 *("~/" -> - * "/") 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", OPAL_CONFIGURE_HOST); -} - - static void append(char *dest, size_t max, int *first, char *src) { size_t len; @@ -551,15 +120,15 @@ void ompi_info_do_config(bool want_all) char *topology_support; char *vt_support; - /* Do a little preprocessor trickery here to figure ompi_info_out the + /* Do a little preprocessor trickery here to figure opal_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 + * opal_info_out ok. Note that we chose the preprocessor + * comparison ropal_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 @@ -702,43 +271,43 @@ void ompi_info_do_config(bool want_all) OPAL_ENABLE_CRDEBUG ? "yes" : "no"); /* output values */ - ompi_info_out("Configured by", "config:user", OPAL_CONFIGURE_USER); - ompi_info_out("Configured on", "config:timestamp", OPAL_CONFIGURE_DATE); - ompi_info_out("Configure host", "config:host", OPAL_CONFIGURE_HOST); + opal_info_out("Configured by", "config:user", OPAL_CONFIGURE_USER); + opal_info_out("Configured on", "config:timestamp", OPAL_CONFIGURE_DATE); + opal_info_out("Configure host", "config:host", OPAL_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); + opal_info_out("Built by", "build:user", OMPI_BUILD_USER); + opal_info_out("Built on", "build:timestamp", OMPI_BUILD_DATE); + opal_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("Fort mpif.h", "bindings:mpif.h", fortran_mpifh); + opal_info_out("C bindings", "bindings:c", "yes"); + opal_info_out("C++ bindings", "bindings:cxx", cxx); + opal_info_out("Fort mpif.h", "bindings:mpif.h", fortran_mpifh); free(fortran_mpifh); - ompi_info_out("Fort use mpi", "bindings:use_mpi", + opal_info_out("Fort use mpi", "bindings:use_mpi", fortran_usempi); - ompi_info_out("Fort use mpi size", "bindings:use_mpi:size", + opal_info_out("Fort use mpi size", "bindings:use_mpi:size", ompi_info_deprecated_value); - ompi_info_out("Fort use mpi_f08", "bindings:use_mpi_f08", + opal_info_out("Fort use mpi_f08", "bindings:use_mpi_f08", fortran_usempif08); - ompi_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance", + opal_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance", fortran_usempif08_compliance); if (NULL != fortran_usempif08_compliance) { free(fortran_usempif08_compliance); } - ompi_info_out("Fort mpi_f08 subarrays", "bindings:use_mpi_f08:subarrays-supported", + opal_info_out("Fort mpi_f08 subarrays", "bindings:use_mpi_f08:subarrays-supported", fortran_build_f08_subarrays); - ompi_info_out("Java bindings", "bindings:java", java); + opal_info_out("Java bindings", "bindings:java", java); - ompi_info_out("C compiler", "compiler:c:command", OPAL_CC); - ompi_info_out("C compiler absolute", "compiler:c:absolute", + opal_info_out("C compiler", "compiler:c:command", OPAL_CC); + opal_info_out("C compiler absolute", "compiler:c:absolute", OPAL_CC_ABSOLUTE); - ompi_info_out("C compiler family name", "compiler:c:familyname", + opal_info_out("C compiler family name", "compiler:c:familyname", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME)); - ompi_info_out("C compiler version", "compiler:c:version", + opal_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)); + opal_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char)); /* JMS: should be fixed in MPI-2.2 to differentiate between C _Bool and C++ bool. For the moment, the code base assumes that they are the same. Because of opal_config_bottom.h, @@ -746,57 +315,57 @@ void ompi_info_do_config(bool want_all) though this technically isn't right. This should be fixed when we update to MPI-2.2. See below for note about C++ bool alignment. */ - 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); + opal_info_out_int("C bool size", "compiler:c:sizeof:bool", sizeof(bool)); + opal_info_out_int("C short size", "compiler:c:sizeof:short", sizeof(short)); + opal_info_out_int("C int size", "compiler:c:sizeof:int", sizeof(int)); + opal_info_out_int("C long size", "compiler:c:sizeof:long", sizeof(long)); + opal_info_out_int("C float size", "compiler:c:sizeof:float", sizeof(float)); + opal_info_out_int("C double size", "compiler:c:sizeof:double", sizeof(double)); + opal_info_out_int("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *)); + opal_info_out_int("C char align", "compiler:c:align:char", OPAL_ALIGNMENT_CHAR); #if OMPI_BUILD_CXX_BINDINGS /* JMS: See above for note about C++ bool size. We don't have the bool alignment the way configure currently runs -- need to clean this up when we update for MPI-2.2. */ - ompi_info_out_int("C bool align", "compiler:c:align:bool", OPAL_ALIGNMENT_CXX_BOOL); + opal_info_out_int("C bool align", "compiler:c:align:bool", OPAL_ALIGNMENT_CXX_BOOL); #else - ompi_info_out("C bool align", "compiler:c:align:bool", "skipped"); + opal_info_out("C bool align", "compiler:c:align:bool", "skipped"); #endif - 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", OPAL_ALIGNMENT_FLOAT); - ompi_info_out_int("C double align", "compiler:c:align:double", OPAL_ALIGNMENT_DOUBLE); + opal_info_out_int("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT); + opal_info_out_int("C float align", "compiler:c:align:float", OPAL_ALIGNMENT_FLOAT); + opal_info_out_int("C double align", "compiler:c:align:double", OPAL_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("Fort compiler", "compiler:fortran:command", OMPI_FC); - ompi_info_out("Fort compiler abs", "compiler:fortran:absolute", + opal_info_out("C++ compiler", "compiler:cxx:command", OMPI_CXX); + opal_info_out("C++ compiler absolute", "compiler:cxx:absolute", OMPI_CXX_ABSOLUTE); + opal_info_out("Fort compiler", "compiler:fortran:command", OMPI_FC); + opal_info_out("Fort compiler abs", "compiler:fortran:absolute", OMPI_FC_ABSOLUTE); - ompi_info_out("Fort ignore TKR", "compiler:fortran:ignore_tkr", + opal_info_out("Fort ignore TKR", "compiler:fortran:ignore_tkr", fortran_have_ignore_tkr); free(fortran_have_ignore_tkr); - ompi_info_out("Fort 08 assumed shape", + opal_info_out("Fort 08 assumed shape", "compiler:fortran:f08_assumed_shape", fortran_have_f08_assumed_shape); - ompi_info_out("Fort optional args", + opal_info_out("Fort optional args", "compiler:fortran:optional_arguments", fortran_have_optional_args); - ompi_info_out("Fort BIND(C)", + opal_info_out("Fort BIND(C)", "compiler:fortran:bind_c", fortran_have_bind_c); - ompi_info_out("Fort PRIVATE", + opal_info_out("Fort PRIVATE", "compiler:fortran:private", fortran_have_private); - ompi_info_out("Fort ABSTRACT", + opal_info_out("Fort ABSTRACT", "compiler:fortran:abstract", fortran_have_abstract); - ompi_info_out("Fort ASYNCHRONOUS", + opal_info_out("Fort ASYNCHRONOUS", "compiler:fortran:asynchronous", fortran_have_asynchronous); - ompi_info_out("Fort PROCEDURE", + opal_info_out("Fort PROCEDURE", "compiler:fortran:procedure", fortran_have_procedure); - ompi_info_out("Fort f08 using wrappers", + opal_info_out("Fort f08 using wrappers", "compiler:fortran:08_wrappers", fortran_08_using_wrappers_for_choice_buffer_functions); @@ -804,12 +373,12 @@ void ompi_info_do_config(bool want_all) /* Will always have the size of Fortran integer */ - ompi_info_out_int("Fort integer size", "compiler:fortran:sizeof:integer", + opal_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", + opal_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", + opal_info_out_int("Fort logical value true", "compiler:fortran:value:true", OMPI_FORTRAN_VALUE_TRUE); @@ -818,137 +387,137 @@ void ompi_info_do_config(bool want_all) if (OMPI_BUILD_FORTRAN_MPIFH_BINDINGS || OMPI_BUILD_FORTRAN_USEMPI_BINDINGS || OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS) { - ompi_info_out("Fort have integer1", "compiler:fortran:have:integer1", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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:integer16", + opal_info_out_int("Fort integer16 size", "compiler:fortran:sizeof:integer16", OMPI_HAVE_FORTRAN_INTEGER16 ? OMPI_SIZEOF_FORTRAN_INTEGER16 : -1); - ompi_info_out_int("Fort real size", "compiler:fortran:sizeof:real", + opal_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", + opal_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", + opal_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", + opal_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", + opal_info_out_int("Fort dbl prec size", "compiler:fortran:sizeof:double_precision", OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION); - ompi_info_out_int("Fort cplx size", "compiler:fortran:sizeof:complex", + opal_info_out_int("Fort cplx size", "compiler:fortran:sizeof:complex", OMPI_SIZEOF_FORTRAN_COMPLEX); - ompi_info_out_int("Fort dbl cplx size", + opal_info_out_int("Fort dbl cplx size", "compiler:fortran:sizeof:double_complex", OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX ? OMPI_SIZEOF_FORTRAN_DOUBLE_COMPLEX : -1); - ompi_info_out_int("Fort cplx8 size", "compiler:fortran:sizeof:complex8", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_info_out_int("Fort dbl prec align", "compiler:fortran:align:double_precision", OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION); - ompi_info_out_int("Fort cplx align", "compiler:fortran:align:complex", + opal_info_out_int("Fort cplx align", "compiler:fortran:align:complex", OMPI_ALIGNMENT_FORTRAN_COMPLEX); - ompi_info_out_int("Fort dbl cplx align", + opal_info_out_int("Fort dbl cplx align", "compiler:fortran:align:double_complex", OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX ? OMPI_ALIGNMENT_FORTRAN_DOUBLE_COMPLEX : -1); - ompi_info_out_int("Fort cplx8 align", "compiler:fortran:align:complex8", + opal_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", + opal_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", + opal_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", + opal_info_out("Fort real size", "compiler:fortran:sizeof:real", "skipped"); + opal_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", + opal_info_out("Fort cplx size", "compiler:fortran:sizeof:complex", "skipped"); + opal_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", + opal_info_out("Fort integer align", "compiler:fortran:align:integer", "skipped"); + opal_info_out("Fort real align", "compiler:fortran:align:real", "skipped"); + opal_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", + opal_info_out("Fort cplx align", "compiler:fortran:align:complex", "skipped"); + opal_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("Fort mpif.h profiling", "option:profiling:mpif.h", + opal_info_out("C profiling", "option:profiling:c", cprofiling); + opal_info_out("C++ profiling", "option:profiling:cxx", cxxprofiling); + opal_info_out("Fort mpif.h profiling", "option:profiling:mpif.h", fortran_mpifh_profiling); - ompi_info_out("Fort use mpi profiling", "option:profiling:use_mpi", + opal_info_out("Fort use mpi profiling", "option:profiling:use_mpi", fortran_usempi_profiling); - ompi_info_out("Fort use mpi_f08 prof", + opal_info_out("Fort use mpi_f08 prof", "option:profiling:use_mpi_f08", fortran_usempif08_profiling); - ompi_info_out("C++ exceptions", "option:cxx_exceptions", cxxexceptions); - ompi_info_out("Thread support", "option:threads", threads); + opal_info_out("C++ exceptions", "option:cxx_exceptions", cxxexceptions); + opal_info_out("Thread support", "option:threads", threads); free(threads); - ompi_info_out("Sparse Groups", "option:sparse:groups", sparse_groups); + opal_info_out("Sparse Groups", "option:sparse:groups", sparse_groups); if (want_all) { @@ -957,66 +526,66 @@ void ompi_info_do_config(bool want_all) * 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 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); + opal_info_out("Build CFLAGS", "option:build:cflags", OMPI_BUILD_CFLAGS); + opal_info_out("Build CXXFLAGS", "option:build:cxxflags", OMPI_BUILD_CXXFLAGS); + opal_info_out("Build FCFLAGS", "option:build:fcflags", OMPI_BUILD_FCFLAGS); + opal_info_out("Build LDFLAGS", "option:build:ldflags", OMPI_BUILD_LDFLAGS); + opal_info_out("Build LIBS", "option:build:libs", OMPI_BUILD_LIBS); - ompi_info_out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags", + opal_info_out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags", WRAPPER_EXTRA_CFLAGS); - ompi_info_out("Wrapper extra CXXFLAGS", "option:wrapper:extra_cxxflags", + opal_info_out("Wrapper extra CXXFLAGS", "option:wrapper:extra_cxxflags", WRAPPER_EXTRA_CXXFLAGS); - ompi_info_out("Wrapper extra FCFLAGS", "option:wrapper:extra_fcflags", + opal_info_out("Wrapper extra FCFLAGS", "option:wrapper:extra_fcflags", WRAPPER_EXTRA_FCFLAGS); - ompi_info_out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags", + opal_info_out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags", WRAPPER_EXTRA_LDFLAGS); - ompi_info_out("Wrapper extra LIBS", "option:wrapper:extra_libs", + opal_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", + opal_info_out("Internal debug support", "option:debug", debug); + opal_info_out("MPI interface warnings", "option:mpi-interface-warning", mpi_interface_warning); + opal_info_out("MPI parameter check", "option:mpi-param-check", paramcheck); + opal_info_out("Memory profiling support", "option:mem-profile", memprofile); + opal_info_out("Memory debugging support", "option:mem-debug", memdebug); + opal_info_out("libltdl support", "option:dlopen", want_libltdl); + opal_info_out("Heterogeneous support", "options:heterogeneous", heterogeneous); + opal_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 vis. support", "options:visibility", symbol_visibility); - ompi_info_out("Host topology support", "options:host-topology", + opal_info_out("MPI I/O support", "options:mpi-io", have_mpi_io); + opal_info_out("MPI_WTIME support", "options:mpi-wtime", wtime_support); + opal_info_out("Symbol vis. support", "options:visibility", symbol_visibility); + opal_info_out("Host topology support", "options:host-topology", topology_support); - ompi_info_out("MPI extensions", "options:mpi_ext", OMPI_MPIEXT_COMPONENTS); + opal_info_out("MPI extensions", "options:mpi_ext", OMPI_MPIEXT_COMPONENTS); - ompi_info_out("FT Checkpoint support", "options:ft_support", ft_support); + opal_info_out("FT Checkpoint support", "options:ft_support", ft_support); free(ft_support); - ompi_info_out("C/R Enabled Debugging", "options:crdebug_support", crdebug_support); + opal_info_out("C/R Enabled Debugging", "options:crdebug_support", crdebug_support); free(crdebug_support); - ompi_info_out("VampirTrace support", "options:vt", vt_support); + opal_info_out("VampirTrace support", "options:vt", vt_support); - ompi_info_out_int("MPI_MAX_PROCESSOR_NAME", "options:mpi-max-processor-name", + opal_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", + opal_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", + opal_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", + opal_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", + opal_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", + opal_info_out_int("MPI_MAX_PORT_NAME", "options:mpi-max-port-name", MPI_MAX_PORT_NAME); #if OMPI_PROVIDE_MPI_FILE_INTERFACE - ompi_info_out_int("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", + opal_info_out_int("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", MPI_MAX_DATAREP_STRING); #else - ompi_info_out("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", + opal_info_out("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", "IO interface not provided"); #endif diff --git a/ompi/tools/ompi_info/version.c b/ompi/tools/ompi_info/version.c index b572a316cb..0de8571814 100644 --- a/ompi/tools/ompi_info/version.c +++ b/ompi/tools/ompi_info/version.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2012 Los Alamos National Security, LLC. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +32,9 @@ #include "ompi/version.h" #include "opal/mca/base/base.h" #include "opal/util/printf.h" +#include "opal/runtime/opal_info_support.h" + +#include "orte/runtime/orte_info_support.h" #include "ompi/tools/ompi_info/ompi_info.h" @@ -37,33 +42,11 @@ * 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_repo = "repo"; - -/* - * 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_repo, const char *repo); /* * do_version @@ -74,7 +57,9 @@ static char *make_version_str(const char *scope, * - 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) +void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line, + opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map) { unsigned int count; size_t i; @@ -82,15 +67,15 @@ void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line) 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))) { + ompi_info_show_ompi_version(opal_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); + opal_info_show_component_version(mca_types, component_map, + pos, opal_info_component_all, + opal_info_ver_full, opal_info_type_all); } } else { count = opal_cmd_line_get_ninsts(cmd_line, "version"); @@ -102,24 +87,27 @@ void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line) if (0 == strcmp(ompi_info_type_ompi, arg1)) { ompi_info_show_ompi_version(scope); - } - + } else if (0 == strcmp(orte_info_type_orte, arg1)) { + orte_info_show_orte_version(scope); + } else if (0 == strcmp(opal_info_type_opal, arg1)) { + opal_info_show_opal_version(scope); + } else if (NULL != (pos = strchr(arg1, ':'))) { /* 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); + opal_info_show_component_version(mca_types, component_map, + type, component, scope, opal_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); + opal_info_show_component_version(mca_types, component_map, + arg1, opal_info_component_all, scope, opal_info_ver_all); } } } @@ -133,301 +121,36 @@ void ompi_info_show_ompi_version(const char *scope) { char *tmp, *tmp2; - ompi_info_out("Package", "package", OPAL_PACKAGE_STRING); + opal_info_out("Package", "package", OPAL_PACKAGE_STRING); asprintf(&tmp, "%s:version:full", ompi_info_type_ompi); - tmp2 = make_version_str(scope, - OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, - OMPI_RELEASE_VERSION, - OMPI_GREEK_VERSION, - OMPI_WANT_REPO_REV, OMPI_REPO_REV); - ompi_info_out("Open MPI", tmp, tmp2); + tmp2 = opal_info_make_version_str(scope, + OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION, + OMPI_GREEK_VERSION, + OMPI_WANT_REPO_REV, OMPI_REPO_REV); + opal_info_out("Open MPI", tmp, tmp2); free(tmp); free(tmp2); asprintf(&tmp, "%s:version:repo", ompi_info_type_ompi); - ompi_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV); + opal_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV); free(tmp); asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi); - ompi_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE); + opal_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE); free(tmp); - asprintf(&tmp, "%s:version:full", ompi_info_type_orte); - tmp2 = make_version_str(scope, - ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION, - ORTE_GREEK_VERSION, - ORTE_WANT_REPO_REV, ORTE_REPO_REV); - ompi_info_out("Open RTE", tmp, tmp2); - free(tmp); - free(tmp2); - asprintf(&tmp, "%s:version:repo", ompi_info_type_orte); - ompi_info_out("Open RTE repo revision", tmp, ORTE_REPO_REV); - 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); + /* show the orte version */ + orte_info_show_orte_version(scope); + + /* show the opal version */ + opal_info_show_opal_version(scope); - asprintf(&tmp, "%s:version:full", ompi_info_type_opal); - tmp2 = make_version_str(scope, - OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION, - OPAL_GREEK_VERSION, - OPAL_WANT_REPO_REV, OPAL_REPO_REV); - ompi_info_out("OPAL", tmp, tmp2); - free(tmp); - free(tmp2); - asprintf(&tmp, "%s:version:repo", ompi_info_type_opal); - ompi_info_out("OPAL repo revision", tmp, OPAL_REPO_REV); - free(tmp); - asprintf(&tmp, "%s:version:release_date", ompi_info_type_opal); - ompi_info_out("OPAL release date", tmp, OPAL_RELEASE_DATE); - free(tmp); - - tmp2 = make_version_str(scope, - MPI_VERSION, MPI_SUBVERSION, - 0, "", 0, ""); - ompi_info_out("MPI API", "mpi-api:version:full", tmp2); + tmp2 = opal_info_make_version_str(scope, + MPI_VERSION, MPI_SUBVERSION, + 0, "", 0, ""); + opal_info_out("MPI API", "mpi-api:version:full", tmp2); free(tmp2); - ompi_info_out("Ident string", "ident", OPAL_IDENT_STRING); + opal_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); - } - - if (NULL != mca_version) { - free(mca_version); - } - if (NULL != api_version) { - free(api_version); - } - if (NULL != component_version) { - free(component_version); - } -} - - -static char *make_version_str(const char *scope, - int major, int minor, int release, - const char *greek, - bool want_repo_rev, const char *repo) -{ - 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_repo_rev && NULL != repo) { - asprintf(&tmp, "%s%s", str, repo); - 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_repo)) { - str = strdup(repo); - } - - if (NULL == str) { - str = strdup(temp); - } - - return str; -} diff --git a/opal/runtime/Makefile.am b/opal/runtime/Makefile.am index f5312f85d8..ff606bb3f5 100644 --- a/opal/runtime/Makefile.am +++ b/opal/runtime/Makefile.am @@ -10,6 +10,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2012 Los Alamos National Security, LLC. +# All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,17 +21,23 @@ # This makefile.am does not stand on its own - it is included from opal/Makefile.am +AM_CFLAGS = \ + -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" + # Source code files -dist_pkgdata_DATA += runtime/help-opal-runtime.txt +dist_pkgdata_DATA += runtime/help-opal-runtime.txt \ + runtime/help-opal_info.txt headers += \ runtime/opal_progress.h \ runtime/opal.h \ - runtime/opal_cr.h + runtime/opal_cr.h \ + runtime/opal_info_support.h libopen_pal_la_SOURCES += \ runtime/opal_progress.c \ runtime/opal_finalize.c \ runtime/opal_init.c \ - runtime/opal_params.c \ - runtime/opal_cr.c + runtime/opal_params.c \ + runtime/opal_cr.c \ + runtime/opal_info_support.c diff --git a/ompi/tools/ompi_info/help-ompi_info.txt b/opal/runtime/help-opal_info.txt similarity index 100% rename from ompi/tools/ompi_info/help-ompi_info.txt rename to opal/runtime/help-opal_info.txt diff --git a/opal/runtime/opal_info_support.c b/opal/runtime/opal_info_support.c new file mode 100644 index 0000000000..2b8a2a588a --- /dev/null +++ b/opal/runtime/opal_info_support.c @@ -0,0 +1,1267 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 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-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2011-2012 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include +#include + +#include "opal/class/opal_list.h" +#include "opal/class/opal_pointer_array.h" + +#include "opal/util/output.h" +#include "opal/util/cmd_line.h" +#include "opal/util/error.h" +#include "opal/util/argv.h" +#include "opal/util/show_help.h" +#include "opal/runtime/opal.h" +#include "opal/dss/dss.h" + +#include "opal/mca/installdirs/installdirs.h" +#include "opal/mca/event/base/base.h" +#include "opal/mca/base/base.h" +#include "opal/mca/backtrace/base/base.h" +#include "opal/mca/shmem/base/base.h" +#include "opal/mca/memory/base/base.h" +#include "opal/mca/memchecker/base/base.h" +#include "opal/mca/timer/base/base.h" +#include "opal/mca/installdirs/base/base.h" +#include "opal/mca/hwloc/base/base.h" +#if OPAL_ENABLE_FT_CR == 1 +#include "opal/mca/crs/base/base.h" +#include "opal/mca/compress/base/base.h" +#endif +#include "opal/mca/if/base/base.h" + +#include "opal/runtime/opal_info_support.h" + +const char *opal_info_path_prefix = "prefix"; +const char *opal_info_path_bindir = "bindir"; +const char *opal_info_path_libdir = "libdir"; +const char *opal_info_path_incdir = "incdir"; +const char *opal_info_path_mandir = "mandir"; +const char *opal_info_path_pkglibdir = "pkglibdir"; +const char *opal_info_path_sysconfdir = "sysconfdir"; +const char *opal_info_path_exec_prefix = "exec_prefix"; +const char *opal_info_path_sbindir = "sbindir"; +const char *opal_info_path_libexecdir = "libexecdir"; +const char *opal_info_path_datarootdir = "datarootdir"; +const char *opal_info_path_datadir = "datadir"; +const char *opal_info_path_sharedstatedir = "sharedstatedir"; +const char *opal_info_path_localstatedir = "localstatedir"; +const char *opal_info_path_infodir = "infodir"; +const char *opal_info_path_pkgdatadir = "pkgdatadir"; +const char *opal_info_path_pkgincludedir = "pkgincludedir"; + +bool opal_info_pretty = true; + +const char *opal_info_type_all = "all"; +const char *opal_info_type_opal = "opal"; +const char *opal_info_component_all = "all"; +const char *opal_info_param_all = "all"; + +const char *opal_info_ver_full = "full"; +const char *opal_info_ver_major = "major"; +const char *opal_info_ver_minor = "minor"; +const char *opal_info_ver_release = "release"; +const char *opal_info_ver_greek = "greek"; +const char *opal_info_ver_repo = "repo"; + +const char *opal_info_ver_all = "all"; +const char *opal_info_ver_mca = "mca"; +const char *opal_info_ver_type = "type"; +const char *opal_info_ver_component = "component"; + + +static void component_map_construct(opal_info_component_map_t *map) +{ + map->type = NULL; +} +static void component_map_destruct(opal_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(opal_info_component_map_t, + opal_list_item_t, + component_map_construct, + component_map_destruct); + +int opal_info_init(int argc, char **argv, + opal_cmd_line_t *opal_info_cmd_line) +{ + int ret; + bool want_help = false; + bool cmd_error = false; + char **app_env = NULL, **global_env = NULL; + + /* Initialize the argv parsing handle */ + if (OPAL_SUCCESS != opal_init_util(&argc, &argv)) { + opal_show_help("help-opal_info.txt", "lib-call-fail", true, + "opal_init_util", __FILE__, __LINE__, NULL); + exit(ret); + } + + /* add the cmd line options */ + opal_cmd_line_make_opt3(opal_info_cmd_line, 'v', NULL, "version", 2, + "Show version of Open MPI or a component. The first parameter can be a keyword [\"ompi\" | \"orte\" | \"opal\" | \"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(opal_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(opal_info_cmd_line, '\0', NULL, "params", 2, + "Synonym for --param"); + opal_cmd_line_make_opt3(opal_info_cmd_line, '\0', NULL, "internal", 0, + "Show internal MCA parameters (not meant to be modified by users)"); + opal_cmd_line_make_opt3(opal_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, all"); + opal_cmd_line_make_opt3(opal_info_cmd_line, '\0', NULL, "arch", 0, + "Show architecture Open MPI was compiled on"); + opal_cmd_line_make_opt3(opal_info_cmd_line, 'c', NULL, "config", 0, + "Show configuration options"); + opal_cmd_line_make_opt3(opal_info_cmd_line, 'h', NULL, "help", 0, + "Show this help message"); + opal_cmd_line_make_opt3(opal_info_cmd_line, '\0', NULL, "pretty-print", 0, + "When used in conjunction with other parameters, the output is displayed in 'pretty-print' format (default)"); + opal_cmd_line_make_opt3(opal_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(opal_info_cmd_line, '\0', NULL, "parseable", 0, + "Synonym for --parsable"); + opal_cmd_line_make_opt3(opal_info_cmd_line, '\0', NULL, "hostname", 0, + "Show the hostname that Open MPI was configured and built on"); + opal_cmd_line_make_opt3(opal_info_cmd_line, 'a', NULL, "all", 0, + "Show all configuration options and MCA parameters"); + + /* set our threading level */ + opal_set_using_threads(false); + + /* Get MCA parameters, if any */ + if( OPAL_SUCCESS != mca_base_open() ) { + opal_show_help("help-opal_info.txt", "lib-call-fail", true, "mca_base_open", __FILE__, __LINE__ ); + opal_finalize_util(); + return OPAL_ERROR; + } + mca_base_cmd_line_setup(opal_info_cmd_line); + + /* Initialize the opal_output system */ + if (!opal_output_init()) { + return OPAL_ERROR; + } + + /* Do the parsing */ + ret = opal_cmd_line_parse(opal_info_cmd_line, false, argc, argv); + if (OPAL_SUCCESS != ret) { + cmd_error = true; + if (OPAL_ERR_SILENT != ret) { + fprintf(stderr, "%s: command line error (%s)\n", argv[0], + opal_strerror(ret)); + } + } + if (!cmd_error && + (opal_cmd_line_is_taken(opal_info_cmd_line, "help") || + opal_cmd_line_is_taken(opal_info_cmd_line, "h"))) { + char *str, *usage; + + want_help = true; + usage = opal_cmd_line_get_usage_msg(opal_info_cmd_line); + str = opal_show_help_string("help-opal_info.txt", "usage", + true, usage); + if (NULL != str) { + printf("%s", str); + free(str); + } + free(usage); + } + + /* If we had a cmd line parse error, or we showed the help + message, it's time to exit. */ + if (cmd_error || want_help) { + mca_base_close(); + OBJ_RELEASE(opal_info_cmd_line); + opal_finalize_util(); + exit(cmd_error ? 1 : 0); + } + + mca_base_cmd_line_process_args(opal_info_cmd_line, &app_env, &global_env); + + + /* set the flags */ + if (opal_cmd_line_is_taken(opal_info_cmd_line, "pretty-print")) { + opal_info_pretty = true; + } else if (opal_cmd_line_is_taken(opal_info_cmd_line, "parsable") || opal_cmd_line_is_taken(opal_info_cmd_line, "parseable")) { + opal_info_pretty = false; + } + + return OPAL_SUCCESS; +} + +void opal_info_finalize(void) +{ + mca_base_close(); + opal_finalize_util(); +} + +void opal_info_register_types(opal_pointer_array_t *mca_types) +{ + opal_pointer_array_add(mca_types, "backtrace"); +#if OPAL_ENABLE_FT_CR == 1 + opal_cr_set_enabled(true); + opal_pointer_array_add(mca_types, "compress"); + opal_pointer_array_add(mca_types, "crs"); +#endif + opal_pointer_array_add(mca_types, "event"); + opal_pointer_array_add(mca_types, "filter"); + opal_pointer_array_add(mca_types, "hwloc"); + opal_pointer_array_add(mca_types, "if"); + opal_pointer_array_add(mca_types, "installdirs"); + opal_pointer_array_add(mca_types, "mca"); + opal_pointer_array_add(mca_types, "memchecker"); + opal_pointer_array_add(mca_types, "memory"); + opal_pointer_array_add(mca_types, "opal"); + opal_pointer_array_add(mca_types, "shmem"); + opal_pointer_array_add(mca_types, "timer"); + +} + +int opal_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map) +{ + opal_info_component_map_t *map; + char *env, *str; + int i; + char *target, *save, *type; + char **env_save=NULL; + + /* 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); + } + free(env); + } + + /* some components require the event library be active, so activate it */ + if (OPAL_SUCCESS != opal_event_base_open()) { + str = "opal_event_base_open"; + goto error; + } + + /* Open the DSS */ + if (OPAL_SUCCESS != opal_dss_open()) { + str = "Unable to initialize the DSS"; + goto error; + } + + /* Register the OPAL layer's MCA parameters */ + if (OPAL_SUCCESS != opal_register_params()) { + str = "opal_register_params failed"; + goto error; + } + + /* OPAL frameworks */ + + if (OPAL_SUCCESS != opal_backtrace_base_open()) { + str = "backtrace open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("backtrace"); + map->components = &opal_backtrace_base_components_opened; + opal_pointer_array_add(component_map, map); + +#if OPAL_ENABLE_FT_CR == 1 + if (OPAL_SUCCESS != opal_compress_base_open()) { + str = "compress open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("compress"); + map->components = &opal_compress_base_components_available; + opal_pointer_array_add(component_map, map); + + if (OPAL_SUCCESS != opal_crs_base_open()) { + str = "crs open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("crs"); + map->components = &opal_crs_base_components_available; + opal_pointer_array_add(component_map, map); +#endif + + /* the event framework is already open - just get its components */ + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("event"); + map->components = &opal_event_components; + opal_pointer_array_add(component_map, map); + +#if OPAL_HAVE_HWLOC + if (OPAL_SUCCESS != opal_hwloc_base_open()) { + str = "hwloc open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("hwloc"); + map->components = &opal_hwloc_base_components; + opal_pointer_array_add(component_map, map); +#endif + + if (OPAL_SUCCESS != opal_if_base_open()) { + str = "if open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("if"); + map->components = &opal_if_components; + opal_pointer_array_add(component_map, map); + + /* OPAL's installdirs base open has already been called as part of + * opal_init_util() back in main(). + */ + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("installdirs"); + map->components = &opal_installdirs_components; + opal_pointer_array_add(component_map, map); + + if (OPAL_SUCCESS != opal_memory_base_open()) { + str = "memory open failed"; + goto error; + } + map = OBJ_NEW(opal_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()) { + str = "memchecker open failed"; + goto error; + } + map = OBJ_NEW(opal_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_shmem_base_open()) { + str = "shmem open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("shmem"); + map->components = &opal_shmem_base_components_opened; + opal_pointer_array_add(component_map, map); + + if (OPAL_SUCCESS != opal_timer_base_open()) { + str = "timer open failed"; + goto error; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("timer"); + map->components = &opal_timer_base_components_opened; + opal_pointer_array_add(component_map, map); + + /* Restore the environment to what it was before we started so that + * if users setenv OMPI_MCA_ 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]); + } + } + + return OPAL_SUCCESS; + + error: + fprintf(stderr, "opal_info_register: %s\n", str); + return OPAL_ERROR; +} + +void opal_info_close_components(void) +{ + (void) opal_backtrace_base_close(); + (void) opal_memory_base_close(); + (void) opal_memchecker_base_close(); + (void) opal_timer_base_close(); +#if OPAL_HAVE_HWLOC + (void) opal_hwloc_base_close(); +#endif +#if OPAL_ENABLE_FT_CR == 1 + (void) opal_crs_base_close(); +#endif + (void) opal_dss_close(); + (void) opal_event_base_close(); + + /* Do not call OPAL's installdirs close; it will be handled in + * opal_finalize_util(). + */ +} + +void opal_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); + opal_info_out(pretty, path, value); + free(pretty); + free(path); +} + +void opal_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) { + opal_info_show_path(opal_info_path_prefix, opal_install_dirs.prefix); + opal_info_show_path(opal_info_path_exec_prefix, opal_install_dirs.exec_prefix); + opal_info_show_path(opal_info_path_bindir, opal_install_dirs.bindir); + opal_info_show_path(opal_info_path_sbindir, opal_install_dirs.sbindir); + opal_info_show_path(opal_info_path_libdir, opal_install_dirs.libdir); + opal_info_show_path(opal_info_path_incdir, opal_install_dirs.includedir); + opal_info_show_path(opal_info_path_mandir, opal_install_dirs.mandir); + opal_info_show_path(opal_info_path_pkglibdir, opal_install_dirs.pkglibdir); + opal_info_show_path(opal_info_path_libexecdir, opal_install_dirs.libexecdir); + opal_info_show_path(opal_info_path_datarootdir, opal_install_dirs.datarootdir); + opal_info_show_path(opal_info_path_datadir, opal_install_dirs.datadir); + opal_info_show_path(opal_info_path_sysconfdir, opal_install_dirs.sysconfdir); + opal_info_show_path(opal_info_path_sharedstatedir, opal_install_dirs.sharedstatedir); + opal_info_show_path(opal_info_path_localstatedir, opal_install_dirs.localstatedir); + opal_info_show_path(opal_info_path_infodir, opal_install_dirs.infodir); + opal_info_show_path(opal_info_path_pkgdatadir, opal_install_dirs.pkgdatadir); + opal_info_show_path(opal_info_path_pkglibdir, opal_install_dirs.pkglibdir); + opal_info_show_path(opal_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(opal_info_path_prefix, scope)) { + opal_info_show_path(opal_info_path_prefix, opal_install_dirs.prefix); + } else if (0 == strcmp(opal_info_path_bindir, scope)) { + opal_info_show_path(opal_info_path_bindir, opal_install_dirs.bindir); + } else if (0 == strcmp(opal_info_path_libdir, scope)) { + opal_info_show_path(opal_info_path_libdir, opal_install_dirs.libdir); + } else if (0 == strcmp(opal_info_path_incdir, scope)) { + opal_info_show_path(opal_info_path_incdir, opal_install_dirs.includedir); + } else if (0 == strcmp(opal_info_path_mandir, scope)) { + opal_info_show_path(opal_info_path_mandir, opal_install_dirs.mandir); + } else if (0 == strcmp(opal_info_path_pkglibdir, scope)) { + opal_info_show_path(opal_info_path_pkglibdir, opal_install_dirs.pkglibdir); + } else if (0 == strcmp(opal_info_path_sysconfdir, scope)) { + opal_info_show_path(opal_info_path_sysconfdir, opal_install_dirs.sysconfdir); + } else if (0 == strcmp(opal_info_path_exec_prefix, scope)) { + opal_info_show_path(opal_info_path_exec_prefix, opal_install_dirs.exec_prefix); + } else if (0 == strcmp(opal_info_path_sbindir, scope)) { + opal_info_show_path(opal_info_path_sbindir, opal_install_dirs.sbindir); + } else if (0 == strcmp(opal_info_path_libexecdir, scope)) { + opal_info_show_path(opal_info_path_libexecdir, opal_install_dirs.libexecdir); + } else if (0 == strcmp(opal_info_path_datarootdir, scope)) { + opal_info_show_path(opal_info_path_datarootdir, opal_install_dirs.datarootdir); + } else if (0 == strcmp(opal_info_path_datadir, scope)) { + opal_info_show_path(opal_info_path_datadir, opal_install_dirs.datadir); + } else if (0 == strcmp(opal_info_path_sharedstatedir, scope)) { + opal_info_show_path(opal_info_path_sharedstatedir, opal_install_dirs.sharedstatedir); + } else if (0 == strcmp(opal_info_path_localstatedir, scope)) { + opal_info_show_path(opal_info_path_localstatedir, opal_install_dirs.localstatedir); + } else if (0 == strcmp(opal_info_path_infodir, scope)) { + opal_info_show_path(opal_info_path_infodir, opal_install_dirs.infodir); + } else if (0 == strcmp(opal_info_path_pkgdatadir, scope)) { + opal_info_show_path(opal_info_path_pkgdatadir, opal_install_dirs.pkgdatadir); + } else if (0 == strcmp(opal_info_path_pkgincludedir, scope)) { + opal_info_show_path(opal_info_path_pkgincludedir, opal_install_dirs.pkgincludedir); + } else { + char *usage = opal_cmd_line_get_usage_msg(cmd_line); + opal_show_help("help-opal_info.txt", "usage", true, usage); + free(usage); + exit(1); + } + } + } +} + +/* + * 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 opal_info_do_params(bool want_all_in, bool want_internal, + opal_pointer_array_t *mca_types, + opal_cmd_line_t *opal_info_cmd_line) +{ + int count; + char *type, *component, *str; + bool found; + int i; + bool want_all = false; + opal_list_t *info; + char *p; + + if (opal_cmd_line_is_taken(opal_info_cmd_line, "param")) { + p = "param"; + } else if (opal_cmd_line_is_taken(opal_info_cmd_line, "params")) { + p = "params"; + } else { + p = "foo"; /* should never happen, but protect against segfault */ + } + + 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(opal_info_cmd_line, p); + for (i = 0; i < count; ++i) { + type = opal_cmd_line_get_param(opal_info_cmd_line, p, (int)i, 0); + if (0 == strcmp(opal_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 = (char *)opal_pointer_array_get_item(mca_types, i))) { + continue; + } + opal_info_show_mca_params(info, type, opal_info_component_all, want_internal); + } + } else { + for (i = 0; i < count; ++i) { + type = opal_cmd_line_get_param(opal_info_cmd_line, p, (int)i, 0); + component = opal_cmd_line_get_param(opal_info_cmd_line, p, (int)i, 1); + + for (found = false, i = 0; i < mca_types->size; ++i) { + if (NULL == (str = (char *)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(opal_info_cmd_line); + opal_show_help("help-opal_info.txt", "not-found", true, type); + free(usage); + exit(1); + } + + opal_info_show_mca_params(info, type, component, want_internal); + } + } + + /* Release all the MCA param memory */ + mca_base_param_dump_release(info); +} + +void opal_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, opal_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 *("~/" -> + * "/") 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 opal_info_output. */ + + if (opal_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; + opal_info_out(message, message, content); + free(message); + free(content); + + /* If we have a help message, opal_info_output it */ + if (NULL != p->mbpp_help_msg) { + opal_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); + opal_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; + } + opal_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"; + opal_info_out(message, message, content); + free(message); + + /* If it has a help message, opal_info_output that */ + + if (NULL != p->mbpp_help_msg) { + asprintf(&message, "%shelp", tmp); + content = p->mbpp_help_msg; + opal_info_out(message, message, content); + free(message); + } + + /* Is this parameter deprecated? */ + asprintf(&message, "%sdeprecated", tmp); + content = p->mbpp_deprecated ? "yes" : "no"; + opal_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; + opal_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; + opal_info_out(message, message, content); + free(message); + } + } + + /* If we allocated the string, then free it */ + + if (NULL != value_string) { + free(value_string); + } + } + } + } +} + + + +void opal_info_do_arch() +{ + opal_info_out("Configured architecture", "config:arch", OPAL_ARCH); +} + + +void opal_info_do_hostname() +{ + opal_info_out("Configure host", "config:host", OPAL_CONFIGURE_HOST); +} + + +/* + * 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 opal_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, *v_to_free; + +#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 = v_to_free = 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_to_free); + v_to_free = 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 + 1] = '\0'; + } + + if (opal_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-opal_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); + } + } + if (NULL != v_to_free) { + free(v_to_free); + } +} + +void opal_info_out_int(const char *pretty_message, + const char *plain_message, + int value) +{ + char *valstr; + + asprintf(&valstr, "%d", (int)value); + opal_info_out(pretty_message, plain_message, valstr); + free(valstr); +} + +/* + * Show all the components of a specific type/component combo (component may be + * a wildcard) + */ +void opal_info_show_component_version(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map, + 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; + opal_info_component_map_t *map; + + /* see if all components wanted */ + if (0 == strcmp(opal_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 = (opal_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)) { + opal_info_show_mca_version(component, scope, ver_type); + } + } + } + } +} + + +/* + * Given a component, display its relevant version(s) + */ +void opal_info_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, opal_info_ver_all) || + 0 == strcmp(ver_type, opal_info_ver_mca)) { + want_mca = true; + } + + if (0 == strcmp(ver_type, opal_info_ver_all) || + 0 == strcmp(ver_type, opal_info_ver_type)) { + want_type = true; + } + + if (0 == strcmp(ver_type, opal_info_ver_all) || + 0 == strcmp(ver_type, opal_info_ver_component)) { + want_component = true; + } + + mca_version = opal_info_make_version_str(scope, component->mca_major_version, + component->mca_minor_version, + component->mca_release_version, "", + false, ""); + api_version = opal_info_make_version_str(scope, component->mca_type_major_version, + component->mca_type_minor_version, + component->mca_type_release_version, "", + false, ""); + component_version = opal_info_make_version_str(scope, component->mca_component_major_version, + component->mca_component_minor_version, + component->mca_component_release_version, + "", false, ""); + if (opal_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; + } + + opal_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); + opal_info_out(NULL, message, tmp); + free(tmp); + } + if (want_type) { + asprintf(&tmp, "api:%s", api_version); + opal_info_out(NULL, message, tmp); + free(tmp); + } + if (want_component) { + asprintf(&tmp, "component:%s", component_version); + opal_info_out(NULL, message, tmp); + free(tmp); + } + free(message); + } + + if (NULL != mca_version) { + free(mca_version); + } + if (NULL != api_version) { + free(api_version); + } + if (NULL != component_version) { + free(component_version); + } +} + + +char *opal_info_make_version_str(const char *scope, + int major, int minor, int release, + const char *greek, + bool want_repo_rev, const char *repo) +{ + char *str = NULL, *tmp; + char temp[BUFSIZ]; + + temp[BUFSIZ - 1] = '\0'; + if (0 == strcmp(scope, opal_info_ver_full) || + 0 == strcmp(scope, opal_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_repo_rev && NULL != repo) { + asprintf(&tmp, "%s%s", str, repo); + free(str); + str = tmp; + } + } else if (0 == strcmp(scope, opal_info_ver_major)) { + snprintf(temp, BUFSIZ - 1, "%d", major); + } else if (0 == strcmp(scope, opal_info_ver_minor)) { + snprintf(temp, BUFSIZ - 1, "%d", minor); + } else if (0 == strcmp(scope, opal_info_ver_release)) { + snprintf(temp, BUFSIZ - 1, "%d", release); + } else if (0 == strcmp(scope, opal_info_ver_greek)) { + str = strdup(greek); + } else if (0 == strcmp(scope, opal_info_ver_repo)) { + str = strdup(repo); + } + + if (NULL == str) { + str = strdup(temp); + } + + return str; +} + +void opal_info_show_opal_version(const char *scope) +{ + char *tmp, *tmp2; + + asprintf(&tmp, "%s:version:full", opal_info_type_opal); + tmp2 = opal_info_make_version_str(scope, + OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, + OPAL_RELEASE_VERSION, + OPAL_GREEK_VERSION, + OPAL_WANT_REPO_REV, OPAL_REPO_REV); + opal_info_out("OPAL", tmp, tmp2); + free(tmp); + free(tmp2); + asprintf(&tmp, "%s:version:repo", opal_info_type_opal); + opal_info_out("OPAL repo revision", tmp, OPAL_REPO_REV); + free(tmp); + asprintf(&tmp, "%s:version:release_date", opal_info_type_opal); + opal_info_out("OPAL release date", tmp, OPAL_RELEASE_DATE); + free(tmp); +} diff --git a/opal/runtime/opal_info_support.h b/opal/runtime/opal_info_support.h new file mode 100644 index 0000000000..20befb76ae --- /dev/null +++ b/opal/runtime/opal_info_support.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2012 Los Alamos National Security, LLC. + * All rights reserved. +* $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file **/ + +#ifndef OPAL_INFO_REGISTER_H +#define OPAL_INFO_REGISTER_H + +#include "opal_config.h" + +#include "opal/class/opal_list.h" +#include "opal/class/opal_pointer_array.h" +#include "opal/util/cmd_line.h" +#include "opal/mca/base/base.h" + +BEGIN_C_DECLS + +extern const char *opal_info_path_prefix; + +extern const char *opal_info_type_all; +extern const char *opal_info_type_opal; +extern const char *opal_info_component_all; +extern const char *opal_info_param_all; + +extern const char *opal_info_ver_full; +extern const char *opal_info_ver_major; +extern const char *opal_info_ver_minor; +extern const char *opal_info_ver_release; +extern const char *opal_info_ver_greek; +extern const char *opal_info_ver_repo; + +extern const char *opal_info_ver_all; +extern const char *opal_info_ver_mca; +extern const char *opal_info_ver_type; +extern const char *opal_info_ver_component; + + +/* + * Component-related functions + */ +typedef struct { + opal_list_item_t super; + char *type; + opal_list_t *components; +} opal_info_component_map_t; +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_component_map_t); + +END_C_DECLS + +OPAL_DECLSPEC int opal_info_init(int argc, char **argv, + opal_cmd_line_t *opal_info_cmd_line); + +OPAL_DECLSPEC void opal_info_finalize(void); + +OPAL_DECLSPEC void opal_info_register_types(opal_pointer_array_t *mca_types); + +OPAL_DECLSPEC int opal_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map); + +OPAL_DECLSPEC void opal_info_close_components(void); + +OPAL_DECLSPEC void opal_info_do_params(bool want_all_in, bool want_internal, + opal_pointer_array_t *mca_type, + opal_cmd_line_t *opal_info_cmd_line); + +OPAL_DECLSPEC void opal_info_show_path(const char *type, const char *value); + +OPAL_DECLSPEC void opal_info_do_path(bool want_all, opal_cmd_line_t *cmd_line); + +OPAL_DECLSPEC void opal_info_show_mca_params(opal_list_t *info, + const char *type, + const char *component, + bool want_internal); + +OPAL_DECLSPEC void opal_info_show_mca_version(const mca_base_component_t *component, + const char *scope, const char *ver_type); + +OPAL_DECLSPEC void opal_info_show_component_version(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map, + const char *type_name, + const char *component_name, + const char *scope, const char *ver_type); + +OPAL_DECLSPEC char *opal_info_make_version_str(const char *scope, + int major, int minor, int release, + const char *greek, + bool want_repo, const char *repo); + +OPAL_DECLSPEC void opal_info_show_opal_version(const char *scope); + +OPAL_DECLSPEC void opal_info_do_arch(void); + +OPAL_DECLSPEC void opal_info_do_hostname(void); + +OPAL_DECLSPEC void opal_info_out(const char *pretty_message, const char *plain_message, const char *value); + +OPAL_DECLSPEC void opal_info_out_int(const char *pretty_message, + const char *plain_message, + int value); + +#endif diff --git a/orte/runtime/Makefile.am b/orte/runtime/Makefile.am index 9853b8d266..c1875eab80 100644 --- a/orte/runtime/Makefile.am +++ b/orte/runtime/Makefile.am @@ -30,7 +30,11 @@ headers += \ runtime/orte_globals.h \ runtime/orte_quit.h \ runtime/runtime_internals.h \ - runtime/data_type_support/orte_dt_support.h + runtime/data_type_support/orte_dt_support.h \ + runtime/orte_wait.h \ + runtime/orte_cr.h \ + runtime/orte_data_server.h \ + runtime/orte_info_support.h libopen_rte_la_SOURCES += \ runtime/orte_finalize.c \ @@ -43,17 +47,8 @@ libopen_rte_la_SOURCES += \ runtime/data_type_support/orte_dt_print_fns.c \ runtime/data_type_support/orte_dt_packing_fns.c \ runtime/data_type_support/orte_dt_unpacking_fns.c \ - runtime/orte_mca_params.c - -if !ORTE_DISABLE_FULL_SUPPORT - -headers += \ - runtime/orte_wait.h \ - runtime/orte_cr.h \ - runtime/orte_data_server.h - -libopen_rte_la_SOURCES += \ + runtime/orte_mca_params.c \ runtime/orte_wait.c \ runtime/orte_cr.c \ - runtime/orte_data_server.c -endif + runtime/orte_data_server.c \ + runtime/orte_info_support.c diff --git a/orte/runtime/orte_info_support.c b/orte/runtime/orte_info_support.c new file mode 100644 index 0000000000..73011d0085 --- /dev/null +++ b/orte/runtime/orte_info_support.c @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 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-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2011-2012 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "orte_config.h" +#include "orte/constants.h" +#include "orte/types.h" + +#include "opal/class/opal_pointer_array.h" +#include "opal/runtime/opal_info_support.h" + +#include "orte/mca/db/base/base.h" +#include "orte/mca/errmgr/base/base.h" +#include "orte/mca/ess/base/base.h" +#include "orte/mca/grpcomm/base/base.h" +#include "orte/mca/iof/base/base.h" +#include "orte/mca/odls/base/base.h" +#include "orte/mca/oob/base/base.h" +#include "orte/mca/plm/base/base.h" +#include "orte/mca/ras/base/ras_private.h" +#include "orte/mca/rmaps/base/base.h" +#include "orte/mca/rml/base/base.h" +#include "orte/mca/routed/base/base.h" +#if OPAL_ENABLE_FT_CR == 1 +#include "orte/mca/snapc/base/base.h" +#include "orte/mca/sstore/base/base.h" +#endif +#if ORTE_ENABLE_SENSORS +#include "orte/mca/sensor/base/base.h" +#endif +#include "orte/mca/filem/base/base.h" +#include "orte/mca/state/base/base.h" +#include "orte/util/proc_info.h" +#include "orte/runtime/runtime.h" + +#include "orte/runtime/orte_info_support.h" + +const char *orte_info_type_orte = "orte"; + +void orte_info_register_types(opal_pointer_array_t *mca_types) +{ + /* frameworks */ + opal_pointer_array_add(mca_types, "db"); + opal_pointer_array_add(mca_types, "errmgr"); + opal_pointer_array_add(mca_types, "ess"); + opal_pointer_array_add(mca_types, "filem"); + opal_pointer_array_add(mca_types, "grpcomm"); + opal_pointer_array_add(mca_types, "iof"); + opal_pointer_array_add(mca_types, "odls"); + opal_pointer_array_add(mca_types, "oob"); + opal_pointer_array_add(mca_types, "orte"); + opal_pointer_array_add(mca_types, "plm"); + 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"); +#if ORTE_ENABLE_SENSORS + opal_pointer_array_add(mca_types, "sensor"); +#endif +#if OPAL_ENABLE_FT_CR == 1 + opal_pointer_array_add(mca_types, "snapc"); + opal_pointer_array_add(mca_types, "sstore"); +#endif + opal_pointer_array_add(mca_types, "state"); +} + +int orte_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map) +{ + opal_info_component_map_t *map; + char *env, *str; + int i; + char *target, *save, *type; + char **env_save=NULL; + + /* 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); + } + free(env); + } + + /* Set orte_process_info.proc_type to HNP to force all frameworks to + * open components + */ + orte_process_info.proc_type = ORTE_PROC_HNP; + + /* Register the ORTE layer's MCA parameters */ + + if (ORTE_SUCCESS != orte_register_params()) { + return ORTE_ERROR; + } + + if (ORTE_SUCCESS != orte_db_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("db"); + map->components = &orte_db_base.available_components; + opal_pointer_array_add(component_map, map); + + if (ORTE_SUCCESS != orte_errmgr_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_ess_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_filem_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("filem"); + map->components = &orte_filem_base_components_available; + opal_pointer_array_add(component_map, map); + + if (ORTE_SUCCESS != orte_grpcomm_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("grpcomm"); + map->components = &orte_grpcomm_base.components_available; + opal_pointer_array_add(component_map, map); + + if (ORTE_SUCCESS != orte_iof_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_odls_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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 != mca_oob_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_plm_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("plm"); + map->components = &orte_plm_base.available_components; + opal_pointer_array_add(component_map, map); + + if (ORTE_SUCCESS != orte_ras_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_routed_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_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_rml_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("rml"); + map->components = &orte_rml_base_components; + opal_pointer_array_add(component_map, map); + +#if ORTE_ENABLE_SENSORS + if (ORTE_SUCCESS != orte_sensor_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("sensor"); + map->components = &mca_sensor_base_components_available; + opal_pointer_array_add(component_map, map); +#endif + +#if OPAL_ENABLE_FT_CR == 1 + if (ORTE_SUCCESS != orte_snapc_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("snapc"); + map->components = &orte_snapc_base_components_available; + opal_pointer_array_add(component_map, map); + + if (ORTE_SUCCESS != orte_sstore_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("sstore"); + map->components = &orte_sstore_base_components_available; + opal_pointer_array_add(component_map, map); +#endif + + if (ORTE_SUCCESS != orte_state_base_open()) { + return ORTE_ERROR; + } + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup("state"); + map->components = &orte_state_base_components_available; + opal_pointer_array_add(component_map, map); + + /* Restore the environment to what it was before we started so that + * if users setenv OMPI_MCA_ 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]); + } + } + return ORTE_SUCCESS; +} + +void orte_info_close_components(void) +{ + (void) orte_db_base_close(); + (void) orte_errmgr_base_close(); + (void) orte_ess_base_close(); + (void) orte_filem_base_close(); + (void) orte_grpcomm_base_close(); + (void) orte_iof_base_close(); + (void) orte_odls_base_close(); + (void) mca_oob_base_close(); + (void) orte_plm_base_close(); + (void) orte_ras_base_close(); + (void) orte_rmaps_base_close(); + (void) orte_rml_base_close(); + (void) orte_routed_base_close(); +#if OPAL_ENABLE_FT_CR == 1 + (void) orte_snapc_base_close(); + (void) orte_sstore_base_close(); +#endif + (void) orte_state_base_close(); +} + +void orte_info_show_orte_version(const char *scope) +{ + char *tmp, *tmp2; + + asprintf(&tmp, "%s:version:full", orte_info_type_orte); + tmp2 = opal_info_make_version_str(scope, + ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, + ORTE_RELEASE_VERSION, + ORTE_GREEK_VERSION, + ORTE_WANT_REPO_REV, ORTE_REPO_REV); + opal_info_out("Open RTE", tmp, tmp2); + free(tmp); + free(tmp2); + asprintf(&tmp, "%s:version:repo", orte_info_type_orte); + opal_info_out("Open RTE repo revision", tmp, ORTE_REPO_REV); + free(tmp); + asprintf(&tmp, "%s:version:release_date", orte_info_type_orte); + opal_info_out("Open RTE release date", tmp, ORTE_RELEASE_DATE); + free(tmp); +} + diff --git a/orte/runtime/orte_info_support.h b/orte/runtime/orte_info_support.h new file mode 100644 index 0000000000..abe93155fd --- /dev/null +++ b/orte/runtime/orte_info_support.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 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-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2011-2012 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef ORTE_INFO_REGISTER_H +#define ORTE_INFO_REGISTER_H + +#include "orte_config.h" + +#include "opal/class/opal_pointer_array.h" + +extern const char *orte_info_type_orte; + +ORTE_DECLSPEC void orte_info_register_types(opal_pointer_array_t *mca_types); + +ORTE_DECLSPEC int orte_info_register_components(opal_pointer_array_t *mca_types, + opal_pointer_array_t *component_map); + +ORTE_DECLSPEC void orte_info_close_components(void); + +ORTE_DECLSPEC void orte_info_show_orte_version(const char *scope); + +#endif