diff --git a/ompi/tools/ompi_info/components.c b/ompi/tools/ompi_info/components.c index cd7e8c7e3a..c557653633 100644 --- a/ompi/tools/ompi_info/components.c +++ b/ompi/tools/ompi_info/components.c @@ -51,8 +51,7 @@ #include "opal/mca/timer/base/base.h" #include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/base/base.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/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" @@ -344,14 +343,16 @@ void ompi_info_open_components(void) map->components = &opal_maffinity_base_components_opened; opal_pointer_array_add(&component_map, map); - if (OPAL_SUCCESS != opal_sysinfo_base_open()) { +#if OPAL_HAVE_HWLOC + if (OPAL_SUCCESS != opal_hwloc_base_open()) { goto error; } map = OBJ_NEW(ompi_info_component_map_t); - map->type = strdup("sysinfo"); - map->components = &opal_sysinfo_base_components_opened; + map->type = strdup("hwloc"); + map->components = &opal_hwloc_components; opal_pointer_array_add(&component_map, map); - +#endif + if (OPAL_SUCCESS != opal_timer_base_open()) { goto error; } @@ -827,7 +828,9 @@ void ompi_info_close_components() (void) opal_carto_base_close(); (void) opal_maffinity_base_close(); (void) opal_timer_base_close(); - (void) opal_sysinfo_base_close(); +#if OPAL_HAVE_HWLOC + (void) opal_hwloc_base_close(); +#endif #if OPAL_ENABLE_FT_CR == 1 (void) opal_crs_base_close(); #endif diff --git a/ompi/tools/ompi_info/ompi_info.c b/ompi/tools/ompi_info/ompi_info.c index 30ff420c2c..ac3b6d2c70 100644 --- a/ompi/tools/ompi_info/ompi_info.c +++ b/ompi/tools/ompi_info/ompi_info.c @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) opal_pointer_array_add(&mca_types, "maffinity"); opal_pointer_array_add(&mca_types, "timer"); opal_pointer_array_add(&mca_types, "installdirs"); - opal_pointer_array_add(&mca_types, "sysinfo"); + 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"); diff --git a/opal/dss/dss_types.h b/opal/dss/dss_types.h index 15b857006f..efbe768221 100644 --- a/opal/dss/dss_types.h +++ b/opal/dss/dss_types.h @@ -71,6 +71,7 @@ typedef struct { #define OPAL_DATA_VALUE (opal_data_type_t) 19 /**< data value */ #define OPAL_PSTAT (opal_data_type_t) 20 /**< process statistics */ #define OPAL_NODE_STAT (opal_data_type_t) 21 /**< node statistics */ +#define OPAL_HWLOC_TOPO (opal_data_type_t) 22 /**< hwloc topology */ #define OPAL_DSS_ID_DYNAMIC (opal_data_type_t) 30 diff --git a/opal/mca/common/hwloc/Makefile.am b/opal/mca/common/hwloc/Makefile.am deleted file mode 100644 index 1a35798ad3..0000000000 --- a/opal/mca/common/hwloc/Makefile.am +++ /dev/null @@ -1,80 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -SUBDIRS = -if OPAL_COMMON_HWLOC_INTERNAL -SUBDIRS += hwloc -endif - -# Need to include these files so that these directories are carried in -# the tarball (in case someone invokes autogen.sh on a dist tarball). -EXTRA_DIST = \ - hwloc/doc/README.txt \ - hwloc/tests/README.txt \ - hwloc/utils/README.txt - -# Headers and sources -headers = common_hwloc.h -sources = common_hwloc.c - -# See a lengthy explanation of "common" component Makefile.ams in -# ompi/mca/common/sm/Makefile.am. - -lib_LTLIBRARIES = -noinst_LTLIBRARIES = -comp_inst = libmca_common_hwloc.la -comp_noinst = libmca_common_hwloc_noinst.la - -if MCA_BUILD_opal_common_hwloc_DSO -lib_LTLIBRARIES += $(comp_inst) -else -noinst_LTLIBRARIES += $(comp_noinst) -endif - -libmca_common_hwloc_la_SOURCES = $(headers) $(sources) -libmca_common_hwloc_la_LDFLAGS = \ - -version-info $(libmca_opal_common_hwloc_so_version) \ - $(opal_common_hwloc_LDFLAGS) -libmca_common_hwloc_la_LIBADD = $(opal_common_hwloc_LIBS) - -libmca_common_hwloc_noinst_la_SOURCES = $(headers) $(sources) -libmca_common_hwloc_noinst_la_LDFLAGS = $(opal_common_hwloc_LDFLAGS) -libmca_common_hwloc_noinst_la_LIBADD = $(opal_common_hwloc_LIBS) - -# Conditionally install the header files - -if WANT_INSTALL_HEADERS -ompidir = $(includedir)/openmpi/$(subdir) -ompi_HEADERS = $(headers) -endif - -# These two rules will sym link the "noinst" libtool library filename -# to the installable libtool library filename in the case where we are -# compiling this component statically - -all-local: - if test -z "$(lib_LTLIBRARIES)"; then \ - rm -f "$(comp_inst)"; \ - $(LN_S) "$(comp_noinst)" "$(comp_inst)"; \ - fi - -clean-local: - if test -z "$(lib_LTLIBRARIES)"; then \ - rm -f "$(comp_inst)"; \ - fi diff --git a/opal/mca/common/hwloc/common_hwloc.c b/opal/mca/common/hwloc/common_hwloc.c deleted file mode 100644 index 1c86770941..0000000000 --- a/opal/mca/common/hwloc/common_hwloc.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - */ - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/mca/common/hwloc/common_hwloc.h" -#include "opal/mca/base/mca_base_param.h" - - -static bool already_registered = false; - - -int opal_common_hwloc_register(void) -{ - if (already_registered) { - return OPAL_SUCCESS; - } - - /* Register an MCA info param containing the underlying hwloc - version */ - mca_base_param_reg_string_name("common", "hwloc_version", - "Version of underlying hwloc", - false, true, COMMON_HWLOC_HWLOC_VERSION, - NULL); - - already_registered = true; - return OPAL_SUCCESS; -} - - diff --git a/opal/mca/common/hwloc/common_hwloc.h b/opal/mca/common/hwloc/common_hwloc.h deleted file mode 100644 index c492287fa4..0000000000 --- a/opal/mca/common/hwloc/common_hwloc.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - */ - -#ifndef OPAL_COMMON_HWLOC_H -#define OPAL_COMMON_HWLOC_H - -#include "opal_config.h" - -/* - * Function for registering the MCA params for this common component - */ -OPAL_DECLSPEC int opal_common_hwloc_register(void); - - -#endif /* OPAL_COMMON_HWLOC_H */ diff --git a/opal/mca/common/hwloc/configure.m4 b/opal/mca/common/hwloc/configure.m4 deleted file mode 100644 index 0bf9e35ae7..0000000000 --- a/opal/mca/common/hwloc/configure.m4 +++ /dev/null @@ -1,192 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This configure.m4 script outputs several things: -# -# 1. The $opal_common_hwloc_support shell variable will be set to "yes" -# or "no". Since the common framework is guaranteed to be processed -# by configure first (before all other frameworks), components that -# depend on hwloc can simply check the value of -# $opal_check_hwloc_support to know if this common framework will be -# built or not. -# -# 2. Similarly, OPAL_COMMON_HWLOC_SUPPORT is an AM_CONDITIONAL; it'll be -# true if $opal_common_hwloc_support is "yes". -# -# 3. Similarly, OPAL_COMMON_HWLOC_SUPPORT is AC_DEFINE'd to 0 or 1. -# -# 4. The following values are AC_SUBSTed and can be used in -# components' Makefile.ams: -# opal_common_hwloc_CFLAGS -# opal_common_hwloc_CPPFLAGS -# opal_common_hwloc_LDFLAGS -# opal_common_hwloc_LIBS -# - -# Include hwloc m4 files -m4_include(opal/mca/common/hwloc/hwloc/config/hwloc.m4) -m4_include(opal/mca/common/hwloc/hwloc/config/hwloc_pkg.m4) -m4_include(opal/mca/common/hwloc/hwloc/config/hwloc_check_attributes.m4) -m4_include(opal/mca/common/hwloc/hwloc/config/hwloc_check_visibility.m4) - -# MCA_common_hwloc_POST_CONFIG() -# --------------------------------- -AC_DEFUN([MCA_opal_common_hwloc_POST_CONFIG],[ - AM_CONDITIONAL([OPAL_COMMON_HWLOC_SUPPORT], - [test "$opal_common_hwloc_support" = "yes"]) - AM_CONDITIONAL([OPAL_COMMON_HWLOC_INTERNAL], - [test "$opal_common_hwloc_support" = "yes" -a "$opal_common_hwloc_location" = "internal"]) - - HWLOC_DO_AM_CONDITIONALS -])dnl - - -# MCA_common_hwloc_CONFIG([action-if-found], [action-if-not-found]) -# -------------------------------------------------------------------- -AC_DEFUN([MCA_opal_common_hwloc_CONFIG],[ - AC_CONFIG_FILES([opal/mca/common/hwloc/Makefile]) - - OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_common_hwloc_save_CPPFLAGS opal_common_hwloc_save_LDFLAGS opal_common_hwloc_save_LIBS opal_common_hwloc_support_value opal_common_hwloc_save_xml opal_common_hwloc_save_cairo]) - - # Allowing building using either the internal copy of - # hwloc, or an external version. - AC_ARG_WITH([hwloc], - [AC_HELP_STRING([--with-hwloc(=DIR)], - [Build hwloc support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of hwloc. "external" forces Open MPI to use an external installation of hwloc. Supplying a valid directory name also forces Open MPI to use an external installation of hwloc, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries.])]) - - # Default to building the internal copy. After this, - # opal_common_hwloc_location is guaranteed to be set to one of: - # "internal", a directory name (i.e., whatever the user supplied), - # or "no". - opal_common_hwloc_location=$with_hwloc - AS_IF([test -z "$opal_common_hwloc_location" -o "$opal_common_hwloc_location" = "yes"], - [opal_common_hwloc_location=internal]) - - # Check the DIR value if it's a directory - case $opal_common_hwloc_location in - no|internal|external) ;; - *) OMPI_CHECK_WITHDIR([hwloc], [$opal_common_hwloc_location], [include/hwloc.h]) ;; - esac - - AC_ARG_WITH([hwloc-libdir], - [AC_HELP_STRING([--with-hwloc-libdir=DIR], - [Search for hwloc libraries in DIR. Should only be used if an external copy of hwloc is being used.])]) - AS_IF([test "$with_hwloc_libdir" = "internal" -a "$with_hwloc_libdir" != ""], - [AC_MSG_WARN([Both --with-hwloc=internal and --with-hwloc-libdir=DIR]) - AC_MSG_WARN([were specified, which does not make sense.]) - AC_MSG_ERROR([Cannot continue])]) - OMPI_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir], [libhwloc.*]) - - opal_common_hwloc_save_CPPFLAGS=$CPPFLAGS - opal_common_hwloc_save_LDFLAGS=$LDFLAGS - opal_common_hwloc_save_LIBS=$LIBS - - AS_IF([test "$opal_common_hwloc_location" != "no"], - [AC_MSG_CHECKING([where to look for hwloc])]) - - # If we're building internal, run the hwloc configuration. - AS_IF([test "$opal_common_hwloc_location" = "internal"], - [# Main hwloc configuration - AC_MSG_RESULT([internal copy]) - HWLOC_SET_SYMBOL_PREFIX([opal_common_]) - - # We don't want no stinkin' XML or graphical support - opal_common_hwloc_save_xml=$enable_xml - opal_common_hwloc_save_cairo=$enable_cairo - enable_xml=no - enable_cairo=no - - HWLOC_SETUP_CORE([opal/mca/common/hwloc/hwloc], - [AC_MSG_CHECKING([whether hwloc configure succeeded]) - AC_MSG_RESULT([yes]) - HWLOC_VERSION="internal v`$srcdir/opal/mca/common/hwloc/hwloc/config/hwloc_get_version.sh $srcdir/opal/mca/common/hwloc/hwloc/VERSION`" - - # Add flags to the wrappers for static builds. - # Note that we don't add the project name to the - # wrapper extra flags. :-( - common_hwloc_WRAPPER_EXTRA_LIBS=$HWLOC_EMBEDDED_LIBS - - opal_common_hwloc_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)' - opal_common_hwloc_LIBS='$(top_ompi_builddir)/opal/mca/common/hwloc/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)' - opal_common_hwloc_support=yes], - [AC_MSG_CHECKING([whether hwloc configure succeeded]) - AC_MSG_RESULT([no]) - opal_common_hwloc_support=no]) - - # Restore some env variables, if necessary - AS_IF([test -n "$opal_common_hwloc_save_xml"], - [enable_xml=$opal_common_hwloc_save_xml]) - AS_IF([test -n "$opal_common_hwloc_save_cairo"], - [enable_cairo=$opal_common_hwloc_save_cairo]) - ]) - - # If we are not building internal, then run all the normal checks - AS_IF([test "$opal_common_hwloc_location" != "internal" -a "$opal_common_hwloc_location" != "no"], - [AS_IF([test ! -z "$opal_common_hwloc_location" -a "$opal_common_hwloc_location" != "yes" -a "$opal_common_hwloc_location" != "external"], - [opal_common_hwloc_dir=$opal_common_hwloc_location - AC_MSG_RESULT([external install ($opal_common_hwloc_location)])], - [AC_MSG_RESULT([external install (default search paths)])]) - AS_IF([test ! -z "$with_hwloc_libdir" -a "$with_hwloc_libdir" != "yes"], - [opal_common_hwloc_libdir="$with_hwloc_libdir"]) - AS_IF([test "$opal_common_hwloc_location" = no], - [opal_common_hwloc_support=no], - [opal_common_hwloc_support=yes]) - - HWLOC_VERSION=external - OMPI_CHECK_PACKAGE([opal_common_hwloc], - [hwloc.h], - [hwloc], - [hwloc_topology_init], - [], - [$opal_common_hwloc_dir], - [$opal_common_hwloc_libdir], - [opal_common_hwloc_support=yes], - [opal_common_hwloc_support=no]) - ]) - - CPPFLAGS=$opal_common_hwloc_save_CPPFLAGS - LDFLAGS=$opal_common_hwloc_save_LDFLAGS - LIBS=$opal_common_hwloc_save_LIBS - - AC_SUBST([opal_common_hwloc_CFLAGS]) - AC_SUBST([opal_common_hwloc_CPPFLAGS]) - AC_SUBST([opal_common_hwloc_LDFLAGS]) - AC_SUBST([opal_common_hwloc_LIBS]) - - # Done! - AS_IF([test "$opal_common_hwloc_support" = "yes"], - [AC_DEFINE_UNQUOTED([COMMON_HWLOC_HWLOC_VERSION], - ["$HWLOC_VERSION"], - [Version of hwloc]) - opal_common_hwloc_support_value=1 - $1], - [AS_IF([test ! -z "$with_hwloc" -a "$with_hwloc" != "no"], - [AC_MSG_WARN([hwloc support requested (via --with-hwloc) but not found.]) - AC_MSG_ERROR([Cannot continue.])]) - opal_common_hwloc_support_value=0 - $2]) - - AC_DEFINE_UNQUOTED([OPAL_COMMON_HWLOC_SUPPORT], - [$opal_common_hwloc_support_value], - [Whether opal/mca/common/hwloc was built or not]) - - OPAL_VAR_SCOPE_POP -])dnl - diff --git a/opal/mca/event/libevent207/libevent207_module.c b/opal/mca/event/libevent207/libevent207_module.c index 236527f2f7..19c88b9a91 100644 --- a/opal/mca/event/libevent207/libevent207_module.c +++ b/opal/mca/event/libevent207/libevent207_module.c @@ -4,7 +4,6 @@ */ #include "opal_config.h" #include "opal/constants.h" -#include "config.h" #ifdef HAVE_SYS_TYPES_H #include diff --git a/opal/mca/sysinfo/Makefile.am b/opal/mca/hwloc/Makefile.am similarity index 55% rename from opal/mca/sysinfo/Makefile.am rename to opal/mca/hwloc/Makefile.am index f04dbd46e5..6c393ac159 100644 --- a/opal/mca/sysinfo/Makefile.am +++ b/opal/mca/hwloc/Makefile.am @@ -1,6 +1,5 @@ # -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# All rights reserved. +# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -9,13 +8,12 @@ # # main library setup -noinst_LTLIBRARIES = libmca_sysinfo.la -libmca_sysinfo_la_SOURCES = +noinst_LTLIBRARIES = libmca_hwloc.la +libmca_hwloc_la_SOURCES = # local files -headers = sysinfo.h \ - sysinfo_types.h -libmca_sysinfo_la_SOURCES += $(headers) +headers = hwloc.h +libmca_hwloc_la_SOURCES += $(headers) # Conditionally install the header files if WANT_INSTALL_HEADERS diff --git a/opal/mca/hwloc/base/Makefile.am b/opal/mca/hwloc/base/Makefile.am new file mode 100644 index 0000000000..30d203c472 --- /dev/null +++ b/opal/mca/hwloc/base/Makefile.am @@ -0,0 +1,21 @@ +# +# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers += \ + base/base.h + +libmca_hwloc_la_SOURCES += \ + base/hwloc_base_close.c \ + base/hwloc_base_open.c + +if OPAL_HAVE_HWLOC +libmca_hwloc_la_SOURCES += \ + base/hwloc_base_dt.c +endif + diff --git a/opal/mca/hwloc/base/base.h b/opal/mca/hwloc/base/base.h new file mode 100644 index 0000000000..d266fbf219 --- /dev/null +++ b/opal/mca/hwloc/base/base.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OPAL_HWLOC_BASE_H +#define OPAL_HWLOC_BASE_H + +#include "opal_config.h" + +#include "opal/dss/dss_types.h" + +#include "opal/mca/hwloc/hwloc.h" + +/* + * Global functions for MCA overall hwloc open and close + */ + +BEGIN_C_DECLS + +/** + * Initialize the hwloc MCA framework + * + * @retval OPAL_SUCCESS Upon success + * @retval OPAL_ERROR Upon failure + * + * This must be the first function invoked in the hwloc MCA + * framework. It initializes the hwloc MCA framework, finds + * and opens hwloc components, etc. + * + * This function is invoked during opal_init(). + * + * This function fills in the internal global variable + * opal_hwloc_base_components_opened, which is a list of all + * hwloc components that were successfully opened. This + * variable should \em only be used by other hwloc base + * functions -- it is not considered a public interface member -- + * and is only mentioned here for completeness. + */ +OPAL_DECLSPEC int opal_hwloc_base_open(void); + +/** + * Shut down the hwloc MCA framework. + * + * @retval OPAL_SUCCESS Always + * + * This function shuts down everything in the hwloc MCA + * framework, and is called during opal_finalize(). + * + * It must be the last function invoked on the hwloc MCA + * framework. + */ +OPAL_DECLSPEC int opal_hwloc_base_close(void); + +/** + * Debugging output stream + */ +OPAL_DECLSPEC extern int opal_hwloc_base_output; +OPAL_DECLSPEC extern opal_list_t opal_hwloc_components; +OPAL_DECLSPEC extern bool opal_hwloc_base_inited; +OPAL_DECLSPEC extern bool opal_hwloc_topology_inited; + +#if OPAL_HAVE_HWLOC +/* datatype support */ +OPAL_DECLSPEC int opal_hwloc_pack(opal_buffer_t *buffer, const void *src, + int32_t num_vals, + opal_data_type_t type); +OPAL_DECLSPEC int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest, + int32_t *num_vals, + opal_data_type_t type); +OPAL_DECLSPEC int opal_hwloc_copy(hwloc_topology_t *dest, + hwloc_topology_t src, + opal_data_type_t type); +OPAL_DECLSPEC int opal_hwloc_compare(const hwloc_topology_t topo1, + const hwloc_topology_t topo2, + opal_data_type_t type); +OPAL_DECLSPEC int opal_hwloc_print(char **output, char *prefix, + hwloc_topology_t src, + opal_data_type_t type); +OPAL_DECLSPEC int opal_hwloc_size(size_t *size, + hwloc_topology_t src, + opal_data_type_t type); +OPAL_DECLSPEC void opal_hwloc_release(opal_dss_value_t *value); +#endif + +END_C_DECLS + +#endif /* OPAL_BASE_HWLOC_H */ diff --git a/opal/mca/hwloc/base/hwloc_base_close.c b/opal/mca/hwloc/base/hwloc_base_close.c new file mode 100644 index 0000000000..6904ac2fa1 --- /dev/null +++ b/opal/mca/hwloc/base/hwloc_base_close.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include "opal/constants.h" +#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" +#include "opal/mca/hwloc/hwloc.h" +#include "opal/mca/hwloc/base/base.h" + +int opal_hwloc_base_close(void) +{ + if (!opal_hwloc_base_inited) { + return OPAL_SUCCESS; + } + +#if OPAL_HAVE_HWLOC + { + opal_list_item_t *item; + + /* no need to close the component as it was statically opened */ + + /* for support of tools such as ompi_info */ + for (item = opal_list_remove_first(&opal_hwloc_components); + NULL != item; + item = opal_list_remove_first(&opal_hwloc_components)) { + OBJ_RELEASE(item); + } + OBJ_DESTRUCT(&opal_hwloc_components); + } +#endif + + /* All done */ + opal_hwloc_base_inited = false; + return OPAL_SUCCESS; +} diff --git a/opal/mca/hwloc/base/hwloc_base_dt.c b/opal/mca/hwloc/base/hwloc_base_dt.c new file mode 100644 index 0000000000..dad585d809 --- /dev/null +++ b/opal/mca/hwloc/base/hwloc_base_dt.c @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + */ + +#include "opal_config.h" +#include "opal/constants.h" + +#include "opal/dss/dss.h" +#include "opal/mca/hwloc/base/base.h" + +int opal_hwloc_pack(opal_buffer_t *buffer, const void *src, + int32_t num_vals, + opal_data_type_t type) +{ + /* NOTE: hwloc defines topology_t as a pointer to a struct! */ + hwloc_topology_t t, *tarray = (hwloc_topology_t*)src; + int rc, i; + char *xmlbuffer=NULL; + + for (i=0; i < num_vals; i++) { + t = tarray[i]; + +#if OPAL_HAVE_HWLOC_XML + { + int len; + + /* extract an xml-buffer representation of the tree */ + hwloc_topology_export_xmlbuffer(t, &xmlbuffer, &len); + } +#endif + + /* add to buffer */ + if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &xmlbuffer, 1, OPAL_STRING))) { + return rc; + } + + /* cleanup */ + if (NULL != xmlbuffer) { + free(xmlbuffer); + } + } + return OPAL_SUCCESS; +} + +int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest, + int32_t *num_vals, + opal_data_type_t type) +{ + /* NOTE: hwloc defines topology_t as a pointer to a struct! */ + hwloc_topology_t t, *tarray = (hwloc_topology_t*)dest; + int rc=OPAL_SUCCESS, i, cnt, j; + char *xmlbuffer=NULL; + + for (i=0, j=0; i < *num_vals; i++) { + /* unpack the xml string */ + cnt=1; + if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &xmlbuffer, &cnt, OPAL_STRING))) { + goto cleanup; + } + + /* convert the xml */ + hwloc_topology_init(&t); +#if OPAL_HAVE_HWLOC_XML + if (0 != (rc = hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer)))) { + hwloc_topology_destroy(t); + goto cleanup; + } + hwloc_topology_load(t); +#endif + if (NULL != xmlbuffer) { + free(xmlbuffer); + } + + /* pass it back */ + tarray[i] = t; + + /* track the number added */ + j++; + } + + cleanup: + *num_vals = j; + return rc; +} + +int opal_hwloc_copy(hwloc_topology_t *dest, hwloc_topology_t src, opal_data_type_t type) +{ +#if OPAL_HAVE_HWLOC_XML + char *xml; + int len; + + hwloc_topology_export_xmlbuffer(src, &xml, &len); + hwloc_topology_init(dest); + if (0 != hwloc_topology_set_xmlbuffer(*dest, xml, len)) { + hwloc_topology_destroy(*dest); + return OPAL_ERROR; + } + hwloc_topology_load(*dest); + free(xml); + return OPAL_SUCCESS; +#else + return OPAL_ERR_NOT_SUPPORTED; +#endif +} + +int opal_hwloc_compare(const hwloc_topology_t topo1, + const hwloc_topology_t topo2, + opal_data_type_t type) +{ + hwloc_topology_t t1, t2; + unsigned d1, d2; + + /* stop stupid compiler warnings */ + t1 = topo1; + t2 = topo2; + + /* do something quick first */ + d1 = hwloc_topology_get_depth(t1); + d2 = hwloc_topology_get_depth(t2); + if (d1 > d2) { + return OPAL_VALUE1_GREATER; + } else if (d2 > d1) { + return OPAL_VALUE2_GREATER; + } + +#if OPAL_HAVE_HWLOC_XML + { + char *x1=NULL, *x2=NULL; + int l1, l2; + int s; + + /* do the comparison the "cheat" way - get an xml representation + * of each tree, and strcmp! + */ + hwloc_topology_export_xmlbuffer(t1, &x1, &l1); + hwloc_topology_export_xmlbuffer(t2, &x2, &l2); + + s = strcmp(x1, x2); + free(x1); + free(x2); + if (s > 0) { + return OPAL_VALUE1_GREATER; + } else if (s < 0) { + return OPAL_VALUE2_GREATER; + } + } +#endif + + return OPAL_EQUAL; +} + +static void print_hwloc_obj(char **output, char *prefix, hwloc_obj_t obj) +{ + hwloc_obj_t obj2; + char string[1024], *tmp, *tmp2, *pfx; + unsigned i; + + /* print the object type */ + hwloc_obj_type_snprintf(string, 1024, obj, 1); + asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix); + asprintf(&tmp, "%sType: %s Number of child objects: %u\n%s\tName=%s%s", + (NULL == prefix) ? "" : prefix, string, obj->arity, + (NULL == prefix) ? "" : prefix, (NULL == obj->name) ? "NULL" : obj->name, pfx); + /* print the attributes */ + if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) { + asprintf(&tmp2, "%s%s", tmp, string); + free(tmp); + tmp = tmp2; + /* print the cpuset */ + hwloc_obj_cpuset_snprintf(string, 1024, 1, &obj); + asprintf(&tmp2, "%s%sCpuset: %s\n", tmp, pfx, string); + } else { + /* print the cpuset */ + hwloc_obj_cpuset_snprintf(string, 1024, 1, &obj); + asprintf(&tmp2, "%sCpuset: %s\n", tmp, string); + } + free(tmp); + tmp = tmp2; + asprintf(&tmp2, "%s%s", (NULL == *output) ? "" : *output, tmp); + free(tmp); + free(pfx); + asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix); + for (i=0; i < obj->arity; i++) { + obj2 = obj->children[i]; + /* print the object */ + print_hwloc_obj(&tmp2, pfx, obj2); + } + free(pfx); + if (NULL != *output) { + free(*output); + } + *output = tmp2; +} + +int opal_hwloc_print(char **output, char *prefix, hwloc_topology_t src, opal_data_type_t type) +{ + hwloc_obj_t obj; + char *tmp=NULL; + + /* get root object */ + obj = hwloc_get_root_obj(src); + /* print it */ + print_hwloc_obj(&tmp, prefix, obj); + *output = tmp; + return OPAL_SUCCESS; +} + +int opal_hwloc_size(size_t *size, hwloc_topology_t src, opal_data_type_t type) +{ + return OPAL_ERR_NOT_IMPLEMENTED; +} + +void opal_hwloc_release(opal_dss_value_t *value) +{ +} diff --git a/opal/mca/hwloc/base/hwloc_base_open.c b/opal/mca/hwloc/base/hwloc_base_open.c new file mode 100644 index 0000000000..9fa792a0ba --- /dev/null +++ b/opal/mca/hwloc/base/hwloc_base_open.c @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "opal_config.h" + +#include "opal/constants.h" +#include "opal/dss/dss.h" +#include "opal/util/output.h" +#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" +#include "opal/mca/base/mca_base_param.h" + +#include "opal/mca/hwloc/hwloc.h" +#include "opal/mca/hwloc/base/base.h" + + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ +#include "opal/mca/hwloc/base/static-components.h" + + +/* + * Globals + */ +int opal_hwloc_base_output = -1; +opal_list_t opal_hwloc_components; +bool opal_hwloc_base_inited = false; +#if OPAL_HAVE_HWLOC +hwloc_topology_t opal_hwloc_topology=NULL; +#endif + +int opal_hwloc_base_open(void) +{ + if (opal_hwloc_base_inited) { + return OPAL_SUCCESS; + } + opal_hwloc_base_inited = true; + +#if OPAL_HAVE_HWLOC + { + int value; + opal_data_type_t tmp; + + /* Debugging / verbose output */ + mca_base_param_reg_int_name("hwloc", "base_verbose", + "Verbosity level of the hwloc framework", + false, false, + 0, &value); + if (0 != value) { + opal_hwloc_base_output = opal_output_open(NULL); + } else { + opal_hwloc_base_output = -1; + } + + /* to support tools such as ompi_info, add the components + * to a list + */ + OBJ_CONSTRUCT(&opal_hwloc_components, opal_list_t); + if (OPAL_SUCCESS != + mca_base_components_open("hwloc", opal_hwloc_base_output, + mca_hwloc_base_static_components, + &opal_hwloc_components, true)) { + return OPAL_ERROR; + } + + /* declare the hwloc data types */ + tmp = OPAL_HWLOC_TOPO; + if (OPAL_SUCCESS != (value = opal_dss.register_type(opal_hwloc_pack, + opal_hwloc_unpack, + (opal_dss_copy_fn_t)opal_hwloc_copy, + (opal_dss_compare_fn_t)opal_hwloc_compare, + (opal_dss_size_fn_t)opal_hwloc_size, + (opal_dss_print_fn_t)opal_hwloc_print, + (opal_dss_release_fn_t)opal_hwloc_release, + OPAL_DSS_STRUCTURED, + "OPAL_HWLOC_TOPO", &tmp))) { + return value; + } + } +#endif + + return OPAL_SUCCESS; +} diff --git a/opal/mca/hwloc/configure.m4 b/opal/mca/hwloc/configure.m4 new file mode 100644 index 0000000000..01e3b3b154 --- /dev/null +++ b/opal/mca/hwloc/configure.m4 @@ -0,0 +1,111 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# There will only be one component used in this framework, and it will +# be selected at configure time by priority. Components must set +# their priorities in their configure.m4 files. They must also set +# the shell variable $hwloc_base_include to a header file name +# (relative to the top OMPI source directory) that will be included in +# opal/mca/hwloc/hwloc.h. Optionally, components may also set the +# shell variable $hwloc_base_cppflags if additional CPPFLAGS must be +# used with this header file, and $hwloc_base_ldflags and +# $hwloc_base_libs. The hwloc framework will add the winning +# component's $hwloc_base_* to CPPFLAGS, LDFLAGS, and LIBS, +# respectively. + +# If the user specifies --without-hwloc, then: +# +# - no hwloc component will be configured +# - $OPAL_HAVE_HWLOC will be set to 0 +# - OPAL_HAVE_HWLOC will be AC_DEFINE'd to 0 +# +# Otherwise: +# +# - a hwloc component will be configured. configure will abort if no +# hwloc component is able to be configured. +# - $OPAL_HAVE_HWLOC will be set to 1 +# - OPAL_HAVE_HWLOC will be AC_DEFINE'd to 1 +# +# Other configury (e.g., components that depend on hwloc) can simply +# check the value of $with_hwloc. If it's "no", then they should know +# that hwloc will not be available. If it's not "no", then they can +# assume that hwloc will be available (and that this framework will +# abort configure if hwloc is *not* available). + +dnl We only want one winning component. +m4_define(MCA_opal_hwloc_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY) + +AC_DEFUN([MCA_opal_hwloc_CONFIG],[ + + # See if we want hwloc, and if so, internal vs external + AC_ARG_WITH(hwloc, + AC_HELP_STRING([--with-hwloc(=DIR)], + [Build hwloc support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of hwloc. "external" forces Open MPI to use an external installation of hwloc. Supplying a valid directory name also forces Open MPI to use an external installation of hwloc, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries.])) + + # set default + hwloc_base_enable_xml=0 + + AC_MSG_CHECKING([want hwloc support]) + if test "$with_hwloc" = "no"; then + AC_MSG_RESULT([no]) + OPAL_HAVE_HWLOC=0 + else + AC_MSG_RESULT([yes]) + OPAL_HAVE_HWLOC=1 + fi + + # configure all the components - always have to do this + MCA_CONFIGURE_FRAMEWORK($1, $2, 1) + + if test "$with_hwloc" != "no"; then + # We must have found exactly 1 static component, or we can't + # continue. STOP_AT_FIRST_PRIORITY will guarantee that we find at + # most one. We need to check here that we found *at least* one. + AS_IF([test "$MCA_opal_hwloc_STATIC_COMPONENTS" = ""], + [AC_MSG_WARN([Did not find a suitable static opal hwloc component]) + AC_MSG_ERROR([Cannot continue])]) + + # The winning component will have set this. + AS_IF([test "$hwloc_base_include" = ""], + [AC_MSG_WARN([Missing implementation header]) + AC_MSG_ERROR([Cannot continue])]) + + AC_DEFINE_UNQUOTED([MCA_hwloc_IMPLEMENTATION_HEADER], + ["$hwloc_base_include"], + [Header to include for hwloc implementation]) + + # Give a blank line to separate these messages from the last + # component's configure.m4 output. + + echo " " + + AC_MSG_CHECKING([for winning hwloc component additional CPPFLAGS]) + AS_IF([test "$hwloc_base_cppflags" != ""], + [AC_MSG_RESULT([$hwloc_base_cppflags]) + CPPFLAGS="$CPPFLAGS $hwloc_base_cppflags"], + [AC_MSG_RESULT([none])]) + AC_MSG_CHECKING([for winning hwloc component additional LDFLAGS]) + AS_IF([test "$hwloc_base_ldflags" != ""], + [AC_MSG_RESULT([$hwloc_base_ldflags]) + CPPFLAGS="$CPPFLAGS $hwloc_base_ldflags"], + [AC_MSG_RESULT([none])]) + AC_MSG_CHECKING([for winning hwloc component additional LIBS]) + AS_IF([test "$hwloc_base_libs" != ""], + [AC_MSG_RESULT([$hwloc_base_libs]) + CPPFLAGS="$CPPFLAGS $hwloc_base_libs"], + [AC_MSG_RESULT([none])]) + fi + + AM_CONDITIONAL(OPAL_HAVE_HWLOC, test "$with_hwloc" != "no") + AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC, $OPAL_HAVE_HWLOC, + [Whether we have hwloc support or not]) + AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC_XML, $hwloc_base_enable_xml, + [Enable xml support or not]) +]) diff --git a/opal/mca/hwloc/external/Makefile.am b/opal/mca/hwloc/external/Makefile.am new file mode 100644 index 0000000000..16a228fac5 --- /dev/null +++ b/opal/mca/hwloc/external/Makefile.am @@ -0,0 +1,21 @@ +# +# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This is a special component -- its main purpose in life is to have +# its configure.m4 add some things to CPPFLAGS, LDFLAGS, and +# LIBS. Hence, there's nothing to build here. :-) + +# We only ever build this component statically + +noinst_LTLIBRARIES = libmca_hwloc_external.la +libmca_hwloc_external_la_SOURCES = hwloc_external_component.c +libmca_hwloc_external_la_LDFLAGS = \ + -module -avoid-version \ + $(opal_hwloc_external_LDFLAGS) +libmca_hwloc_external_la_LIBADD = $(hwloc_external_LIBS) -lhwloc diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 new file mode 100644 index 0000000000..fac57183b5 --- /dev/null +++ b/opal/mca/hwloc/external/configure.m4 @@ -0,0 +1,115 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# +# Priority +# +AC_DEFUN([MCA_opal_hwloc_external_PRIORITY], [10]) + +# +# Force this component to compile in static-only mode +# +AC_DEFUN([MCA_opal_hwloc_external_COMPILE_MODE], [ + AC_MSG_CHECKING([for MCA component $2:$3 compile mode]) + $4="static" + AC_MSG_RESULT([$$4]) +]) + + +# MCA_hwloc_external_POST_CONFIG() +# --------------------------------- +AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ + HWLOC_DO_AM_CONDITIONALS +])dnl + + +# MCA_hwloc_external_CONFIG([action-if-found], [action-if-not-found]) +# -------------------------------------------------------------------- +AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ + AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile]) + + OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want]) + + AC_ARG_WITH([hwloc-libdir], + [AC_HELP_STRING([--with-hwloc-libdir=DIR], + [Search for hwloc libraries in DIR. Should only be used if an external copy of hwloc is being used.])]) + + # Make sure the user didn't specify --with-hwloc=internal and + # --with-hwloc-libdir=whatever. + AS_IF([test "$with_hwloc" = "internal" -a "$with_hwloc_libdir" != ""], + [AC_MSG_WARN([Both --with-hwloc=internal and --with-hwloc-libdir=DIR]) + AC_MSG_WARN([were specified, which does not make sense.]) + AC_MSG_ERROR([Cannot continue])]) + + # Do we want this external component? (slightly redundant logic, + # but hopefully slightly more clear...) + opal_hwloc_external_want=no + AS_IF([test "$with_hwloc_libdir" != ""], [opal_hwloc_external_want=yes]) + AS_IF([test "$with_hwloc" = "external"], [opal_hwloc_external_want=yes]) + AS_IF([test "$with_hwloc" != "" -a "$with_hwloc" != "no" -a "$with_hwloc" != "internal"], [opal_hwloc_external_want=yes]) + AS_IF([test "$with_hwloc" = "no"], [opal_hwloc_external_want=no]) + + # If we still want external support, try it + AS_IF([test "$opal_hwloc_external_want" = "yes"], + [OMPI_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir], + [libhwloc.*]) + + AC_MSG_CHECKING([looking for external hwloc in]) + AS_IF([test "$with_hwloc" != "external" -a "$with_hwloc" != "yes"], + [opal_hwloc_dir=$with_hwloc + AC_MSG_RESULT([($opal_hwloc_dir)])], + [AC_MSG_RESULT([(default search paths)])]) + AS_IF([test ! -z "$with_hwloc_libdir" -a "$with_hwloc_libdir" != "yes"], + [opal_hwloc_libdir="$with_hwloc_libdir"]) + + opal_hwloc_external_CPPFLAGS_save=$CPPFLAGS + opal_hwloc_external_CFLAGS_save=$CFLAGS + opal_hwloc_external_LDFLAGS_save=$LDFLAGS + opal_hwloc_external_LIBS_save=$LIBS + + OMPI_CHECK_PACKAGE([opal_hwloc_external], + [hwloc.h], + [hwloc], + [hwloc_topology_init], + [], + [$opal_hwloc_dir], + [$opal_hwloc_libdir], + [opal_hwloc_external_support=yes], + [opal_hwloc_external_support=no]) + + CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save + CFLAGS=$opal_hwloc_external_CFLAGS_save + LDFLAGS=$opal_hwloc_external_LDFLAGS_save + LIBS=$opal_hwloc_external_LIBS_save + ]) + + # Done! + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION], + [external], + [Version of hwloc]) + # Must set this variable so that the framework m4 knows + # what file to include in opal/mca/hwloc/hwloc.h + hwloc_base_include="$opal_hwloc_dir/include/hwloc.h" + hwloc_base_cppflags=$opal_hwloc_external_CPPFLAGS + + # These flags need to get passed to the wrapper compilers + # (this is unnecessary for the internal/embedded hwloc) + WRAPPER_EXTRA_LDFLAGS="$WRAPPER_EXTRA_LDFLAGS $opal_hwloc_external_LDFLAGS" + WRAPPER_EXTRA_LIBS="$WRAPPER_EXTRA_LIBS $opal_hwloc_external_LIBS" + $1], + [$2]) + + AC_SUBST(opal_hwloc_external_LDFLAGS) + AC_SUBST(opal_hwloc_external_LIBS) + + OPAL_VAR_SCOPE_POP +])dnl diff --git a/opal/mca/hwloc/external/hwloc_external_component.c b/opal/mca/hwloc/external/hwloc_external_component.c new file mode 100644 index 0000000000..745add21fd --- /dev/null +++ b/opal/mca/hwloc/external/hwloc_external_component.c @@ -0,0 +1,53 @@ +#include "opal_config.h" +#include "opal/constants.h" + +#include "opal/mca/hwloc/hwloc.h" + +/* + * Public string showing the sysinfo ompi_linux component version number + */ +const char *opal_hwloc_external_component_version_string = + "OPAL hwloc_external hwloc MCA component version " OPAL_VERSION; + + +/* + * Local function + */ +static int hwloc_external_open(void); + + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ + +const opal_hwloc_component_t mca_hwloc_external_component = { + + /* First, the mca_component_t struct containing meta information + about the component itself */ + + { + OPAL_HWLOC_BASE_VERSION_2_0_0, + + /* Component name and version */ + "hwloc_external", + OPAL_MAJOR_VERSION, + OPAL_MINOR_VERSION, + OPAL_RELEASE_VERSION, + + /* Component open and close functions */ + hwloc_external_open, + NULL + }, + { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + } +}; + +static int hwloc_external_open(void) +{ + /* Must have some code in this file, or the OS X linker may + eliminate the whole file */ + return OPAL_SUCCESS; +} diff --git a/opal/mca/hwloc/hwloc.h b/opal/mca/hwloc/hwloc.h new file mode 100644 index 0000000000..e4e4389b70 --- /dev/null +++ b/opal/mca/hwloc/hwloc.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + */ + +#ifndef OPAL_MCA_HWLOC_H +#define OPAL_MCA_HWLOC_H + +#include "opal_config.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_STDARG_H +#include +#endif + +#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" + +BEGIN_C_DECLS + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +typedef unsigned char u_char; +typedef unsigned short u_short; +#endif + +/** + * Structure for hwloc components. + */ +struct opal_hwloc_base_component_2_0_0_t { + /** MCA base component */ + mca_base_component_t base_version; + /** MCA base data */ + mca_base_component_data_t base_data; +}; + +/** + * Convenience typedef + */ +typedef struct opal_hwloc_base_component_2_0_0_t opal_hwloc_base_component_2_0_0_t; +typedef struct opal_hwloc_base_component_2_0_0_t opal_hwloc_component_t; + +/** + * Macro for use in components that are of type hwloc + */ +#define OPAL_HWLOC_BASE_VERSION_2_0_0 \ + MCA_BASE_VERSION_2_0_0, \ + "hwloc", 2, 0, 0 + +END_C_DECLS + +/* include implementation to call */ +#if OPAL_HAVE_HWLOC +#include MCA_hwloc_IMPLEMENTATION_HEADER + +OPAL_DECLSPEC extern hwloc_topology_t opal_hwloc_topology; +#endif + +#endif /* OPAL_HWLOC_H_ */ diff --git a/opal/mca/hwloc/hwloc121/Makefile.am b/opal/mca/hwloc/hwloc121/Makefile.am new file mode 100644 index 0000000000..fc2d14ba0d --- /dev/null +++ b/opal/mca/hwloc/hwloc121/Makefile.am @@ -0,0 +1,28 @@ +# +# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Need to include these files so that these directories are carried in +# the tarball (in case someone invokes autogen.sh on a dist tarball). +EXTRA_DIST = \ + hwloc/doc/README.txt \ + hwloc/tests/README.txt \ + hwloc/utils/README.txt + +SUBDIRS = hwloc + +# Headers and sources +headers = hwloc121.h +sources = hwloc121_component.c + +# We only ever build this component statically + +noinst_LTLIBRARIES = libmca_hwloc_hwloc121.la +libmca_hwloc_hwloc121_la_SOURCES = $(headers) $(sources) +libmca_hwloc_hwloc121_la_LDFLAGS = -module -avoid-version +libmca_hwloc_hwloc121_la_LIBADD = $(builddir)/hwloc/src/libhwloc_embedded.la diff --git a/opal/mca/hwloc/hwloc121/configure.m4 b/opal/mca/hwloc/hwloc121/configure.m4 new file mode 100644 index 0000000000..b7c6c3e802 --- /dev/null +++ b/opal/mca/hwloc/hwloc121/configure.m4 @@ -0,0 +1,139 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# +# Priority +# +AC_DEFUN([MCA_opal_hwloc_hwloc121_PRIORITY], [60]) + +# +# Force this component to compile in static-only mode +# +AC_DEFUN([MCA_opal_hwloc_hwloc121_COMPILE_MODE], [ + AC_MSG_CHECKING([for MCA component $2:$3 compile mode]) + $4="static" + AC_MSG_RESULT([$$4]) +]) + +# Include hwloc m4 files +m4_include(opal/mca/hwloc/hwloc121/hwloc/config/hwloc.m4) +m4_include(opal/mca/hwloc/hwloc121/hwloc/config/hwloc_pkg.m4) +m4_include(opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_attributes.m4) +m4_include(opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_visibility.m4) + +# MCA_hwloc_hwloc121_POST_CONFIG() +# --------------------------------- +AC_DEFUN([MCA_opal_hwloc_hwloc121_POST_CONFIG],[ + HWLOC_DO_AM_CONDITIONALS +])dnl + + +# MCA_hwloc_hwloc121_CONFIG([action-if-found], [action-if-not-found]) +# -------------------------------------------------------------------- +AC_DEFUN([MCA_opal_hwloc_hwloc121_CONFIG],[ + AC_CONFIG_FILES([opal/mca/hwloc/hwloc121/Makefile]) + + OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc121_save_CPPFLAGS opal_hwloc_hwloc121_save_LDFLAGS opal_hwloc_hwloc121_save_LIBS opal_hwloc_hwloc121_save_cairo opal_hwloc_hwloc121_save_xml opal_hwloc_hwloc121_basedir opal_hwloc_hwloc121_file]) + + # default to this component not providing support + opal_hwloc_hwloc121_basedir=opal/mca/hwloc/hwloc121 + opal_hwloc_hwloc121_support=no + + if test "$with_hwloc" = "internal" -o "$with_hwloc" = "" -o "$with_hwloc" = "yes"; then + opal_hwloc_hwloc121_save_CPPFLAGS=$CPPFLAGS + opal_hwloc_hwloc121_save_LDFLAGS=$LDFLAGS + opal_hwloc_hwloc121_save_LIBS=$LIBS + + # Run the hwloc configuration. + HWLOC_SET_SYMBOL_PREFIX([opal_]) + + # save XML or graphical options + opal_hwloc_hwloc121_save_cairo=$enable_cairo + opal_hwloc_hwloc121_save_xml=$enable_xml + + # never enable hwloc's graphical option + enable_cairo=no + + # check for xml option + AC_ARG_ENABLE(hwloc-xml, + AC_HELP_STRING([--enable-hwloc-xml], + [enable xml support for hwloc (experimental)])) + if test "$enable_hwloc_xml" = "yes"; then + enable_xml=yes + hwloc_base_enable_xml=1 + else + enable_xml=no + hwloc_base_enable_xml=0 + fi + + HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc121/hwloc], + [AC_MSG_CHECKING([whether hwloc 1.2.1 configure succeeded]) + AC_MSG_RESULT([yes]) + HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc121_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc121_basedir/hwloc/VERSION`" + + # Add flags to the wrappers for static builds. + # Note that we don't add the project name to the + # wrapper extra flags. :-( + hwloc_hwloc121_WRAPPER_EXTRA_LIBS=$HWLOC_EMBEDDED_LIBS + + opal_hwloc_hwloc121_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)' + opal_hwloc_hwloc121_LIBS='$(top_ompi_builddir)/$opal_hwloc_hwloc121_basedir/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)' + opal_hwloc_hwloc121_support=yes], + [AC_MSG_CHECKING([whether hwloc 1.2.1 configure succeeded]) + AC_MSG_RESULT([no]) + opal_hwloc_hwloc121_support=no]) + + # Restore some env variables, if necessary + AS_IF([test -n "$opal_hwloc_hwloc121_save_cairo"], + [enable_cairo=$opal_hwloc_hwloc121_save_cairo]) + AS_IF([test -n "$opal_hwloc_hwloc121_save_xml"], + [enable_xml=$opal_hwloc_hwloc121_save_xml]) + + CPPFLAGS=$opal_hwloc_hwloc121_save_CPPFLAGS + LDFLAGS=$opal_hwloc_hwloc121_save_LDFLAGS + LIBS=$opal_hwloc_hwloc121_save_LIBS + + AC_SUBST([opal_hwloc_hwloc121_CFLAGS]) + AC_SUBST([opal_hwloc_hwloc121_CPPFLAGS]) + AC_SUBST([opal_hwloc_hwloc121_LDFLAGS]) + AC_SUBST([opal_hwloc_hwloc121_LIBS]) + fi + + # Done! + AS_IF([test "$OPAL_HAVE_HWLOC" -eq 1 -a "$opal_hwloc_hwloc121_support" = "yes"], + [AC_DEFINE_UNQUOTED([HWLOC_HWLOC121_HWLOC_VERSION], + ["$HWLOC_VERSION"], + [Version of hwloc]) + + # Set these variables so that the framework m4 knows + # what file to include in opal/mca/hwloc/hwloc.h + hwloc_base_include="$opal_hwloc_hwloc121_basedir/hwloc121.h" + + # We also set _cppflags so that when including + # opal/mca/hwloc/hwloc.h (and therefore this component's + # underlying hwloc.h), it can find all the actual hwloc + # files. Be a little friendly and only include the -I for + # the builddir if it's different than the srcdir. + opal_hwloc_hwloc121_file=$opal_hwloc_hwloc121_basedir/hwloc + hwloc_base_cppflags="-I$OMPI_TOP_SRCDIR/$opal_hwloc_hwloc121_file/include" + AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"], + [hwloc_base_cppflags="$hwloc_base_cppflags -I$OMPI_TOP_BUILDDIR/$opal_hwloc_hwloc121_file/include"]) + if test "$with_devel_headers" = "yes" ; then + hwloc_hwloc121_WRAPPER_EXTRA_CPPFLAGS="$WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/'"$opal_hwloc_hwloc121_basedir/hwloc/include" + fi + hwloc_hwloc121_WRAPPER_EXTRA_LIBS=$HWLOC_XML_LIBS + hwloc_hwloc121_WRAPPER_EXTRA_LDFLAGS=$HWLOC_XML_LDFLAGS + + $1], + [$2]) + + OPAL_VAR_SCOPE_POP +])dnl diff --git a/opal/mca/common/hwloc/hwloc/AUTHORS b/opal/mca/hwloc/hwloc121/hwloc/AUTHORS similarity index 100% rename from opal/mca/common/hwloc/hwloc/AUTHORS rename to opal/mca/hwloc/hwloc121/hwloc/AUTHORS diff --git a/opal/mca/common/hwloc/hwloc/COPYING b/opal/mca/hwloc/hwloc121/hwloc/COPYING similarity index 100% rename from opal/mca/common/hwloc/hwloc/COPYING rename to opal/mca/hwloc/hwloc121/hwloc/COPYING diff --git a/opal/mca/common/hwloc/hwloc/Makefile.am b/opal/mca/hwloc/hwloc121/hwloc/Makefile.am similarity index 100% rename from opal/mca/common/hwloc/hwloc/Makefile.am rename to opal/mca/hwloc/hwloc121/hwloc/Makefile.am diff --git a/opal/mca/common/hwloc/hwloc/NEWS b/opal/mca/hwloc/hwloc121/hwloc/NEWS similarity index 100% rename from opal/mca/common/hwloc/hwloc/NEWS rename to opal/mca/hwloc/hwloc121/hwloc/NEWS diff --git a/opal/mca/common/hwloc/hwloc/README b/opal/mca/hwloc/hwloc121/hwloc/README similarity index 100% rename from opal/mca/common/hwloc/hwloc/README rename to opal/mca/hwloc/hwloc121/hwloc/README diff --git a/opal/mca/common/hwloc/hwloc/VERSION b/opal/mca/hwloc/hwloc121/hwloc/VERSION similarity index 100% rename from opal/mca/common/hwloc/hwloc/VERSION rename to opal/mca/hwloc/hwloc121/hwloc/VERSION diff --git a/opal/mca/common/hwloc/hwloc/config/distscript.csh b/opal/mca/hwloc/hwloc121/hwloc/config/distscript.csh similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/distscript.csh rename to opal/mca/hwloc/hwloc121/hwloc/config/distscript.csh diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc.m4 b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc.m4 similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc.m4 rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc.m4 diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc_check_attributes.m4 b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_attributes.m4 similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc_check_attributes.m4 rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_attributes.m4 diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc_check_visibility.m4 b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_visibility.m4 similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc_check_visibility.m4 rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc_check_visibility.m4 diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc_get_version.sh b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc_get_version.sh similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc_get_version.sh rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc_get_version.sh diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc_internal.m4 b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc_internal.m4 similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc_internal.m4 rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc_internal.m4 diff --git a/opal/mca/common/hwloc/hwloc/config/hwloc_pkg.m4 b/opal/mca/hwloc/hwloc121/hwloc/config/hwloc_pkg.m4 similarity index 100% rename from opal/mca/common/hwloc/hwloc/config/hwloc_pkg.m4 rename to opal/mca/hwloc/hwloc121/hwloc/config/hwloc_pkg.m4 diff --git a/opal/mca/common/hwloc/hwloc/configure.ac b/opal/mca/hwloc/hwloc121/hwloc/configure.ac similarity index 100% rename from opal/mca/common/hwloc/hwloc/configure.ac rename to opal/mca/hwloc/hwloc121/hwloc/configure.ac diff --git a/opal/mca/common/hwloc/hwloc/doc/README.txt b/opal/mca/hwloc/hwloc121/hwloc/doc/README.txt similarity index 100% rename from opal/mca/common/hwloc/hwloc/doc/README.txt rename to opal/mca/hwloc/hwloc121/hwloc/doc/README.txt diff --git a/opal/mca/common/hwloc/hwloc/hwloc.pc.in b/opal/mca/hwloc/hwloc121/hwloc/hwloc.pc.in similarity index 100% rename from opal/mca/common/hwloc/hwloc/hwloc.pc.in rename to opal/mca/hwloc/hwloc121/hwloc/hwloc.pc.in diff --git a/opal/mca/common/hwloc/hwloc/include/Makefile.am b/opal/mca/hwloc/hwloc121/hwloc/include/Makefile.am similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/Makefile.am rename to opal/mca/hwloc/hwloc121/hwloc/include/Makefile.am diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/autogen/config.h.in b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/autogen/config.h.in similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/autogen/config.h.in rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/autogen/config.h.in diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/bitmap.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/bitmap.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/bitmap.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/bitmap.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/cpuset.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cpuset.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/cpuset.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cpuset.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/cuda.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cuda.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/cuda.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cuda.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/cudart.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cudart.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/cudart.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/cudart.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/glibc-sched.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/glibc-sched.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/glibc-sched.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/glibc-sched.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/helper.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/helper.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/helper.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/helper.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/linux-libnuma.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/linux-libnuma.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/linux-libnuma.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/linux-libnuma.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/linux.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/linux.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/linux.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/linux.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/myriexpress.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/myriexpress.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/myriexpress.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/myriexpress.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/openfabrics-verbs.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/openfabrics-verbs.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/openfabrics-verbs.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/openfabrics-verbs.h diff --git a/opal/mca/common/hwloc/hwloc/include/hwloc/rename.h b/opal/mca/hwloc/hwloc121/hwloc/include/hwloc/rename.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/hwloc/rename.h rename to opal/mca/hwloc/hwloc121/hwloc/include/hwloc/rename.h diff --git a/opal/mca/common/hwloc/hwloc/include/private/autogen/config.h.in b/opal/mca/hwloc/hwloc121/hwloc/include/private/autogen/config.h.in similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/private/autogen/config.h.in rename to opal/mca/hwloc/hwloc121/hwloc/include/private/autogen/config.h.in diff --git a/opal/mca/common/hwloc/hwloc/include/private/cpuid.h b/opal/mca/hwloc/hwloc121/hwloc/include/private/cpuid.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/private/cpuid.h rename to opal/mca/hwloc/hwloc121/hwloc/include/private/cpuid.h diff --git a/opal/mca/common/hwloc/hwloc/include/private/debug.h b/opal/mca/hwloc/hwloc121/hwloc/include/private/debug.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/private/debug.h rename to opal/mca/hwloc/hwloc121/hwloc/include/private/debug.h diff --git a/opal/mca/common/hwloc/hwloc/include/private/misc.h b/opal/mca/hwloc/hwloc121/hwloc/include/private/misc.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/private/misc.h rename to opal/mca/hwloc/hwloc121/hwloc/include/private/misc.h diff --git a/opal/mca/common/hwloc/hwloc/include/private/private.h b/opal/mca/hwloc/hwloc121/hwloc/include/private/private.h similarity index 100% rename from opal/mca/common/hwloc/hwloc/include/private/private.h rename to opal/mca/hwloc/hwloc121/hwloc/include/private/private.h diff --git a/opal/mca/common/hwloc/hwloc/src/Makefile.am b/opal/mca/hwloc/hwloc121/hwloc/src/Makefile.am similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/Makefile.am rename to opal/mca/hwloc/hwloc121/hwloc/src/Makefile.am diff --git a/opal/mca/common/hwloc/hwloc/src/bind.c b/opal/mca/hwloc/hwloc121/hwloc/src/bind.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/bind.c rename to opal/mca/hwloc/hwloc121/hwloc/src/bind.c diff --git a/opal/mca/common/hwloc/hwloc/src/cpuset.c b/opal/mca/hwloc/hwloc121/hwloc/src/cpuset.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/cpuset.c rename to opal/mca/hwloc/hwloc121/hwloc/src/cpuset.c diff --git a/opal/mca/common/hwloc/hwloc/src/distances.c b/opal/mca/hwloc/hwloc121/hwloc/src/distances.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/distances.c rename to opal/mca/hwloc/hwloc121/hwloc/src/distances.c diff --git a/opal/mca/common/hwloc/hwloc/src/dolib.c b/opal/mca/hwloc/hwloc121/hwloc/src/dolib.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/dolib.c rename to opal/mca/hwloc/hwloc121/hwloc/src/dolib.c diff --git a/opal/mca/common/hwloc/hwloc/src/hwloc.dtd b/opal/mca/hwloc/hwloc121/hwloc/src/hwloc.dtd similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/hwloc.dtd rename to opal/mca/hwloc/hwloc121/hwloc/src/hwloc.dtd diff --git a/opal/mca/common/hwloc/hwloc/src/misc.c b/opal/mca/hwloc/hwloc121/hwloc/src/misc.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/misc.c rename to opal/mca/hwloc/hwloc121/hwloc/src/misc.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-aix.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-aix.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-aix.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-aix.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-darwin.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-darwin.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-darwin.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-darwin.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-freebsd.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-freebsd.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-freebsd.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-freebsd.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-hpux.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-hpux.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-hpux.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-hpux.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-linux.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-linux.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-linux.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-linux.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-osf.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-osf.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-osf.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-osf.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-solaris.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-solaris.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-solaris.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-solaris.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-synthetic.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-synthetic.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-synthetic.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-synthetic.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-windows.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-windows.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-windows.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-windows.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-x86.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-x86.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-x86.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-x86.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology-xml.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology-xml.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology-xml.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology-xml.c diff --git a/opal/mca/common/hwloc/hwloc/src/topology.c b/opal/mca/hwloc/hwloc121/hwloc/src/topology.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/topology.c rename to opal/mca/hwloc/hwloc121/hwloc/src/topology.c diff --git a/opal/mca/common/hwloc/hwloc/src/traversal.c b/opal/mca/hwloc/hwloc121/hwloc/src/traversal.c similarity index 100% rename from opal/mca/common/hwloc/hwloc/src/traversal.c rename to opal/mca/hwloc/hwloc121/hwloc/src/traversal.c diff --git a/opal/mca/common/hwloc/hwloc/tests/README.txt b/opal/mca/hwloc/hwloc121/hwloc/tests/README.txt similarity index 100% rename from opal/mca/common/hwloc/hwloc/tests/README.txt rename to opal/mca/hwloc/hwloc121/hwloc/tests/README.txt diff --git a/opal/mca/common/hwloc/hwloc/utils/README.txt b/opal/mca/hwloc/hwloc121/hwloc/utils/README.txt similarity index 100% rename from opal/mca/common/hwloc/hwloc/utils/README.txt rename to opal/mca/hwloc/hwloc121/hwloc/utils/README.txt diff --git a/opal/mca/hwloc/hwloc121/hwloc121.h b/opal/mca/hwloc/hwloc121/hwloc121.h new file mode 100644 index 0000000000..8336de02b1 --- /dev/null +++ b/opal/mca/hwloc/hwloc121/hwloc121.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * When this component is used, this file is included in the rest of + * the OPAL/ORTE/OMPI code base via opal/mca/event/event.h. As such, + * this header represents the public interface to this static component. + */ + +#ifndef MCA_OPAL_HWLOC_HWLOC121_H +#define MCA_OPAL_HWLOC_HWLOC121_H + +#include "hwloc/include/hwloc.h" + +END_C_DECLS + +#endif /* MCA_OPAL_HWLOC_HWLOC121_H */ diff --git a/opal/mca/sysinfo/linux/sysinfo_linux_component.c b/opal/mca/hwloc/hwloc121/hwloc121_component.c similarity index 61% rename from opal/mca/sysinfo/linux/sysinfo_linux_component.c rename to opal/mca/hwloc/hwloc121/hwloc121_component.c index 54129cf636..2e39a814e1 100644 --- a/opal/mca/sysinfo/linux/sysinfo_linux_component.c +++ b/opal/mca/hwloc/hwloc121/hwloc121_component.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -15,46 +15,44 @@ */ #include "opal_config.h" - #include "opal/constants.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "sysinfo_linux.h" + +#include "opal/mca/hwloc/hwloc.h" +#include "hwloc121.h" /* * Public string showing the sysinfo ompi_linux component version number */ -const char *opal_sysinfo_linux_component_version_string = - "OPAL linux sysinfo MCA component version " OPAL_VERSION; +const char *opal_hwloc_hwloc121_component_version_string = + "OPAL hwloc121 hwloc MCA component version " OPAL_VERSION; /* * Local function */ -static int sysinfo_linux_component_query(mca_base_module_t **module, int *priority); +static int hwloc121_open(void); /* * Instantiate the public struct with all of our public information * and pointers to our public functions in it */ -const opal_sysinfo_base_component_t mca_sysinfo_linux_component = { +const opal_hwloc_component_t mca_hwloc_hwloc121_component = { /* First, the mca_component_t struct containing meta information about the component itself */ { - OPAL_SYSINFO_BASE_VERSION_2_0_0, + OPAL_HWLOC_BASE_VERSION_2_0_0, /* Component name and version */ - "linux", + "hwloc121", OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, OPAL_RELEASE_VERSION, /* Component open and close functions */ - NULL, - NULL, - sysinfo_linux_component_query, - NULL, + hwloc121_open, + NULL }, { /* The component is checkpoint ready */ @@ -63,11 +61,8 @@ const opal_sysinfo_base_component_t mca_sysinfo_linux_component = { }; -static int sysinfo_linux_component_query(mca_base_module_t **module, int *priority) -{ - *priority = 20; - *module = (mca_base_module_t *)&opal_sysinfo_linux_module; - +static int hwloc121_open(void) +{ return OPAL_SUCCESS; } diff --git a/opal/mca/hwloc/hwloc121/hwloc121_module.c b/opal/mca/hwloc/hwloc121/hwloc121_module.c new file mode 100644 index 0000000000..0422e222dd --- /dev/null +++ b/opal/mca/hwloc/hwloc121/hwloc121_module.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + */ +#include "opal_config.h" +#include "opal/constants.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#include +#include +#ifndef WIN32 +#ifdef HAVE_UNISTD_H +#include +#endif +#endif +#include +#include +#include +#include +#include + +#include "opal/class/opal_object.h" +#include "opal/threads/mutex.h" +#include "opal/threads/threads.h" +#include "opal/util/output.h" +#include "opal/util/argv.h" +#include "opal/util/fd.h" +#include "opal/mca/base/mca_base_param.h" + +#include "hwloc121.h" +#include "opal/mca/hwloc/base/base.h" + diff --git a/opal/mca/maffinity/hwloc/Makefile.am b/opal/mca/maffinity/hwloc/Makefile.am index 9374086ede..4bcbd43b3c 100644 --- a/opal/mca/maffinity/hwloc/Makefile.am +++ b/opal/mca/maffinity/hwloc/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -47,8 +47,6 @@ mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_maffinity_hwloc_la_SOURCES = $(sources) mca_maffinity_hwloc_la_LDFLAGS = -module -avoid-version -mca_maffinity_hwloc_la_LIBADD = \ - $(top_builddir)/opal/mca/common/hwloc/libmca_common_hwloc.la noinst_LTLIBRARIES = $(component_noinst) libmca_maffinity_hwloc_la_SOURCES =$(sources) diff --git a/opal/mca/maffinity/hwloc/configure.m4 b/opal/mca/maffinity/hwloc/configure.m4 index 3effe66364..9e0d57aaba 100644 --- a/opal/mca/maffinity/hwloc/configure.m4 +++ b/opal/mca/maffinity/hwloc/configure.m4 @@ -14,10 +14,12 @@ AC_DEFUN([MCA_opal_maffinity_hwloc_CONFIG],[ AC_CONFIG_FILES([opal/mca/maffinity/hwloc/Makefile]) - # All we check for is the results of opal/mca/common/hwloc's - # configury - AC_MSG_CHECKING([if common hwloc was happy]) - AC_MSG_RESULT([$opal_common_hwloc_support]) - - AS_IF([test "$opal_common_hwloc_support" = "yes"], [$1], [$2]) + # All we check for is whether --without-hwloc was given + # configury. See big comment in opal/mca/hwloc/configure.m4. + AC_MSG_CHECKING([if hwloc is enabled]) + AS_IF([test "$with_hwloc" != "no"], + [AC_MSG_RESULT([yes]) + $1], + [AC_MSG_RESULT([no]) + $2]) ])dnl diff --git a/opal/mca/maffinity/hwloc/maffinity_hwloc_component.c b/opal/mca/maffinity/hwloc/maffinity_hwloc_component.c index 5a945f3704..5db5e0bc1e 100644 --- a/opal/mca/maffinity/hwloc/maffinity_hwloc_component.c +++ b/opal/mca/maffinity/hwloc/maffinity_hwloc_component.c @@ -24,7 +24,7 @@ #include "opal/constants.h" #include "opal/util/show_help.h" #include "opal/mca/base/mca_base_param.h" -#include "opal/mca/common/hwloc/common_hwloc.h" +#include "opal/mca/hwloc/hwloc.h" #include "opal/mca/maffinity/maffinity.h" #include "maffinity_hwloc.h" @@ -80,18 +80,6 @@ opal_maffinity_hwloc_component_2_0_0_t mca_maffinity_hwloc_component = { static int hwloc_register(void) { - int i; - - /* Call the registration function of common hwloc */ - opal_common_hwloc_register(); - - i = mca_base_param_find("common", NULL, "hwloc_version"); - if (OPAL_ERROR != i) { - mca_base_param_reg_syn(i, - &mca_maffinity_hwloc_component.base.base_version, - "hwloc_version", false); - } - mca_base_param_reg_int(&mca_maffinity_hwloc_component.base.base_version, "priority", "Priority of the hwloc maffinity component", diff --git a/opal/mca/maffinity/hwloc/maffinity_hwloc_module.c b/opal/mca/maffinity/hwloc/maffinity_hwloc_module.c index 485394f24b..8196b7b3b2 100644 --- a/opal/mca/maffinity/hwloc/maffinity_hwloc_module.c +++ b/opal/mca/maffinity/hwloc/maffinity_hwloc_module.c @@ -34,7 +34,7 @@ #include "opal/mca/maffinity/maffinity.h" #include "opal/mca/maffinity/base/base.h" #include "maffinity_hwloc.h" -#include "opal/mca/common/hwloc/hwloc/include/hwloc.h" +#include "opal/mca/hwloc/hwloc.h" /* * Local functions diff --git a/opal/mca/paffinity/hwloc/Makefile.am b/opal/mca/paffinity/hwloc/Makefile.am index 25c8798838..653a80cfe7 100644 --- a/opal/mca/paffinity/hwloc/Makefile.am +++ b/opal/mca/paffinity/hwloc/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -45,8 +45,6 @@ mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_paffinity_hwloc_la_SOURCES = $(sources) mca_paffinity_hwloc_la_LDFLAGS = -module -avoid-version -mca_paffinity_hwloc_la_LIBADD = \ - $(top_builddir)/opal/mca/common/hwloc/libmca_common_hwloc.la noinst_LTLIBRARIES = $(component_noinst) libmca_paffinity_hwloc_la_SOURCES =$(sources) diff --git a/opal/mca/paffinity/hwloc/configure.m4 b/opal/mca/paffinity/hwloc/configure.m4 index 8c120daeb4..4f556668a9 100644 --- a/opal/mca/paffinity/hwloc/configure.m4 +++ b/opal/mca/paffinity/hwloc/configure.m4 @@ -24,10 +24,12 @@ AC_DEFUN([MCA_opal_paffinity_hwloc_CONFIG],[ AC_CONFIG_FILES([opal/mca/paffinity/hwloc/Makefile]) - # All we check for is the results of opal/mca/common/hwloc's - # configury - AC_MSG_CHECKING([if common hwloc was happy]) - AC_MSG_RESULT([$opal_common_hwloc_support]) - - AS_IF([test "$opal_common_hwloc_support" = "yes"], [$1], [$2]) + # All we check for is whether --without-hwloc was given + # configury. See big comment in opal/mca/hwloc/configure.m4. + AC_MSG_CHECKING([if hwloc is enabled]) + AS_IF([test "$with_hwloc" != "no"], + [AC_MSG_RESULT([yes]) + $1], + [AC_MSG_RESULT([no]) + $2]) ])dnl diff --git a/opal/mca/paffinity/hwloc/paffinity_hwloc_component.c b/opal/mca/paffinity/hwloc/paffinity_hwloc_component.c index 4a947f78be..104308bbfe 100644 --- a/opal/mca/paffinity/hwloc/paffinity_hwloc_component.c +++ b/opal/mca/paffinity/hwloc/paffinity_hwloc_component.c @@ -21,7 +21,7 @@ #include "opal/constants.h" #include "opal/mca/base/mca_base_param.h" -#include "opal/mca/common/hwloc/common_hwloc.h" +#include "opal/mca/hwloc/hwloc.h" #include "opal/mca/paffinity/paffinity.h" #include "paffinity_hwloc.h" @@ -73,18 +73,6 @@ opal_paffinity_hwloc_component_t mca_paffinity_hwloc_component = { static int hwloc_register(void) { - int i; - - /* Call the registration function of common hwloc */ - opal_common_hwloc_register(); - - i = mca_base_param_find("common", NULL, "hwloc_version"); - if (OPAL_ERROR != i) { - mca_base_param_reg_syn(i, - &mca_paffinity_hwloc_component.super.base_version, - "hwloc_version", false); - } - mca_base_param_reg_int(&mca_paffinity_hwloc_component.super.base_version, "priority", "Priority of the hwloc paffinity component", diff --git a/opal/mca/paffinity/hwloc/paffinity_hwloc_module.c b/opal/mca/paffinity/hwloc/paffinity_hwloc_module.c index 730a53c705..e73fc86537 100644 --- a/opal/mca/paffinity/hwloc/paffinity_hwloc_module.c +++ b/opal/mca/paffinity/hwloc/paffinity_hwloc_module.c @@ -34,7 +34,7 @@ #include "opal/mca/paffinity/paffinity.h" #include "opal/mca/paffinity/base/base.h" #include "paffinity_hwloc.h" -#include "opal/mca/common/hwloc/hwloc/include/hwloc.h" +#include "opal/mca/hwloc/hwloc.h" /* * Local functions diff --git a/opal/mca/sysinfo/base/Makefile.am b/opal/mca/sysinfo/base/Makefile.am deleted file mode 100644 index 83578cc271..0000000000 --- a/opal/mca/sysinfo/base/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2009 Cisco Systems, Inc. -# All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -headers += \ - base/base.h - -libmca_sysinfo_la_SOURCES += \ - base/sysinfo_base_close.c \ - base/sysinfo_base_select.c \ - base/sysinfo_base_open.c diff --git a/opal/mca/sysinfo/base/base.h b/opal/mca/sysinfo/base/base.h deleted file mode 100644 index d9d5b8d17b..0000000000 --- a/opal/mca/sysinfo/base/base.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ - -#ifndef OPAL_SYSINFO_BASE_H -#define OPAL_SYSINFO_BASE_H - -#include "opal_config.h" - -#include "opal/mca/sysinfo/sysinfo.h" - -/* - * Global functions for MCA overall sysinfo open and close - */ - -BEGIN_C_DECLS - -/** - * Initialize the sysinfo MCA framework - * - * @retval OPAL_SUCCESS Upon success - * @retval OPAL_ERROR Upon failure - * - * This must be the first function invoked in the sysinfo MCA - * framework. It initializes the sysinfo MCA framework, finds - * and opens sysinfo components, etc. - * - * This function is invoked during opal_init(). - */ -OPAL_DECLSPEC int opal_sysinfo_base_open(void); - -/** - * Close the sysinfo MCA framework - * - * @retval OPAL_SUCCESS Upon success - * @retval OPAL_ERROR Upon failure - * - * This must be the last function invoked in the sysinfo MCA - * framework. - * - * This function is invoked during opal_finalize(). - */ -OPAL_DECLSPEC int opal_sysinfo_base_close(void); - -/** - * Select all available components. - * - * @return OPAL_SUCCESS Upon success. - * @return OPAL_ERROR Upon other failure. - * - * At the end of this process, we'll have a list of all available - * components. If the list is empty, that is okay too. All - * available components will have their init function called. - */ -OPAL_DECLSPEC int opal_sysinfo_base_select(void); - -OPAL_DECLSPEC extern int opal_sysinfo_base_output; -OPAL_DECLSPEC extern opal_list_t opal_sysinfo_base_components_opened; -OPAL_DECLSPEC extern opal_list_t opal_sysinfo_avail_modules; -OPAL_DECLSPEC extern bool opal_sysinfo_initialized; -OPAL_DECLSPEC extern bool opal_sysinfo_selected; - -END_C_DECLS - -#endif /* OPAL_SYSINFO_BASE_H */ diff --git a/opal/mca/sysinfo/base/sysinfo_base_close.c b/opal/mca/sysinfo/base/sysinfo_base_close.c deleted file mode 100644 index 7212ecda8c..0000000000 --- a/opal/mca/sysinfo/base/sysinfo_base_close.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/base/base.h" - -int opal_sysinfo_base_close(void) -{ - opal_list_item_t *item; - opal_sysinfo_module_t *mod; - - /* call the finalize of all available modules */ - while (NULL != (item = opal_list_remove_first(&opal_sysinfo_avail_modules))) { - mod = (opal_sysinfo_module_t*)item; - if (NULL != mod->module->finalize) { - mod->module->finalize(); - } - } - OBJ_DESTRUCT(&opal_sysinfo_avail_modules); - - /* Close all components that are still open (this should only - happen during ompi_info). */ - - mca_base_components_close(opal_sysinfo_base_output, - &opal_sysinfo_base_components_opened, NULL); - OBJ_DESTRUCT(&opal_sysinfo_base_components_opened); - - /* All done */ - - return OPAL_SUCCESS; -} diff --git a/opal/mca/sysinfo/base/sysinfo_base_open.c b/opal/mca/sysinfo/base/sysinfo_base_open.c deleted file mode 100644 index 9177725027..0000000000 --- a/opal/mca/sysinfo/base/sysinfo_base_open.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/util/output.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_param.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/base/base.h" - - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ -#include "opal/mca/sysinfo/base/static-components.h" - -/* unsupported functions */ -static int opal_sysinfo_base_query(char **keys, opal_list_t *values); - -/* - * Globals - */ -int opal_sysinfo_base_output = -1; -opal_list_t opal_sysinfo_base_components_opened; -opal_list_t opal_sysinfo_avail_modules; -bool opal_sysinfo_initialized=false; -bool opal_sysinfo_selected=false; - -opal_sysinfo_API_module_t opal_sysinfo = { - opal_sysinfo_base_query -}; - - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int opal_sysinfo_base_open(void) -{ - if (opal_sysinfo_initialized) { - return OPAL_SUCCESS; - } - opal_sysinfo_initialized = true; - - opal_sysinfo_base_output = opal_output_open(NULL); - - /* init the list of available modules */ - OBJ_CONSTRUCT(&opal_sysinfo_avail_modules, opal_list_t); - - /* Open up all available components */ - OBJ_CONSTRUCT( &opal_sysinfo_base_components_opened, opal_list_t ); - - if (OPAL_SUCCESS != - mca_base_components_open("sysinfo", opal_sysinfo_base_output, - mca_sysinfo_base_static_components, - &opal_sysinfo_base_components_opened, - true)) { - return OPAL_ERROR; - } - - /* All done */ - - return OPAL_SUCCESS; -} - -static int opal_sysinfo_base_query(char **keys, opal_list_t *values) -{ - opal_list_item_t *item; - opal_sysinfo_module_t *mod; - - /* query all the available modules */ - for (item = opal_list_get_first(&opal_sysinfo_avail_modules); - item != opal_list_get_end(&opal_sysinfo_avail_modules); - item = opal_list_get_next(item)) { - mod = (opal_sysinfo_module_t*)item; - if (NULL != mod->module->query) { - mod->module->query(keys, values); - } - } - return OPAL_SUCCESS; -} - -/**** SETUP SYSINFO MODULE OBJECTS ****/ -static void mod_constructor(opal_sysinfo_module_t *ptr) -{ - ptr->module = NULL; -} -OBJ_CLASS_INSTANCE(opal_sysinfo_module_t, - opal_list_item_t, - mod_constructor, NULL); - -static void val_constructor(opal_sysinfo_value_t *ptr) -{ - ptr->key = NULL; -} -static void val_destructor(opal_sysinfo_value_t *ptr) -{ - if (NULL != ptr->key) { - free(ptr->key); - } -} -OBJ_CLASS_INSTANCE(opal_sysinfo_value_t, - opal_list_item_t, - val_constructor, val_destructor); diff --git a/opal/mca/sysinfo/base/sysinfo_base_select.c b/opal/mca/sysinfo/base/sysinfo_base_select.c deleted file mode 100644 index 4791e31253..0000000000 --- a/opal/mca/sysinfo/base/sysinfo_base_select.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_param.h" - -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/base/base.h" - -/* - * Globals - */ - -int opal_sysinfo_base_select(void) -{ - int pri; - opal_sysinfo_module_t *module; - opal_sysinfo_base_module_t *sysmod; - mca_base_module_t *mod; - mca_base_component_list_item_t *cli; - mca_base_component_t *component; - opal_list_item_t *item; - - if (opal_sysinfo_selected) { - return OPAL_SUCCESS; - } - opal_sysinfo_selected = true; - - /* - * Select all available components - */ - for (item = opal_list_get_first(&opal_sysinfo_base_components_opened); - item != opal_list_get_end(&opal_sysinfo_base_components_opened); - item = opal_list_get_next(item)) { - - cli = (mca_base_component_list_item_t *) item; - component = (mca_base_component_t *) cli->cli_component; - - if (NULL == component->mca_query_component) { - /* no way to get the module */ - continue; - } - if (OPAL_SUCCESS != component->mca_query_component(&mod, &pri)) { - continue; - } - /* init the module */ - sysmod = (opal_sysinfo_base_module_t*)mod; - if (NULL != sysmod->init) { - if (OPAL_SUCCESS != sysmod->init()) { - /* can't run */ - continue; - } - } - module = OBJ_NEW(opal_sysinfo_module_t); - module->module = sysmod; - opal_list_append(&opal_sysinfo_avail_modules, &module->super); - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/sysinfo/configure.m4 b/opal/mca/sysinfo/configure.m4 deleted file mode 100644 index f523b40655..0000000000 --- a/opal/mca/sysinfo/configure.m4 +++ /dev/null @@ -1,13 +0,0 @@ -dnl -*- shell-script -*- -dnl -dnl Copyright (c) 2009 Cisco Systems, Inc -dnl All rights reserved. -dnl $COPYRIGHT$ -dnl -dnl Additional copyrights may follow -dnl -dnl $HEADER$ -dnl - -dnl we only want those at same priority -m4_define(MCA_opal_sysinfo_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY) diff --git a/opal/mca/sysinfo/darwin/Makefile.am b/opal/mca/sysinfo/darwin/Makefile.am deleted file mode 100644 index dda719b82e..0000000000 --- a/opal/mca/sysinfo/darwin/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - sysinfo_darwin.h \ - sysinfo_darwin_component.c \ - sysinfo_darwin_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_sysinfo_darwin_DSO -component_noinst = -component_install = mca_sysinfo_darwin.la -else -component_noinst = libmca_sysinfo_darwin.la -component_install = -endif - -mcacomponentdir = $(pkglibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_sysinfo_darwin_la_SOURCES = $(sources) -mca_sysinfo_darwin_la_LDFLAGS = -module -avoid-version - -noinst_LTLIBRARIES = $(component_noinst) -libmca_sysinfo_darwin_la_SOURCES =$(sources) -libmca_sysinfo_darwin_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/sysinfo/darwin/configure.m4 b/opal/mca/sysinfo/darwin/configure.m4 deleted file mode 100644 index bc34e4ed75..0000000000 --- a/opal/mca/sysinfo/darwin/configure.m4 +++ /dev/null @@ -1,25 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -AC_DEFUN([MCA_opal_sysinfo_darwin_PRIORITY], [50]) - -# MCA_sysinfo_darwin_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_opal_sysinfo_darwin_CONFIG],[ - AC_CONFIG_FILES([opal/mca/sysinfo/darwin/Makefile]) - - OPAL_VAR_SCOPE_PUSH([sysinfo_darwin_happy]) - # check to see if we have - # as this is a Darwin-specific thing - AC_CHECK_HEADER([mach/mach_host.h], [sysinfo_darwin_happy=yes], [sysinfo_darwin_happy=no]) - - AS_IF([test "$sysinfo_darwin_happy" = "yes"], [$1], [$2]) - OPAL_VAR_SCOPE_POP -])dnl - diff --git a/opal/mca/sysinfo/darwin/sysinfo_darwin.h b/opal/mca/sysinfo/darwin/sysinfo_darwin.h deleted file mode 100644 index 379652f8e9..0000000000 --- a/opal/mca/sysinfo/darwin/sysinfo_darwin.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_SYSINFO_DARWIN_H -#define MCA_SYSINFO_DARWIN_H - -#include "opal_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/sysinfo/sysinfo.h" - -BEGIN_C_DECLS - -/* - * Globally exported variable - */ - -OPAL_DECLSPEC extern const opal_sysinfo_base_component_t mca_sysinfo_darwin_component; - -OPAL_DECLSPEC extern const opal_sysinfo_base_module_t opal_sysinfo_darwin_module; - -END_C_DECLS - -#endif /* MCA_SYSINFO_DARWIN_H */ diff --git a/opal/mca/sysinfo/darwin/sysinfo_darwin_component.c b/opal/mca/sysinfo/darwin/sysinfo_darwin_component.c deleted file mode 100644 index a8ddb9eb42..0000000000 --- a/opal/mca/sysinfo/darwin/sysinfo_darwin_component.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "sysinfo_darwin.h" - -/* - * Public string showing the sysinfo ompi_darwin component version number - */ -const char *opal_sysinfo_darwin_component_version_string = - "OPAL darwin sysinfo MCA component version " OPAL_VERSION; - -/* - * Local function - */ -static int sysinfo_darwin_component_query(mca_base_module_t **module, int *priority); - - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ - -const opal_sysinfo_base_component_t mca_sysinfo_darwin_component = { - - /* First, the mca_component_t struct containing meta information - about the component itself */ - - { - /* Indicate that we are a sysinfo v1.1.0 component (which also - implies a specific MCA version) */ - - OPAL_SYSINFO_BASE_VERSION_2_0_0, - - /* Component name and version */ - - "darwin", - OPAL_MAJOR_VERSION, - OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION, - - /* Component open and close functions */ - - NULL, - NULL, - sysinfo_darwin_component_query, - NULL - }, - /* Next the MCA v1.0.0 component meta data */ - { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - } -}; - - -static int sysinfo_darwin_component_query(mca_base_module_t **module, int *priority) -{ - *priority = 20; - *module = (mca_base_module_t *)&opal_sysinfo_darwin_module; - - return OPAL_SUCCESS; -} diff --git a/opal/mca/sysinfo/darwin/sysinfo_darwin_module.c b/opal/mca/sysinfo/darwin/sysinfo_darwin_module.c deleted file mode 100644 index 3a182e9f0a..0000000000 --- a/opal/mca/sysinfo/darwin/sysinfo_darwin_module.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "opal/constants.h" - -/* This component will only be compiled on Mac OSX, where we are - guaranteed to have these headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "opal/mca/base/mca_base_param.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/base/base.h" - -#include "sysinfo_darwin.h" - -static int init(void); -static int query(char **keys, opal_list_t *values); -static int fini(void); - -/* - * Darwin sysinfo module - */ -const opal_sysinfo_base_module_t opal_sysinfo_darwin_module = { - init, - query, - fini -}; - -static int init(void) -{ - return OPAL_SUCCESS; -} - -static int fini(void) -{ - return OPAL_SUCCESS; -} - -/* Mac OSX does things a little differently than Linux - * by providing process stats via an API. This means we - * don't have to parse files that could change! - */ -static int query(char **keys, opal_list_t *values) -{ - int mib[2], i; - size_t len; - int64_t i64; - int iint; - opal_sysinfo_value_t *data; - char strval[128]; - - mib[0] = CTL_HW; - - /* cycle through the requested keys */ - for (i=0; NULL != keys[i]; i++) { - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_TYPE)) { - mib[1] = HW_MACHINE; - len = 128; - sysctl(mib, 2, &strval, &len, NULL, 0); - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_TYPE); - data->type = OPAL_STRING; - data->data.str = strdup(strval); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_MODEL)) { - mib[1] = HW_MODEL; - len = 128; - sysctl(mib, 2, &strval, &len, NULL, 0); - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_MODEL); - data->type = OPAL_STRING; - data->data.str = strdup(strval); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_NUM_CPUS)) { - mib[1] = HW_NCPU; - len = sizeof(int); - sysctl(mib, 2, &iint, &len, NULL, 0); - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_NUM_CPUS); - data->type = OPAL_INT64; - data->data.i64 = (int64_t)iint; - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_MEM_SIZE)) { - mib[1] = HW_MEMSIZE; - len = sizeof(int64_t); - sysctl(mib, 2, &i64, &len, NULL, 0); - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_MEM_SIZE); - data->type = OPAL_INT64; - data->data.i64 = i64 / (1 << 20); - opal_list_append(values, &data->super); - continue; - } - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/sysinfo/linux/Makefile.am b/opal/mca/sysinfo/linux/Makefile.am deleted file mode 100644 index a06d0b1e14..0000000000 --- a/opal/mca/sysinfo/linux/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - sysinfo_linux.h \ - sysinfo_linux_component.c \ - sysinfo_linux_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_sysinfo_linux_DSO -component_noinst = -component_install = mca_sysinfo_linux.la -else -component_noinst = libmca_sysinfo_linux.la -component_install = -endif - -mcacomponentdir = $(pkglibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_sysinfo_linux_la_SOURCES = $(sources) -mca_sysinfo_linux_la_LDFLAGS = -module -avoid-version - -noinst_LTLIBRARIES = $(component_noinst) -libmca_sysinfo_linux_la_SOURCES =$(sources) -libmca_sysinfo_linux_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/sysinfo/linux/configure.m4 b/opal/mca/sysinfo/linux/configure.m4 deleted file mode 100644 index 9e79db85b7..0000000000 --- a/opal/mca/sysinfo/linux/configure.m4 +++ /dev/null @@ -1,28 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. -# -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -AC_DEFUN([MCA_opal_sysinfo_linux_PRIORITY], [60]) - -# MCA_sysinfo_linux_CONFIG(action-if-can-compile, -# [action-if-cant-compile]) -# ------------------------------------------------ -AC_DEFUN([MCA_opal_sysinfo_linux_CONFIG],[ - AC_CONFIG_FILES([opal/mca/sysinfo/linux/Makefile]) - - AC_REQUIRE([OPAL_CHECK_OS_FLAVORS]) - - AC_MSG_CHECKING([if we are on Linux]) - # If we are on Linux, then we're happy. - AS_IF([test "$opal_found_linux" = "yes"], - [AC_MSG_RESULT([yes]) - $1], - [AC_MSG_RESULT([no]) - $2]) -]) diff --git a/opal/mca/sysinfo/linux/sysinfo_linux.h b/opal/mca/sysinfo/linux/sysinfo_linux.h deleted file mode 100644 index 1b6852f4cd..0000000000 --- a/opal/mca/sysinfo/linux/sysinfo_linux.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * System resource info for Posix systems. - * - */ - - -#ifndef MCA_SYSINFO_LINUX_H -#define MCA_SYSINFO_LINUX_H - -#include "opal_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/sysinfo/sysinfo.h" - - -BEGIN_C_DECLS - -/** - * Globally exported variable - */ -OPAL_DECLSPEC extern const opal_sysinfo_base_component_t mca_sysinfo_linux_component; - -OPAL_DECLSPEC extern const opal_sysinfo_base_module_t opal_sysinfo_linux_module; - -END_C_DECLS -#endif /* MCA_SYSINFO_LINUX_H */ diff --git a/opal/mca/sysinfo/linux/sysinfo_linux_module.c b/opal/mca/sysinfo/linux/sysinfo_linux_module.c deleted file mode 100644 index e483651f48..0000000000 --- a/opal/mca/sysinfo/linux/sysinfo_linux_module.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "opal/constants.h" - -/* This component will only be compiled on Linux, where we are - guaranteed to have and friends */ -#include -#include -#include -#include -#include -#include -#include - -#include /* for HZ to convert jiffies to actual time */ - -#include "opal/mca/base/mca_base_param.h" -#include "opal/dss/dss_types.h" -#include "opal/util/printf.h" - -#include "sysinfo_linux.h" - -/* - * Module functions - */ -static int linux_module_init(void); -static int query(char **keys, opal_list_t *values); -static int linux_module_fini(void); - -/* - * Linux sysinfo module - */ -const opal_sysinfo_base_module_t opal_sysinfo_linux_module = { - linux_module_init, - query, - linux_module_fini -}; - - -/* Local functions */ -static char *local_getline(FILE *fp); -static char *local_stripper(char *data); - -/* Local data */ -static char *cpu_type=NULL; -static char *cpu_model=NULL; -static int num_cpus=0; -static int64_t mem_size=0; -static char input[256]; - -static int linux_module_init(void) -{ - FILE *fp; - char *data, *value, *ptr; - - /* see if we can open the cpuinfo file */ - if (NULL == (fp = fopen("/proc/cpuinfo", "r"))) { - /* can't access this file - most likely, this means we - * aren't really on a supported system, or the proc no - * longer exists. Just return an error - */ - return OPAL_ERR_NOT_SUPPORTED; - } - - /* read the file one line at a time */ - while (NULL != (data = local_getline(fp))) { - if (NULL == (value = local_stripper(data))) { - /* cannot process */ - continue; - } - if (NULL == cpu_type && 0 == strcmp(data, "vendor_id")) { - cpu_type = strdup(value); - continue; - } - if (NULL == cpu_model && 0 == strcmp(data, "model name")) { - cpu_model = strdup(value); - } - if (0 == strcmp(data, "processor")) { - /* increment the num_cpus */ - ++num_cpus; - } - } - fclose(fp); - - /* see if we can open the meminfo file */ - if (NULL == (fp = fopen("/proc/meminfo", "r"))) { - /* ignore this */ - return OPAL_SUCCESS; - } - - /* read the file one line at a time */ - while (NULL != (data = local_getline(fp))) { - if (NULL == (value = local_stripper(data))) { - /* cannot process */ - continue; - } - if (0 == strcmp(data, "MemTotal")) { - /* find units */ - ptr = &value[strlen(value)-2]; - value[strlen(value)-3] = '\0'; - /* compute base value */ - mem_size = strtol(value, NULL, 10); - /* get the unit multiplier */ - if (0 == strcmp(ptr, "kB")) { - mem_size = mem_size / 1024; - } - continue; - } - } - fclose(fp); - - return OPAL_SUCCESS; -} - -static int linux_module_fini(void) -{ - return OPAL_SUCCESS; -} - -static int query(char **keys, opal_list_t *values) -{ - int i; - opal_sysinfo_value_t *data; - - /* cycle through the requested keys */ - for (i=0; NULL != keys[i]; i++) { - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_TYPE) && - NULL != cpu_type) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_TYPE); - data->type = OPAL_STRING; - data->data.str = strdup(cpu_type); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_MODEL) && - NULL != cpu_model) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_MODEL); - data->type = OPAL_STRING; - data->data.str = strdup(cpu_model); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_NUM_CPUS) && - num_cpus > 0) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_NUM_CPUS); - data->type = OPAL_INT64; - data->data.i64 = (int64_t)num_cpus; - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_MEM_SIZE) && - mem_size > 0) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_MEM_SIZE); - data->type = OPAL_INT64; - data->data.i64 = mem_size; - opal_list_append(values, &data->super); - continue; - } - } - - return OPAL_SUCCESS; -} - -static char *local_getline(FILE *fp) -{ - char *ret; - - ret = fgets(input, 256, fp); - if (NULL != ret) { - input[strlen(input)-1] = '\0'; /* remove newline */ - return input; - } - - return NULL; -} - -static char *local_stripper(char *data) -{ - char *ptr, *end, *enddata; - int len = strlen(data); - - /* find the colon */ - if (NULL == (end = strchr(data, ':'))) { - return NULL; - } - ptr = end; - --end; - /* working backwards, look for first non-whitespace */ - while (end != data && !isalnum(*end)) { - --end; - } - ++end; - *end = '\0'; - /* now look for value */ - ptr++; - enddata = &(data[len-1]); - while (ptr != enddata && !isalnum(*ptr)) { - ++ptr; - } - return ptr; -} diff --git a/opal/mca/sysinfo/solaris/Makefile.am b/opal/mca/sysinfo/solaris/Makefile.am deleted file mode 100644 index 9ef4425d44..0000000000 --- a/opal/mca/sysinfo/solaris/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - sysinfo_solaris.h \ - chiptype.h \ - chiptype.c \ - sysinfo_solaris_component.c \ - sysinfo_solaris_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_sysinfo_solaris_DSO -component_noinst = -component_install = mca_sysinfo_solaris.la -else -component_noinst = libmca_sysinfo_solaris.la -component_install = -endif - -mcacomponentdir = $(pkglibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_sysinfo_solaris_la_SOURCES = $(sources) -mca_sysinfo_solaris_la_LIBADD = $(sysinfo_solaris_LIBS) -mca_sysinfo_solaris_la_LDFLAGS = -module -avoid-version $(sysinfo_solaris_LDFLAGS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_sysinfo_solaris_la_SOURCES =$(sources) -libmca_sysinfo_solaris_la_LIBADD = $(sysinfo_solaris_LIBS) -libmca_sysinfo_solaris_la_LDFLAGS = -module -avoid-version $(sysinfo_solaris_LDFLAGS) diff --git a/opal/mca/sysinfo/solaris/chiptype.c b/opal/mca/sysinfo/solaris/chiptype.c deleted file mode 100644 index 6929df7952..0000000000 --- a/opal/mca/sysinfo/solaris/chiptype.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include -#include -#include -#include -#include "chiptype.h" - -/***************************************************************************** - Order of this list is important for the assign_value and - assign_string_value routines -*****************************************************************************/ - -static const char* items[] = { - "clock-frequency", - "cpu-mhz", - "ecache-size", - "l2-cache-size", - "sectored-l2-cache-size", - "implementation#", - "manufacturer#", - "compatible" -}; - -#define NUM_ITEMS (sizeof(items) / sizeof(items[0])) - -/***************************************************************************** -SPARC strings for chip modes and implementation -*****************************************************************************/ -static const char* sparc_modes[] = { - "UNKNOWN", - "SPITFIRE", - "BLACKBIRD", - "CHEETAH", - "SPARC64_VI", - "T1", - "T2", - "SPARC64_VII", - "ROCK" -}; - -/***************************************************************************** -SPARC strings for chip manufacturers -*****************************************************************************/ -static const char* sparc_mfg[] = { - "SPARC" -}; - -/***************************************************************************** -Default values are for Spitfire, 2MB E$, TI, and Spitfire clock -*****************************************************************************/ - -static long dss_chip_mode = 1; -static long dss_chip_impl = IMPL_SPITFIRE; -static long dss_chip_cache = TWO_MEG_CACHE; -static long dss_chip_manufacturer = TI_MANUFACTURER; -static long long dss_chip_speed = SPITFIRE_SPEED; -static int called_cpu_probe = 0; - -/***************************************************************************** -Assigns values based on the value of index. For this reason, the order of -the items array is important. -*****************************************************************************/ -static void assign_value(int index, long long val) { - if (index == 0) { /* clock-frequency */ - dss_chip_speed = val; - } - if (index == 1) { /* cpu-mhz */ - dss_chip_speed = val * 1000000; /* Scale since value was in MHz */ - } - else if ((index >= 2) && (index <= 4)) { - /* ecache-size, l2-cache-size, sectored-l2-cache-size */ - dss_chip_cache = val; - } - else if (index == 5) { - /* implementation# T1, T2, and Rock do not have this, see RFE 6615268 */ - dss_chip_impl = val; - if (dss_chip_impl == IMPL_SPITFIRE) { - dss_chip_mode = 1; - } - else if ((dss_chip_impl >= IMPL_BLACKBIRD) && - (dss_chip_impl <= IMPL_HUMMINGBIRD)) { - dss_chip_mode = 2; - } - else if ((dss_chip_impl >= IMPL_CHEETAH) && - (dss_chip_impl <= IMPL_PANTHER)) { - dss_chip_mode = 3; - } - else if (dss_chip_impl == IMPL_SPARC64_VI) { - dss_chip_mode = 4; - } - else if (dss_chip_impl == IMPL_NIAGARA) { - dss_chip_mode = 5; - } - else if (dss_chip_impl == IMPL_NIAGARA_2) { - dss_chip_mode = 6; - } - else if (dss_chip_impl == IMPL_SPARC64_VII) { - dss_chip_mode = 7; - } - else if (dss_chip_impl == IMPL_ROCK) { - dss_chip_mode = 8; - } - } - else if (index == 6) { /* manufacturer# */ - dss_chip_manufacturer = val; - } -} - -/***************************************************************************** -Assigns values based on the value of index. For this reason, the order of -the items array is important. -*****************************************************************************/ -static void assign_string_value(int index, char* string_val) { - - if (index == 7) { /* compatible */ - if (strncasecmp(string_val, "FJSV,SPARC64-VI", - PICL_PROPNAMELEN_MAX) == 0) { - dss_chip_mode = 4; - } - else if (strncasecmp(string_val, "SUNW,UltraSPARC-T1", - PICL_PROPNAMELEN_MAX) == 0) { - dss_chip_mode = 5; - } - else if (strncasecmp(string_val, "SUNW,UltraSPARC-T2", - PICL_PROPNAMELEN_MAX) == 0) { - dss_chip_mode = 6; - } - else if (strncasecmp(string_val, "FJSV,SPARC64-VII", - PICL_PROPNAMELEN_MAX) == 0) { - dss_chip_mode = 7; - } - else if (strncasecmp(string_val, "SUNW,Rock", - PICL_PROPNAMELEN_MAX) == 0) { - dss_chip_mode = 8; - } - } -} - -/***************************************************************************** -Gets called by probe_cpu. Cycles through the table values until we find -what we are looking for. -*****************************************************************************/ -static int search_table(int index, picl_prophdl_t table_hdl) { - - picl_prophdl_t col_hdl; - picl_prophdl_t row_hdl; - picl_propinfo_t p_info; - int val; - char string_val[PICL_PROPNAMELEN_MAX]; - - for (val = picl_get_next_by_col(table_hdl, &row_hdl); val != PICL_ENDOFLIST; - val = picl_get_next_by_col(row_hdl, &row_hdl)) { - if (val == PICL_SUCCESS) { - for (col_hdl = row_hdl; val != PICL_ENDOFLIST; - val = picl_get_next_by_row(col_hdl, &col_hdl)) { - if (val == PICL_SUCCESS) { - val = picl_get_propinfo(col_hdl, &p_info); - if (val == PICL_SUCCESS) { - if (p_info.type == PICL_PTYPE_CHARSTRING) { - val = picl_get_propval(col_hdl, &string_val, sizeof(string_val)); - if (val == PICL_SUCCESS) { - assign_string_value(index, string_val); - } - } - } - } - } - } - } -} - -/***************************************************************************** -Gets called by picl_walk_tree_by_class. Then it cycles through the properties -until we find what we are looking for. Once we are done, we return -PICL_WALK_TERMINATE to stop picl_walk_tree_by_class from traversing the tree. - -Note that PICL_PTYPE_UNSIGNED_INT and PICL_PTYPE_INT can either be 4-bytes -or 8-bytes. -*****************************************************************************/ -static int probe_cpu(picl_nodehdl_t node_hdl, void* dummy_arg) { - - picl_prophdl_t p_hdl; - picl_prophdl_t table_hdl; - picl_propinfo_t p_info; - long long long_long_val; - unsigned int uint_val; - int index; - int int_val; - int val; - char string_val[PICL_PROPNAMELEN_MAX]; - - val = picl_get_first_prop(node_hdl, &p_hdl); - while (val == PICL_SUCCESS) { - called_cpu_probe = 1; - val = picl_get_propinfo(p_hdl, &p_info); - if (val == PICL_SUCCESS) { - for (index = 0; index < NUM_ITEMS; index++) { - if (strcasecmp(p_info.name, items[index]) == 0) { - if (p_info.type == PICL_PTYPE_UNSIGNED_INT) { - if (p_info.size == sizeof(uint_val)) { - val = picl_get_propval(p_hdl, &uint_val, sizeof(uint_val)); - if (val == PICL_SUCCESS) { - long_long_val = uint_val; - assign_value(index, long_long_val); - } - } - else if (p_info.size == sizeof(long_long_val)) { - val = picl_get_propval(p_hdl, &long_long_val, - sizeof(long_long_val)); - if (val == PICL_SUCCESS) { - assign_value(index, long_long_val); - } - } - } - else if (p_info.type == PICL_PTYPE_INT) { - if (p_info.size == sizeof(int_val)) { - val = picl_get_propval(p_hdl, &int_val, sizeof(int_val)); - if (val == PICL_SUCCESS) { - long_long_val = int_val; - assign_value(index, long_long_val); - } - } - else if (p_info.size == sizeof(long_long_val)) { - val = picl_get_propval(p_hdl, &long_long_val, - sizeof(long_long_val)); - if (val == PICL_SUCCESS) { - assign_value(index, long_long_val); - } - } - } - else if (p_info.type == PICL_PTYPE_CHARSTRING) { - val = picl_get_propval(p_hdl, &string_val, sizeof(string_val)); - if (val == PICL_SUCCESS) { - assign_string_value(index, string_val); - } - } - else if (p_info.type == PICL_PTYPE_TABLE) { - val = picl_get_propval(p_hdl, &table_hdl, p_info.size); - if (val == PICL_SUCCESS) { - search_table(index, table_hdl); - } - } - break; - } - } - } - val = picl_get_next_prop(p_hdl, &p_hdl); - } - return PICL_WALK_TERMINATE; -} - - -/***************************************************************************** -Initializes, gets the root, then walks the picl tree looking for information - -Currently, the "core" class is only needed for OPL systems -*****************************************************************************/ -char* get_sparc_chip_manufacturer(void) { - - picl_nodehdl_t root; - int val; - static char chip_mfg[128]; - - val = picl_initialize(); - if (val != PICL_SUCCESS) { /* Can't initialize session with PICL daemon */ - return(NULL); - } - val = picl_get_root(&root); - if (val != PICL_SUCCESS) { /* Failed to get root node of the PICL tree */ - return(NULL); - } - val = picl_walk_tree_by_class(root, "cpu", (void *)NULL, probe_cpu); - val = picl_walk_tree_by_class(root, "core", (void *)NULL, probe_cpu); - picl_shutdown(); - - if (called_cpu_probe) { - memcpy(chip_mfg, sparc_mfg[0], strlen(sparc_mfg[0])); - } else { - /* no picl information on machine available */ - sysinfo(SI_HW_PROVIDER, chip_mfg, 128); - } - return(chip_mfg); -} - -/***************************************************************************** -Initializes, gets the root, then walks the picl tree looking for information - -Currently, the "core" class is only needed for OPL systems -*****************************************************************************/ -char *get_sparc_chip_mode(void) { - static char chip_mode[128]; - - if (called_cpu_probe) { - } else { - /* no picl information on machine available */ - sysinfo(SI_PLATFORM, chip_mode, 128); - } - return((char*)(sparc_modes[dss_chip_mode])); -} - diff --git a/opal/mca/sysinfo/solaris/chiptype.h b/opal/mca/sysinfo/solaris/chiptype.h deleted file mode 100644 index 9327a19ba3..0000000000 --- a/opal/mca/sysinfo/solaris/chiptype.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/* SPARC Chip Modes. */ -#define MODE_SPITFIRE 1 -#define MODE_BLACKBIRD 2 -#define MODE_CHEETAH 3 -#define MODE_SPARC64_VI 4 -#define MODE_T1 5 -#define MODE_T2 6 -#define MODE_SPARC64_VII 7 -#define MODE_ROCK 8 - -/* SPARC Chip Implementations. */ -#define IMPL_SPARC64_VI 0x6 -#define IMPL_SPARC64_VII 0x7 -#define IMPL_SPITFIRE 0x10 -#define IMPL_BLACKBIRD 0x11 -#define IMPL_SABRE 0x12 -#define IMPL_HUMMINGBIRD 0x13 -#define IMPL_CHEETAH 0x14 -#define IMPL_CHEETAHPLUS 0x15 -#define IMPL_JALAPENO 0x16 -#define IMPL_JAGUAR 0x18 -#define IMPL_PANTHER 0x19 -#define IMPL_NIAGARA 0x23 -#define IMPL_NIAGARA_2 0x24 -#define IMPL_ROCK 0x25 - -/* Default Mfg, Cache, Speed settings */ -#define TI_MANUFACTURER 0x17 -#define TWO_MEG_CACHE 2097152 -#define SPITFIRE_SPEED 142943750 - -char* get_sparc_chip_manufacturer(void); -char* get_sparc_chip_mode(void); - - diff --git a/opal/mca/sysinfo/solaris/configure.m4 b/opal/mca/sysinfo/solaris/configure.m4 deleted file mode 100644 index 24351f0ebb..0000000000 --- a/opal/mca/sysinfo/solaris/configure.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. -# -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -AC_DEFUN([MCA_opal_sysinfo_solaris_PRIORITY], [60]) - -# MCA_sysinfo_solaris_CONFIG(action-if-can-compile, -# [action-if-cant-compile]) -# ------------------------------------------------ -AC_DEFUN([MCA_opal_sysinfo_solaris_CONFIG],[ - AC_CONFIG_FILES([opal/mca/sysinfo/solaris/Makefile]) - - # check to see if we are on a solaris machine - case $host in - *solaris*) - if test "x$ompi_cv_c_compiler_vendor" = "xsun"; then - sysinfo_solaris_happy=yes - AC_MSG_NOTICE([*** Open MPI supports solaris sysinfo on this platform]) - else - sysinfo_solaris_happy=no - fi - ;; - *) - sysinfo_solaris_happy=no - AC_MSG_NOTICE([*** Open MPI does not support solaris sysinfo on this platform]) - ;; - esac - - AS_IF([test "$sysinfo_solaris_happy" = "yes"], - [OPAL_SETUP_COMPONENT_PACKAGE([sysinfo], - [solaris], - [libpicl], - [include/picl.h], - [lib/libpicl*], - [picl.h], - [picl], - [picl_initialize], - [], - [AC_CHECK_DECLS([MPOL_MF_MOVE]) - $1], - [$2])], - [$2]) -]) diff --git a/opal/mca/sysinfo/solaris/sysinfo_solaris.h b/opal/mca/sysinfo/solaris/sysinfo_solaris.h deleted file mode 100644 index 80f3891e5d..0000000000 --- a/opal/mca/sysinfo/solaris/sysinfo_solaris.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * System resource info for Solaris systems. - * - */ - - -#ifndef MCA_SYSINFO_SOLARIS_H -#define MCA_SYSINFO_SOLARIS_H - -#include "opal_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/sysinfo/sysinfo.h" - - -BEGIN_C_DECLS - -/** - * Globally exported variable - */ -OPAL_DECLSPEC extern const opal_sysinfo_base_component_t mca_sysinfo_solaris_component; - -OPAL_DECLSPEC extern const opal_sysinfo_base_module_t opal_sysinfo_solaris_module; - -END_C_DECLS -#endif /* MCA_SYSINFO_LINUX_H */ diff --git a/opal/mca/sysinfo/solaris/sysinfo_solaris_component.c b/opal/mca/sysinfo/solaris/sysinfo_solaris_component.c deleted file mode 100644 index 8c3013a615..0000000000 --- a/opal/mca/sysinfo/solaris/sysinfo_solaris_component.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include "opal_config.h" - -#include "opal/constants.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "sysinfo_solaris.h" - -/* - * Public string showing the sysinfo ompi_linux component version number - */ -const char *opal_sysinfo_solaris_component_version_string = - "OPAL solaris sysinfo MCA component version " OPAL_VERSION; - -/* - * Local function - */ -static int sysinfo_solaris_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ - -const opal_sysinfo_base_component_t mca_sysinfo_solaris_component = { - - /* First, the mca_component_t struct containing meta information - about the component itself */ - - { - OPAL_SYSINFO_BASE_VERSION_2_0_0, - - /* Component name and version */ - "solaris", - OPAL_MAJOR_VERSION, - OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION, - - /* Component open and close functions */ - NULL, - NULL, - sysinfo_solaris_component_query, - NULL, - }, - { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - } -}; - - -static int sysinfo_solaris_component_query(mca_base_module_t **module, int *priority) -{ - *priority = 20; - *module = (mca_base_module_t *)&opal_sysinfo_solaris_module; - - return OPAL_SUCCESS; -} - diff --git a/opal/mca/sysinfo/solaris/sysinfo_solaris_module.c b/opal/mca/sysinfo/solaris/sysinfo_solaris_module.c deleted file mode 100644 index a77fe13fb4..0000000000 --- a/opal/mca/sysinfo/solaris/sysinfo_solaris_module.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "opal/constants.h" - -/* This component will only be compiled on Linux, where we are - guaranteed to have and friends */ -#include -#include -#include -#include -#include -#include -#include - -#include /* for HZ to convert jiffies to actual time */ - -#include "opal/mca/base/mca_base_param.h" -#include "opal/dss/dss_types.h" -#include "opal/util/printf.h" - -#include "sysinfo_solaris.h" -#include "chiptype.h" - -/* - * Module functions - */ -static int solaris_module_init(void); -static int query(char **keys, opal_list_t *values); -static int solaris_module_fini(void); - -/* - * Solaris sysinfo module - */ -const opal_sysinfo_base_module_t opal_sysinfo_solaris_module = { - solaris_module_init, - query, - solaris_module_fini -}; - - -/* Local data */ -static int int_cpu_type=0; -static int int_cpu_model=0; -static char *cpu_type=NULL; -static char *cpu_model=NULL; -static int num_cpus=0; -static int64_t mem_size=0; -static char input[256]; - -static int solaris_module_init(void) -{ - FILE *fp; - char *data, *value, *ptr; - - /* Get CPU Type */ - cpu_type = get_sparc_chip_manufacturer(); - /* Get CPU Model */ - cpu_model = get_sparc_chip_mode(); - - /* Get number of cores */ - - /* get memory size */ - - return OPAL_SUCCESS; -} - -static int solaris_module_fini(void) -{ - return OPAL_SUCCESS; -} - -static int query(char **keys, opal_list_t *values) -{ - int i; - opal_sysinfo_value_t *data; - - /* cycle through the requested keys */ - for (i=0; NULL != keys[i]; i++) { - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_TYPE) && - NULL != cpu_type) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_TYPE); - data->type = OPAL_STRING; - data->data.str = strdup(cpu_type); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_CPU_MODEL) && - NULL != cpu_model) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_CPU_MODEL); - data->type = OPAL_STRING; - data->data.str = strdup(cpu_model); - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_NUM_CPUS) && - num_cpus > 0) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_NUM_CPUS); - data->type = OPAL_INT64; - data->data.i64 = (int64_t)num_cpus; - opal_list_append(values, &data->super); - continue; - } - if (0 == strcmp(keys[i], OPAL_SYSINFO_MEM_SIZE) && - mem_size > 0) { - data = OBJ_NEW(opal_sysinfo_value_t); - data->key = strdup(OPAL_SYSINFO_MEM_SIZE); - data->type = OPAL_INT64; - data->data.i64 = mem_size; - opal_list_append(values, &data->super); - continue; - } - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/sysinfo/sysinfo.h b/opal/mca/sysinfo/sysinfo.h deleted file mode 100644 index acfe55a673..0000000000 --- a/opal/mca/sysinfo/sysinfo.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * system resource info framework component interface. - * - * Intent - * - * self-discovery of available local resources. - * - */ - -#ifndef OPAL_MCA_SYSINFO_H -#define OPAL_MCA_SYSINFO_H - -#include "opal_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/class/opal_list.h" - -#include "opal/mca/sysinfo/sysinfo_types.h" - -BEGIN_C_DECLS - -/** - * Module initialization function. Should return OPAL_SUCCESS. - */ -typedef int (*opal_sysinfo_base_module_init_fn_t)(void); - -typedef int (*opal_sysinfo_base_module_query_fn_t)(char **keys, opal_list_t *values); - -typedef int (*opal_sysinfo_base_module_fini_fn_t)(void); - -/* Public API module */ -struct opal_sysinfo_API_module_1_0_0_t { - opal_sysinfo_base_module_query_fn_t query; -}; -typedef struct opal_sysinfo_API_module_1_0_0_t opal_sysinfo_API_module_t; - - -/** - * Structure for sysinfo components. - */ -struct opal_sysinfo_base_component_2_0_0_t { - /** MCA base component */ - mca_base_component_t base_version; - /** MCA base data */ - mca_base_component_data_t base_data; -}; - -/** - * Convenience typedef - */ -typedef struct opal_sysinfo_base_component_2_0_0_t opal_sysinfo_base_component_2_0_0_t; -typedef struct opal_sysinfo_base_component_2_0_0_t opal_sysinfo_base_component_t; - -/** - * Structure for sysinfo modules - */ -struct opal_sysinfo_base_module_1_0_0_t { - opal_sysinfo_base_module_init_fn_t init; - opal_sysinfo_base_module_query_fn_t query; - opal_sysinfo_base_module_fini_fn_t finalize; -}; - -/** - * Convenience typedef - */ -typedef struct opal_sysinfo_base_module_1_0_0_t opal_sysinfo_base_module_1_0_0_t; -typedef struct opal_sysinfo_base_module_1_0_0_t opal_sysinfo_base_module_t; - -typedef struct { - opal_list_item_t super; - opal_sysinfo_base_module_t *module; -} opal_sysinfo_module_t; -OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_sysinfo_module_t); - - -/** - * Macro for use in components that are of type sysinfo - */ -#define OPAL_SYSINFO_BASE_VERSION_2_0_0 \ - MCA_BASE_VERSION_2_0_0, \ - "sysinfo", 2, 0, 0 - -/* Global structure for accessing sysinfo functions */ -OPAL_DECLSPEC extern opal_sysinfo_API_module_t opal_sysinfo; - -END_C_DECLS - -#endif /* OPAL_MCA_SYSINFO_H */ diff --git a/opal/mca/sysinfo/sysinfo_types.h b/opal/mca/sysinfo/sysinfo_types.h deleted file mode 100644 index 0a3a4e8cac..0000000000 --- a/opal/mca/sysinfo/sysinfo_types.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * Resource flags - * - * Intent - * - * self-discovery of available local resources. - * - */ - -#ifndef OPAL_MCA_SYSINFO_TYPE_H -#define OPAL_MCA_SYSINFO_TYPE_H - -#include "opal_config.h" - -#include "opal/class/opal_list.h" -#include "opal/dss/dss_types.h" - -BEGIN_C_DECLS - -#define OPAL_SYSINFO_CPU_TYPE "CPU_TYPE" -#define OPAL_SYSINFO_CPU_MODEL "CPU_MODEL" -#define OPAL_SYSINFO_NUM_CPUS "NUM_CPUS" -#define OPAL_SYSINFO_MEM_SIZE "MEMORY" -#define OPAL_SYSINFO_HOST_TYPE "HOST_TYPE" - -typedef struct { - opal_list_item_t super; - char *key; - opal_data_type_t type; - union { - int64_t i64; - char *str; - } data; -} opal_sysinfo_value_t; -OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_sysinfo_value_t); - -END_C_DECLS - -#endif /* OPAL_MCA_SYSINFO_TYPE_H */ diff --git a/opal/runtime/opal_finalize.c b/opal/runtime/opal_finalize.c index 741451c104..1c2fca3372 100644 --- a/opal/runtime/opal_finalize.c +++ b/opal/runtime/opal_finalize.c @@ -42,6 +42,7 @@ #include "opal/mca/memory/base/base.h" #include "opal/mca/backtrace/base/base.h" #include "opal/mca/timer/base/base.h" +#include "opal/mca/hwloc/base/base.h" #include "opal/mca/paffinity/base/base.h" #include "opal/mca/event/base/base.h" #include "opal/runtime/opal_progress.h" @@ -150,6 +151,9 @@ opal_finalize(void) /* close the carto framework */ opal_carto_base_close(); + /* close the hwloc framework */ + opal_hwloc_base_close(); + /* close the processor affinity base */ opal_paffinity_base_close(); diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index 5bf968b688..0e9cda8501 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -37,6 +37,7 @@ #include "opal/mca/installdirs/base/base.h" #include "opal/mca/memory/base/base.h" #include "opal/mca/memcpy/base/base.h" +#include "opal/mca/hwloc/base/base.h" #include "opal/mca/paffinity/base/base.h" #include "opal/mca/timer/base/base.h" #include "opal/mca/memchecker/base/base.h" @@ -342,6 +343,14 @@ opal_init(int* pargc, char*** pargv) goto return_error; } + /* open hwloc - since this is a static framework, no + * select is required + */ + if (OPAL_SUCCESS != (ret = opal_hwloc_base_open())) { + error = "opal_paffinity_base_open"; + goto return_error; + } + /* open the processor affinity base */ if (OPAL_SUCCESS != (ret = opal_paffinity_base_open())) { error = "opal_paffinity_base_open"; diff --git a/orte/mca/db/dbm/db_dbm.c b/orte/mca/db/dbm/db_dbm.c index dd95e90731..dac4faa816 100644 --- a/orte/mca/db/dbm/db_dbm.c +++ b/orte/mca/db/dbm/db_dbm.c @@ -33,7 +33,6 @@ #include "opal/util/basename.h" #include "opal/mca/pstat/base/base.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/sysinfo/base/base.h" #include "orte/util/show_help.h" #include "orte/mca/errmgr/base/base.h" diff --git a/orte/mca/ess/alps/ess_alps_module.c b/orte/mca/ess/alps/ess_alps_module.c index 55691b0ca3..894f49e063 100644 --- a/orte/mca/ess/alps/ess_alps_module.c +++ b/orte/mca/ess/alps/ess_alps_module.c @@ -65,7 +65,6 @@ orte_ess_base_module_t orte_ess_alps_module = { orte_ess_base_proc_get_epoch, update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/base/Makefile.am b/orte/mca/ess/base/Makefile.am index 3e62bc70cd..cba71f6811 100644 --- a/orte/mca/ess/base/Makefile.am +++ b/orte/mca/ess/base/Makefile.am @@ -34,7 +34,6 @@ libmca_ess_la_SOURCES += \ base/ess_base_std_tool.c \ base/ess_base_std_app.c \ base/ess_base_std_orted.c \ - base/ess_base_std_prolog.c \ - base/ess_base_sysinfo.c + base/ess_base_std_prolog.c endif diff --git a/orte/mca/ess/base/ess_base_open.c b/orte/mca/ess/base/ess_base_open.c index 3f9a8ed3bd..a1aa7512b7 100644 --- a/orte/mca/ess/base/ess_base_open.c +++ b/orte/mca/ess/base/ess_base_open.c @@ -47,7 +47,6 @@ orte_ess_base_module_t orte_ess = { NULL, /* proc_get_epoch */ NULL, /* update_pidmap */ NULL, /* update_nidmap */ - NULL, /* query_sys_info */ NULL /* ft_event */ }; int orte_ess_base_output; diff --git a/orte/mca/ess/base/ess_base_std_orted.c b/orte/mca/ess/base/ess_base_std_orted.c index 7ec6503d03..d8a757695d 100644 --- a/orte/mca/ess/base/ess_base_std_orted.c +++ b/orte/mca/ess/base/ess_base_std_orted.c @@ -30,13 +30,13 @@ #include #endif +#include "opal/dss/dss.h" #include "opal/mca/event/event.h" -#include "orte/util/show_help.h" #include "opal/runtime/opal.h" #include "opal/runtime/opal_cr.h" +#include "opal/mca/hwloc/hwloc.h" #include "opal/mca/pstat/base/base.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/sysinfo/base/base.h" #include "opal/util/os_path.h" #include "orte/mca/rml/base/base.h" @@ -94,7 +94,6 @@ int orte_ess_base_orted_setup(char **hosts) char *jobidstring; char *error = NULL; char *plm_to_use; - int value; #ifndef __WINDOWS__ /* setup callback for SIGPIPE */ @@ -126,27 +125,52 @@ int orte_ess_base_orted_setup(char **hosts) OBJ_CONSTRUCT(&orte_local_children, opal_list_t); OBJ_CONSTRUCT(&orte_local_jobdata, opal_list_t); - /* determine the topology info */ - if (0 == orte_default_num_sockets_per_board) { - /* we weren't given a number, so try to determine it */ - if (OPAL_SUCCESS != opal_paffinity_base_get_socket_info(&value)) { - /* can't get any info - default to 1 */ - value = 1; - } - orte_default_num_sockets_per_board = (uint8_t)value; - } - if (0 == orte_default_num_cores_per_socket) { - /* we weren't given a number, so try to determine it */ - if (OPAL_SUCCESS != opal_paffinity_base_get_core_info(0, &value)) { - /* don't have topo info - can we at least get #processors? */ - if (OPAL_SUCCESS != opal_paffinity_base_get_processor_info(&value)) { - /* can't get any info - default to 1 */ - value = 1; +#if OPAL_HAVE_HWLOC + { + hwloc_obj_t obj; + int i, j; + + /* get the local topology */ + if (NULL == opal_hwloc_topology) { + if (0 != hwloc_topology_init(&opal_hwloc_topology) || + 0 != hwloc_topology_load(opal_hwloc_topology)) { + error = "topology discovery"; + goto error; } } - orte_default_num_cores_per_socket = (uint8_t)value; + + /* remove the hostname from the topology. Unfortunately, hwloc + * decided to add the source hostname to the "topology", thus + * rendering it unusable as a pure topological description. So + * we remove that information here. + */ + obj = hwloc_get_root_obj(opal_hwloc_topology); + for (i=0; i < obj->infos_count; i++) { + if (NULL == obj->infos[i].name || + NULL == obj->infos[i].value) { + continue; + } + if (0 == strncmp(obj->infos[i].name, "HostName", strlen("HostName"))) { + free(obj->infos[i].name); + free(obj->infos[i].value); + /* left justify the array */ + for (j=i; j < obj->infos_count-1; j++) { + obj->infos[j] = obj->infos[j+1]; + } + obj->infos[obj->infos_count-1].name = NULL; + obj->infos[obj->infos_count-1].value = NULL; + obj->infos_count--; + break; + } + } + + if (4 < opal_output_get_verbosity(orte_ess_base_output)) { + opal_output(0, "%s Topology Info:", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); + opal_dss.dump(0, opal_hwloc_topology, OPAL_HWLOC_TOPO); + } } - +#endif + /* open and setup the opal_pstat framework so we can provide * process stats if requested */ @@ -161,18 +185,6 @@ int orte_ess_base_orted_setup(char **hosts) goto error; } - /* open and setup the local resource discovery framework */ - if (ORTE_SUCCESS != (ret = opal_sysinfo_base_open())) { - ORTE_ERROR_LOG(ret); - error = "opal_sysinfo_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = opal_sysinfo_base_select())) { - ORTE_ERROR_LOG(ret); - error = "opal_sysinfo_base_select"; - goto error; - } - /* open the errmgr */ if (ORTE_SUCCESS != (ret = orte_errmgr_base_open())) { ORTE_ERROR_LOG(ret); @@ -577,9 +589,14 @@ int orte_ess_base_orted_finalize(void) orte_session_dir_cleanup(ORTE_JOBID_WILDCARD); /* handle the orted-specific OPAL stuff */ - opal_sysinfo_base_close(); opal_pstat_base_close(); - +#if OPAL_HAVE_HWLOC + /* destroy the topology, if required */ + if (NULL != opal_hwloc_topology) { + hwloc_topology_destroy(opal_hwloc_topology); + } +#endif + return ORTE_SUCCESS; } diff --git a/orte/mca/ess/base/ess_base_sysinfo.c b/orte/mca/ess/base/ess_base_sysinfo.c deleted file mode 100644 index d9bab36309..0000000000 --- a/orte/mca/ess/base/ess_base_sysinfo.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#include "opal/util/opal_environ.h" -#include "opal/util/if.h" -#include "opal/class/opal_list.h" -#include "opal/mca/sysinfo/sysinfo_types.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/odls/base/odls_private.h" -#include "orte/util/proc_info.h" -#include "orte/util/nidmap.h" -#include "orte/runtime/orte_globals.h" - -#include "orte/mca/ess/base/base.h" - -int orte_ess_base_query_sys_info(char *node, char **keys, opal_list_t *values) -{ - orte_nid_t *nid; - opal_sysinfo_value_t *sys, *sys2; - opal_list_item_t *item; - int i; - - /* we currently only support the local node */ - if (NULL != node && - (0 != strcmp(node, orte_process_info.nodename) || !opal_ifislocal(node))) { - return ORTE_SUCCESS; - } - - if (ORTE_PROC_IS_HNP || ORTE_PROC_IS_DAEMON) { - /* cycle through local sysinfo */ - for (i=0; NULL != keys[i]; i++) { - for (item = opal_list_get_first(&orte_odls_globals.sysinfo); - item != opal_list_get_end(&orte_odls_globals.sysinfo); - item = opal_list_get_next(item)) { - sys = (opal_sysinfo_value_t*)item; - if (0 != strcmp(keys[i], sys->key)) { - continue; - } - /* matched - pass the value back */ - sys2 = OBJ_NEW(opal_sysinfo_value_t); - sys2->key = strdup(sys->key); - sys2->type = sys->type; - if (OPAL_STRING == sys->type) { - sys2->data.str = strdup(sys->data.str); - } else { - sys2->data.i64 = sys->data.i64; - } - } - } - return ORTE_SUCCESS; - } - - /* get the nid of our local node */ - if (NULL == (nid = orte_util_lookup_nid(ORTE_PROC_MY_NAME))) { - /* can't get it */ - return ORTE_ERR_NOT_FOUND; - } - - /* cycle through this node's attributes looking for the keys */ - for (i=0; NULL != keys[i]; i++) { - for (item = opal_list_get_first(&nid->sysinfo); - item != opal_list_get_end(&nid->sysinfo); - item = opal_list_get_next(item)) { - sys = (opal_sysinfo_value_t*)item; - - if (0 != strcmp(keys[i], sys->key)) { - continue; - } - /* matched - pass the value back */ - sys2 = OBJ_NEW(opal_sysinfo_value_t); - sys2->key = strdup(sys->key); - sys2->type = sys->type; - if (OPAL_STRING == sys->type) { - sys2->data.str = strdup(sys->data.str); - } else { - sys2->data.i64 = sys->data.i64; - } - opal_list_append(values, &sys2->super); - /* can only be one entry for each key */ - break; - } - } - - return ORTE_SUCCESS; -} diff --git a/orte/mca/ess/cnos/ess_cnos_module.c b/orte/mca/ess/cnos/ess_cnos_module.c index fc0108c64d..45c09ac745 100644 --- a/orte/mca/ess/cnos/ess_cnos_module.c +++ b/orte/mca/ess/cnos/ess_cnos_module.c @@ -47,7 +47,6 @@ static uint8_t proc_get_locality(orte_process_name_t *proc); static char* proc_get_hostname(orte_process_name_t *proc); static orte_local_rank_t proc_get_local_rank(orte_process_name_t *proc); static orte_node_rank_t proc_get_node_rank(orte_process_name_t *proc); -static int query_sys_info(char *node, char **keys, opal_list_t *values); orte_ess_base_module_t orte_ess_cnos_module = { rte_init, @@ -61,7 +60,6 @@ orte_ess_base_module_t orte_ess_cnos_module = { orte_ess_base_proc_get_epoch, /* get_epoch */ NULL, /* add_pidmap is only used in ORTE */ NULL, /* update_nidmap is only used in ORTE */ - query_sys_info, NULL /* ft_event */ }; @@ -165,7 +163,3 @@ static orte_node_rank_t proc_get_node_rank(orte_process_name_t *proc) return 0; } -static int query_sys_info(char *node, char **keys, opal_list_t *values) -{ - return ORTE_SUCCESS; -} diff --git a/orte/mca/ess/env/ess_env_module.c b/orte/mca/ess/env/ess_env_module.c index ed7e056e14..2b99c62769 100644 --- a/orte/mca/ess/env/ess_env_module.c +++ b/orte/mca/ess/env/ess_env_module.c @@ -103,7 +103,6 @@ orte_ess_base_module_t orte_ess_env_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, #if OPAL_ENABLE_FT_CR == 1 rte_ft_event #else diff --git a/orte/mca/ess/ess.h b/orte/mca/ess/ess.h index ffad3ded03..0f1e194990 100644 --- a/orte/mca/ess/ess.h +++ b/orte/mca/ess/ess.h @@ -136,15 +136,6 @@ typedef int (*orte_ess_base_module_update_pidmap_fn_t)(opal_byte_object_t *bo); */ typedef int (*orte_ess_base_module_update_nidmap_fn_t)(opal_byte_object_t *bo); -/** - * Query node configuration info - * - * Request information on the system capabilities of a specific node. A NULL nodename - * indicates that the local node info is requested. An empty list of results is - * returned on systems that do not support this functionality. - */ -typedef int (*orte_ess_base_module_query_sys_info_t)(char *node, char **keys, opal_list_t *values); - /** * Handle fault tolerance updates * @@ -170,7 +161,6 @@ struct orte_ess_base_module_1_0_0_t { orte_ess_base_module_proc_get_epoch_fn_t proc_get_epoch; orte_ess_base_module_update_pidmap_fn_t update_pidmap; orte_ess_base_module_update_nidmap_fn_t update_nidmap; - orte_ess_base_module_query_sys_info_t query_sys_info; orte_ess_base_module_ft_event_fn_t ft_event; }; typedef struct orte_ess_base_module_1_0_0_t orte_ess_base_module_1_0_0_t; diff --git a/orte/mca/ess/generic/ess_generic_module.c b/orte/mca/ess/generic/ess_generic_module.c index 5df7c973d1..484af43921 100644 --- a/orte/mca/ess/generic/ess_generic_module.c +++ b/orte/mca/ess/generic/ess_generic_module.c @@ -98,7 +98,6 @@ orte_ess_base_module_t orte_ess_generic_module = { orte_ess_base_proc_get_epoch, update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL }; diff --git a/orte/mca/ess/hnp/ess_hnp_module.c b/orte/mca/ess/hnp/ess_hnp_module.c index 0d2a477a71..ef49542eb4 100644 --- a/orte/mca/ess/hnp/ess_hnp_module.c +++ b/orte/mca/ess/hnp/ess_hnp_module.c @@ -42,7 +42,7 @@ #include "opal/util/basename.h" #include "opal/mca/pstat/base/base.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/sysinfo/base/base.h" +#include "opal/mca/hwloc/hwloc.h" #include "orte/mca/rml/base/base.h" #include "orte/mca/rml/rml_types.h" @@ -112,7 +112,6 @@ orte_ess_base_module_t orte_ess_hnp_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; @@ -142,7 +141,6 @@ static int rte_init(void) orte_node_t *node; orte_proc_t *proc; orte_app_context_t *app; - int value; /* run the prolog */ if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) { @@ -185,27 +183,52 @@ static int rte_init(void) signals_set = true; - /* determine the topology info */ - if (0 == orte_default_num_sockets_per_board) { - /* we weren't given a number, so try to determine it */ - if (OPAL_SUCCESS != opal_paffinity_base_get_socket_info(&value)) { - /* can't get any info - default to 1 */ - value = 1; - } - orte_default_num_sockets_per_board = (uint8_t)value; - } - if (0 == orte_default_num_cores_per_socket) { - /* we weren't given a number, so try to determine it */ - if (OPAL_SUCCESS != (ret = opal_paffinity_base_get_core_info(0, &value))) { - /* don't have topo info - can we at least get #processors? */ - if (OPAL_SUCCESS != opal_paffinity_base_get_processor_info(&value)) { - /* can't get any info - default to 1 */ - value = 1; +#if OPAL_HAVE_HWLOC + { + hwloc_obj_t obj; + int i, j; + + /* get the local topology */ + if (NULL == opal_hwloc_topology) { + if (0 != hwloc_topology_init(&opal_hwloc_topology) || + 0 != hwloc_topology_load(opal_hwloc_topology)) { + error = "topology discovery"; + goto error; } } - orte_default_num_cores_per_socket = (uint8_t)value; + + /* remove the hostname from the topology. Unfortunately, hwloc + * decided to add the source hostname to the "topology", thus + * rendering it unusable as a pure topological description. So + * we remove that information here. + */ + obj = hwloc_get_root_obj(opal_hwloc_topology); + for (i=0; i < obj->infos_count; i++) { + if (NULL == obj->infos[i].name || + NULL == obj->infos[i].value) { + continue; + } + if (0 == strncmp(obj->infos[i].name, "HostName", strlen("HostName"))) { + free(obj->infos[i].name); + free(obj->infos[i].value); + /* left justify the array */ + for (j=i; j < obj->infos_count-1; j++) { + obj->infos[j] = obj->infos[j+1]; + } + obj->infos[obj->infos_count-1].name = NULL; + obj->infos[obj->infos_count-1].value = NULL; + obj->infos_count--; + break; + } + } + + if (4 < opal_output_get_verbosity(orte_ess_base_output)) { + opal_output(0, "%s Topology Info:", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); + opal_dss.dump(0, opal_hwloc_topology, OPAL_HWLOC_TOPO); + } } - +#endif + /* if we are using xml for output, put an mpirun start tag */ if (orte_xml_output) { fprintf(orte_xml_fp, "\n"); @@ -226,18 +249,6 @@ static int rte_init(void) goto error; } - /* open and setup the local resource discovery framework */ - if (ORTE_SUCCESS != (ret = opal_sysinfo_base_open())) { - ORTE_ERROR_LOG(ret); - error = "opal_sysinfo_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = opal_sysinfo_base_select())) { - ORTE_ERROR_LOG(ret); - error = "opal_sysinfo_base_select"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_errmgr_base_open())) { error = "orte_errmgr_base_open"; goto error; @@ -473,7 +484,15 @@ static int rte_init(void) error = "setup node array"; goto error; } - + orte_node_topologies = OBJ_NEW(opal_pointer_array_t); + if (ORTE_SUCCESS != (ret = opal_pointer_array_init(orte_node_topologies, + ORTE_GLOBAL_ARRAY_BLOCK_SIZE, + ORTE_GLOBAL_ARRAY_MAX_SIZE, + ORTE_GLOBAL_ARRAY_BLOCK_SIZE))) { + ORTE_ERROR_LOG(ret); + error = "setup node topologies array"; + goto error; + } /* Setup the job data object for the daemons */ /* create and store the job data object */ jdata = OBJ_NEW(orte_job_t); @@ -489,6 +508,10 @@ static int rte_init(void) node = OBJ_NEW(orte_node_t); node->name = strdup(orte_process_info.nodename); node->index = opal_pointer_array_set_item(orte_node_pool, 0, node); +#if OPAL_HAVE_HWLOC + /* point our topology to the one detected locally */ + node->topology = opal_hwloc_topology; +#endif /* create and store a proc object for us */ proc = OBJ_NEW(orte_proc_t); @@ -792,8 +815,13 @@ static int rte_finalize(void) } /* handle the orted-specific OPAL stuff */ - opal_sysinfo_base_close(); opal_pstat_base_close(); +#if OPAL_HAVE_HWLOC + /* destroy the topology, if required */ + if (NULL != opal_hwloc_topology) { + hwloc_topology_destroy(opal_hwloc_topology); + } +#endif return ORTE_SUCCESS; } diff --git a/orte/mca/ess/lsf/ess_lsf_module.c b/orte/mca/ess/lsf/ess_lsf_module.c index 1a3de62ffb..dc701e5b48 100644 --- a/orte/mca/ess/lsf/ess_lsf_module.c +++ b/orte/mca/ess/lsf/ess_lsf_module.c @@ -71,7 +71,6 @@ orte_ess_base_module_t orte_ess_lsf_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/portals4_shmem/ess_portals4_shmem_module.c b/orte/mca/ess/portals4_shmem/ess_portals4_shmem_module.c index da8f3eaace..7f176e6c09 100644 --- a/orte/mca/ess/portals4_shmem/ess_portals4_shmem_module.c +++ b/orte/mca/ess/portals4_shmem/ess_portals4_shmem_module.c @@ -45,7 +45,6 @@ static uint8_t proc_get_locality(orte_process_name_t *proc); static char* proc_get_hostname(orte_process_name_t *proc); static orte_local_rank_t proc_get_local_rank(orte_process_name_t *proc); static orte_node_rank_t proc_get_node_rank(orte_process_name_t *proc); -static int query_sys_info(char *node, char **keys, opal_list_t *values); orte_ess_base_module_t orte_ess_portals4_shmem_module = { rte_init, @@ -59,7 +58,6 @@ orte_ess_base_module_t orte_ess_portals4_shmem_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ NULL, /* add_pidmap is only used in ORTE */ NULL, /* update_nidmap is only used in ORTE */ - query_sys_info, NULL /* ft_event */ }; @@ -156,8 +154,3 @@ static orte_node_rank_t proc_get_node_rank(orte_process_name_t *proc) { return 0; } - -static int query_sys_info(char *node, char **keys, opal_list_t *values) -{ - return ORTE_SUCCESS; -} diff --git a/orte/mca/ess/singleton/ess_singleton_module.c b/orte/mca/ess/singleton/ess_singleton_module.c index f1c56c0bd4..26fa6b94da 100644 --- a/orte/mca/ess/singleton/ess_singleton_module.c +++ b/orte/mca/ess/singleton/ess_singleton_module.c @@ -38,7 +38,6 @@ #include "opal/util/path.h" #include "opal/util/opal_sos.h" #include "opal/mca/base/mca_base_param.h" -#include "opal/mca/sysinfo/sysinfo.h" #include "opal/mca/installdirs/installdirs.h" #include "opal/mca/paffinity/paffinity.h" @@ -91,7 +90,6 @@ orte_ess_base_module_t orte_ess_singleton_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/slave/ess_slave_module.c b/orte/mca/ess/slave/ess_slave_module.c index 71da3c9d8a..8779c557da 100644 --- a/orte/mca/ess/slave/ess_slave_module.c +++ b/orte/mca/ess/slave/ess_slave_module.c @@ -101,7 +101,6 @@ orte_ess_base_module_t orte_ess_slave_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, #if OPAL_ENABLE_FT_CR == 1 rte_ft_event #else diff --git a/orte/mca/ess/slurm/ess_slurm_module.c b/orte/mca/ess/slurm/ess_slurm_module.c index 541e4fce14..b97f524cd1 100644 --- a/orte/mca/ess/slurm/ess_slurm_module.c +++ b/orte/mca/ess/slurm/ess_slurm_module.c @@ -75,7 +75,6 @@ orte_ess_base_module_t orte_ess_slurm_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/slurmd/ess_slurmd_module.c b/orte/mca/ess/slurmd/ess_slurmd_module.c index 5a26109f9c..37a8349520 100644 --- a/orte/mca/ess/slurmd/ess_slurmd_module.c +++ b/orte/mca/ess/slurmd/ess_slurmd_module.c @@ -84,7 +84,6 @@ orte_ess_base_module_t orte_ess_slurmd_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/tm/ess_tm_module.c b/orte/mca/ess/tm/ess_tm_module.c index 0c7a830e00..adcedd84a9 100644 --- a/orte/mca/ess/tm/ess_tm_module.c +++ b/orte/mca/ess/tm/ess_tm_module.c @@ -73,7 +73,6 @@ orte_ess_base_module_t orte_ess_tm_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ update_pidmap, update_nidmap, - orte_ess_base_query_sys_info, NULL /* ft_event */ }; diff --git a/orte/mca/ess/tool/ess_tool_module.c b/orte/mca/ess/tool/ess_tool_module.c index 9fa3d86554..e779265927 100644 --- a/orte/mca/ess/tool/ess_tool_module.c +++ b/orte/mca/ess/tool/ess_tool_module.c @@ -45,7 +45,6 @@ static int rte_init(void); static void rte_abort(int status, bool report) __opal_attribute_noreturn__; static orte_vpid_t proc_get_daemon(orte_process_name_t *proc); -static int query_sys_info(char *node, char **keys, opal_list_t *values); orte_ess_base_module_t orte_ess_tool_module = { @@ -60,7 +59,6 @@ orte_ess_base_module_t orte_ess_tool_module = { orte_ess_base_proc_get_epoch, /* proc_get_epoch */ NULL, /* don't need to update_pidmap */ NULL, /* don't need to update_nidmap */ - query_sys_info, NULL /* ft_event */ }; @@ -157,8 +155,3 @@ static orte_vpid_t proc_get_daemon(orte_process_name_t *proc) { return ORTE_VPID_INVALID; } - -static int query_sys_info(char *node, char **keys, opal_list_t *values) -{ - return ORTE_SUCCESS; -} diff --git a/orte/mca/odls/base/odls_base_close.c b/orte/mca/odls/base/odls_base_close.c index f959f8c6bc..81bac5e442 100644 --- a/orte/mca/odls/base/odls_base_close.c +++ b/orte/mca/odls/base/odls_base_close.c @@ -61,12 +61,6 @@ int orte_odls_base_close(void) OBJ_DESTRUCT(&orte_local_jobdata_lock); OBJ_DESTRUCT(&orte_local_jobdata_cond); - /* cleanup the sysinfo data */ - while (NULL != (item = opal_list_remove_first(&orte_odls_globals.sysinfo))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&orte_odls_globals.sysinfo); - /* if no components are available, then punt */ if (!orte_odls_base.components_available) { return ORTE_SUCCESS; diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index bdd0ec782a..049739e66d 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -2189,8 +2189,12 @@ int orte_odls_base_default_require_sync(orte_process_name_t *proc, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); opal_dss.pack(&buffer, &orte_odls_globals.dmap, 1, OPAL_BYTE_OBJECT); opal_dss.pack(&buffer, &jobdat->pmap, 1, OPAL_BYTE_OBJECT); - /* add the local system info */ - orte_util_encode_sysinfo(&buffer, &orte_odls_globals.sysinfo); +#if OPAL_HAVE_HWLOC + /* send the local topology so the individual apps + * don't hammer the system to collect it themselves + */ + opal_dss.pack(&buffer, &opal_hwloc_topology, 1, OPAL_HWLOC_TOPO); +#endif } } diff --git a/orte/mca/odls/base/odls_base_open.c b/orte/mca/odls/base/odls_base_open.c index 5f4d958b8d..8902a9f6d4 100644 --- a/orte/mca/odls/base/odls_base_open.c +++ b/orte/mca/odls/base/odls_base_open.c @@ -30,8 +30,8 @@ #include "opal/mca/mca.h" #include "opal/mca/base/base.h" #include "opal/mca/base/mca_base_param.h" +#include "opal/mca/hwloc/hwloc.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/sysinfo/sysinfo.h" #include "opal/util/output.h" #include "opal/util/path.h" #include "opal/util/argv.h" @@ -92,18 +92,9 @@ int orte_odls_base_open(void) int i, rank, sock, core; orte_namelist_t *nm; bool xterm_hold; - char *keys[] = { - OPAL_SYSINFO_CPU_TYPE, - OPAL_SYSINFO_CPU_MODEL, - OPAL_SYSINFO_NUM_CPUS, - OPAL_SYSINFO_MEM_SIZE, - NULL - }; - opal_list_item_t *item; - opal_sysinfo_value_t *info; /* Debugging / verbose output. Always have stream open, with - verbose set by the mca open system... */ + verbose set by the mca open system... */ orte_odls_globals.output = opal_output_open(NULL); mca_base_param_reg_int_name("odls", "base_sigkill_timeout", @@ -133,7 +124,6 @@ int orte_odls_base_open(void) orte_odls_globals.dmap = NULL; orte_odls_globals.debugger = NULL; orte_odls_globals.debugger_launched = false; - OBJ_CONSTRUCT(&orte_odls_globals.sysinfo, opal_list_t); /* get any external processor bindings */ OPAL_PAFFINITY_CPU_ZERO(orte_odls_globals.my_cores); @@ -221,33 +211,27 @@ int orte_odls_base_open(void) opal_argv_append_nosize(&orte_odls_globals.xtermcmd, "-e"); } - /* collect the system info */ - if (NULL != opal_sysinfo.query) { - /* get and store our local resources */ - opal_sysinfo.query(keys, &orte_odls_globals.sysinfo); - /* find our cpu model and type, save it for later */ - for (item = opal_list_get_first(&orte_odls_globals.sysinfo); - item != opal_list_get_end(&orte_odls_globals.sysinfo) && - (NULL == orte_local_cpu_type || NULL == orte_local_cpu_model); - item = opal_list_get_next(item)) { - info = (opal_sysinfo_value_t*)item; - - if (0 == strcmp(info->key, OPAL_SYSINFO_CPU_TYPE)) { - orte_local_cpu_type = strdup(info->data.str); - } - if (0 == strcmp(info->key, OPAL_SYSINFO_CPU_MODEL)) { - orte_local_cpu_model = strdup(info->data.str); - } +#if OPAL_HAVE_HWLOC + { + hwloc_obj_t obj; + /* get the root object */ + obj = hwloc_get_obj_by_depth(opal_hwloc_topology, 0, 0); + if (NULL == orte_local_cpu_type && NULL != obj->name) { + orte_local_cpu_type = strdup(obj->name); + } + if (NULL == orte_local_cpu_model && NULL != obj->name) { + orte_local_cpu_model = strdup(obj->name); } } - +#endif + /* Open up all available components */ if (ORTE_SUCCESS != mca_base_components_open("odls", orte_odls_globals.output, mca_odls_base_static_components, &orte_odls_base.available_components, true)) { - return ORTE_ERROR; - } + return ORTE_ERROR; + } /* are there components available for use ? - * orte_odls_base.available_components is always initialized */ diff --git a/orte/mca/odls/base/odls_private.h b/orte/mca/odls/base/odls_private.h index 047b3e4453..7008863107 100644 --- a/orte/mca/odls/base/odls_private.h +++ b/orte/mca/odls/base/odls_private.h @@ -78,8 +78,6 @@ typedef struct { opal_bitmap_t sockets; /* number of sockets available to us */ int num_sockets; - /* system capabilities */ - opal_list_t sysinfo; } orte_odls_globals_t; ORTE_DECLSPEC extern orte_odls_globals_t orte_odls_globals; diff --git a/orte/mca/plm/base/plm_base_launch_support.c b/orte/mca/plm/base/plm_base_launch_support.c index 3a53d9eefb..662f6d5b06 100644 --- a/orte/mca/plm/base/plm_base_launch_support.c +++ b/orte/mca/plm/base/plm_base_launch_support.c @@ -36,7 +36,7 @@ #include "opal/class/opal_pointer_array.h" #include "opal/dss/dss.h" #include "opal/mca/base/mca_base_param.h" -#include "opal/mca/sysinfo/sysinfo.h" +#include "opal/mca/hwloc/hwloc.h" #include "orte/util/show_help.h" #include "orte/mca/errmgr/errmgr.h" @@ -416,12 +416,8 @@ static void process_orted_launch_report(int fd, short event, void *data) int64_t setupsec, setupusec; int64_t startsec, startusec; orte_proc_t *daemon=NULL; - int32_t i, num_values; - opal_sysinfo_value_t *info; - orte_node_t *node; char *nodename; - opal_list_item_t *item; - + /* see if we need to timestamp this receipt */ if (orte_timing) { gettimeofday(&recvtime, NULL); @@ -542,57 +538,55 @@ static void process_orted_launch_report(int fd, short event, void *data) goto CLEANUP; } +#if OPAL_HAVE_HWLOC && OPAL_HAVE_HWLOC_XML /* store the local resources for that node */ - idx=1; - node = daemon->node; - if (OPAL_SUCCESS == opal_dss.unpack(buffer, &num_values, &idx, OPAL_INT32) && - 0 < num_values) { - /* clear the old list, if it exists */ - while (NULL != (item = opal_list_remove_first(&node->resources))) { - OBJ_RELEASE(item); - } - for (i=0; i < num_values; i++) { - info = OBJ_NEW(opal_sysinfo_value_t); - idx=1; - if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &info->key, &idx, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - orted_failed_launch = true; - goto CLEANUP; - } - idx=1; - if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &info->type, &idx, OPAL_DATA_TYPE_T))) { - ORTE_ERROR_LOG(rc); - orted_failed_launch = true; - goto CLEANUP; - } - idx=1; - if (OPAL_INT64 == info->type) { - if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &(info->data.i64), &idx, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - orted_failed_launch = true; - goto CLEANUP; + { + hwloc_topology_t topo, t; + orte_node_t *node; + int i; + bool found; + + idx=1; + node = daemon->node; + if (OPAL_SUCCESS == opal_dss.unpack(buffer, &topo, &idx, OPAL_HWLOC_TOPO)) { + /* do we already have this topology from some other node? */ + found = false; + for (i=0; i < orte_node_topologies->size; i++) { + if (NULL == (t = (hwloc_topology_t)opal_pointer_array_get_item(orte_node_topologies, i))) { + continue; } - } else if (OPAL_STRING == info->type) { - if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &(info->data.str), &idx, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - orted_failed_launch = true; - goto CLEANUP; + OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output, + "%s RECEIVED TOPOLOGY FROM NODE %s", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), nodename)); + if (OPAL_EQUAL == opal_dss.compare(topo, t, OPAL_HWLOC_TOPO)) { + /* yes - just point to it */ + OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output, + "%s TOPOLOGY MATCHES - DISCARDING", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); + found = true; + node->topology = t; + hwloc_topology_destroy(topo); + break; } } - OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output, - "%s adding resource %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - info->key)); - opal_list_append(&node->resources, &info->super); + if (!found) { + /* nope - add it */ + OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output, + "%s NEW TOPOLOGY - ADDING", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); + opal_pointer_array_add(orte_node_topologies, topo); + node->topology = topo; + } } } +#endif /* if a tree-launch is underway, send the cmd back */ if (NULL != orte_tree_launch_cmd) { orte_rml.send_buffer(&peer, orte_tree_launch_cmd, ORTE_RML_TAG_DAEMON, 0); } -CLEANUP: + CLEANUP: OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output, "%s plm:base:orted_report_launch %s for daemon %s (via %s) at contact %s", diff --git a/orte/mca/plm/xgrid/.ompi_ignore b/orte/mca/plm/xgrid/.ompi_ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/orte/mca/rmaps/base/rmaps_base_support_fns.c b/orte/mca/rmaps/base/rmaps_base_support_fns.c index f37fbda21b..dbcbb14ba4 100644 --- a/orte/mca/rmaps/base/rmaps_base_support_fns.c +++ b/orte/mca/rmaps/base/rmaps_base_support_fns.c @@ -31,7 +31,6 @@ #include "opal/mca/base/base.h" #include "opal/mca/base/mca_base_param.h" #include "orte/mca/ess/ess.h" -#include "opal/mca/sysinfo/sysinfo_types.h" #include "orte/types.h" #include "orte/util/show_help.h" @@ -51,14 +50,11 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr_t *total_num_slots, orte_app_context_t *app, orte_mapping_policy_t policy) { - opal_list_item_t *item, *item2, *item3, *next; + opal_list_item_t *item, *next; orte_node_t *node; orte_std_cntr_t num_slots; orte_std_cntr_t i; int rc; - bool found; - opal_sysinfo_value_t *req_res, *ninfo; - char **vals; /** set default answer */ *total_num_slots = 0; @@ -197,6 +193,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr } /* finally, filter thru any resource constraints */ +#if 0 for (item = opal_list_get_first(&app->resource_constraints); item != opal_list_get_end(&app->resource_constraints); item = opal_list_get_next(item)) { @@ -265,6 +262,7 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr item2 = next; } } +#endif /* If the "no local" option was set, then remove the local node * from the list diff --git a/orte/orted/orted_main.c b/orte/orted/orted_main.c index d8487c3dbd..12addd1626 100644 --- a/orte/orted/orted_main.c +++ b/orte/orted/orted_main.c @@ -60,7 +60,7 @@ #include "opal/mca/base/mca_base_param.h" #include "opal/util/daemon_init.h" #include "opal/dss/dss.h" -#include "opal/mca/sysinfo/sysinfo.h" +#include "opal/mca/hwloc/hwloc.h" #include "orte/util/show_help.h" #include "orte/util/proc_info.h" @@ -638,30 +638,18 @@ int orte_daemon(int argc, char *argv[]) goto DONE; } } else { - opal_list_item_t *item; - opal_sysinfo_value_t *info; - int32_t num_values; - /* include our node name */ opal_dss.pack(buffer, &orte_process_info.nodename, 1, OPAL_STRING); - /* add number of sysinfo values to the buffer */ - num_values = opal_list_get_size(&orte_odls_globals.sysinfo); - opal_dss.pack(buffer, &num_values, 1, OPAL_INT32); - /* add them to the buffer */ - for (item = opal_list_get_first(&orte_odls_globals.sysinfo); - item != opal_list_get_end(&orte_odls_globals.sysinfo); - item = opal_list_get_next(item)) { - info = (opal_sysinfo_value_t*)item; - opal_dss.pack(buffer, &info->key, 1, OPAL_STRING); - opal_dss.pack(buffer, &info->type, 1, OPAL_DATA_TYPE_T); - if (OPAL_INT64 == info->type) { - opal_dss.pack(buffer, &(info->data.i64), 1, OPAL_INT64); - } else if (OPAL_STRING == info->type) { - opal_dss.pack(buffer, &(info->data.str), 1, OPAL_STRING); +#if OPAL_HAVE_HWLOC && OPAL_HAVE_HWLOC_XML + /* add the local topology */ + if (NULL != opal_hwloc_topology) { + if (ORTE_SUCCESS != (ret = opal_dss.pack(buffer, &opal_hwloc_topology, 1, OPAL_HWLOC_TOPO))) { + ORTE_ERROR_LOG(ret); } } - +#endif + /* send to the HNP's callback - this will flow up the routing * tree if static ports are enabled */ diff --git a/orte/runtime/data_type_support/orte_dt_print_fns.c b/orte/runtime/data_type_support/orte_dt_print_fns.c index a012c9f424..0ff2ac1751 100644 --- a/orte/runtime/data_type_support/orte_dt_print_fns.c +++ b/orte/runtime/data_type_support/orte_dt_print_fns.c @@ -23,8 +23,6 @@ #include #include "opal/util/argv.h" -#include "opal/util/opal_sos.h" -#include "opal/mca/sysinfo/sysinfo.h" #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/rmaps/base/base.h" @@ -302,8 +300,6 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_ int32_t i; int rc; orte_proc_t *proc; - opal_list_item_t *item; - opal_sysinfo_value_t *info; /* set default result */ *output = NULL; @@ -411,25 +407,24 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_ free(tmp); tmp = tmp2; - asprintf(&tmp2, "%s\n%s\tDetected Resources:", tmp, pfx2); - free(tmp); - tmp = tmp2; - - for (item = opal_list_get_first(&src->resources); - item != opal_list_get_end(&src->resources); - item = opal_list_get_next(item)) { - info = (opal_sysinfo_value_t*)item; - if (OPAL_INT64 == info->type) { - asprintf(&tmp2, "%s\n%s\t\t%s: %ld", tmp, pfx2, - info->key, (long int)info->data.i64); - } else if (OPAL_STRING == info->type) { - asprintf(&tmp2, "%s\n%s\t\t%s: %s", tmp, pfx2, - info->key, info->data.str); - } +#if OPAL_HAVE_HWLOC + if (NULL != src->topology) { + char *pfx3; + asprintf(&tmp2, "%s\n%s\tDetected Resources:", tmp, pfx2); free(tmp); - tmp = tmp2; - } + tmp = tmp2; + tmp2 = NULL; + asprintf(&pfx3, "%s\t", pfx2); + opal_dss.print(&tmp2, pfx3, src->topology, OPAL_HWLOC_TOPO); + free(pfx3); + asprintf(&tmp3, "%s%s", tmp, tmp2); + free(tmp); + free(tmp2); + tmp = tmp3; + } +#endif + asprintf(&tmp2, "%s\n%s\tNum procs: %ld\tNext node_rank: %ld", tmp, pfx2, (long)src->num_procs, (long)src->next_node_rank); free(tmp); diff --git a/orte/runtime/orte_globals.c b/orte/runtime/orte_globals.c index e5ef3a2a22..f51c22c42d 100644 --- a/orte/runtime/orte_globals.c +++ b/orte/runtime/orte_globals.c @@ -106,6 +106,7 @@ opal_buffer_t *orte_tree_launch_cmd = NULL; /* global arrays for data storage */ opal_pointer_array_t *orte_job_data; opal_pointer_array_t *orte_node_pool; +opal_pointer_array_t *orte_node_topologies; /* a clean output channel without prefix */ int orte_clean_output = -1; @@ -846,7 +847,9 @@ static void orte_node_construct(orte_node_t* node) node->username = NULL; - OBJ_CONSTRUCT(&node->resources, opal_list_t); +#if OPAL_HAVE_HWLOC + node->topology = NULL; +#endif OBJ_CONSTRUCT(&node->stats, opal_ring_buffer_t); opal_ring_buffer_init(&node->stats, orte_stat_history_size); @@ -855,7 +858,6 @@ static void orte_node_construct(orte_node_t* node) static void orte_node_destruct(orte_node_t* node) { int i; - opal_list_item_t *item; opal_node_stats_t *stats; if (NULL != node->name) { @@ -892,10 +894,7 @@ static void orte_node_destruct(orte_node_t* node) node->username = NULL; } - while (NULL != (item = opal_list_remove_first(&node->resources))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&node->resources); + /* do NOT destroy the topology */ while (NULL != (stats = (opal_node_stats_t*)opal_ring_buffer_pop(&node->stats))) { OBJ_RELEASE(stats); diff --git a/orte/runtime/orte_globals.h b/orte/runtime/orte_globals.h index fa33690e5f..f57d54baaf 100644 --- a/orte/runtime/orte_globals.h +++ b/orte/runtime/orte_globals.h @@ -38,6 +38,7 @@ #include "opal/class/opal_value_array.h" #include "opal/class/opal_ring_buffer.h" #include "opal/threads/threads.h" +#include "opal/mca/hwloc/hwloc.h" #include "orte/mca/plm/plm_types.h" #include "orte/mca/rml/rml_types.h" @@ -298,8 +299,10 @@ typedef struct { char *cpu_set; /** Username on this node, if specified */ char *username; - /* list of known system resources for this node */ - opal_list_t resources; +#if OPAL_HAVE_HWLOC + /* system topology for this node */ + hwloc_topology_t topology; +#endif /* history of resource usage - sized by sensor framework */ opal_ring_buffer_t stats; } orte_node_t; @@ -623,6 +626,7 @@ ORTE_DECLSPEC extern opal_buffer_t *orte_tree_launch_cmd; /* global arrays for data storage */ ORTE_DECLSPEC extern opal_pointer_array_t *orte_job_data; ORTE_DECLSPEC extern opal_pointer_array_t *orte_node_pool; +ORTE_DECLSPEC extern opal_pointer_array_t *orte_node_topologies; /* a clean output channel without prefix */ ORTE_DECLSPEC extern int orte_clean_output; diff --git a/orte/tools/orte-info/components.c b/orte/tools/orte-info/components.c index 08302c2530..6999383d48 100644 --- a/orte/tools/orte-info/components.c +++ b/orte/tools/orte-info/components.c @@ -33,6 +33,7 @@ #include "opal/mca/base/base.h" #include "opal/mca/backtrace/backtrace.h" #include "opal/mca/backtrace/base/base.h" +#include "opal/mca/hwloc/base/base.h" #include "opal/mca/paffinity/paffinity.h" #include "opal/mca/paffinity/base/base.h" #include "opal/mca/carto/carto.h" @@ -49,8 +50,6 @@ #include "opal/mca/timer/base/base.h" #include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/base/base.h" -#include "opal/mca/sysinfo/sysinfo.h" -#include "opal/mca/sysinfo/base/base.h" #if OPAL_ENABLE_FT_CR == 1 #include "opal/mca/crs/crs.h" #include "opal/mca/crs/base/base.h" @@ -294,14 +293,16 @@ void orte_info_open_components(void) map->components = &opal_maffinity_base_components_opened; opal_pointer_array_add(&component_map, map); - if (OPAL_SUCCESS != opal_sysinfo_base_open()) { +#if OPAL_HAVE_HWLOC + if (OPAL_SUCCESS != opal_hwloc_base_open()) { goto error; } map = OBJ_NEW(orte_info_component_map_t); - map->type = strdup("sysinfo"); - map->components = &opal_sysinfo_base_components_opened; + map->type = strdup("hwloc"); + map->components = &opal_hwloc_components; opal_pointer_array_add(&component_map, map); - +#endif + if (OPAL_SUCCESS != opal_timer_base_open()) { goto error; } @@ -566,7 +567,9 @@ void orte_info_close_components() (void) opal_carto_base_close(); (void) opal_maffinity_base_close(); (void) opal_timer_base_close(); - (void) opal_sysinfo_base_close(); +#if OPAL_HAVE_HWLOC + (void) opal_hwloc_base_close(); +#endif #if OPAL_ENABLE_FT_CR == 1 (void) opal_crs_base_close(); #endif diff --git a/orte/tools/orte-info/orte-info.c b/orte/tools/orte-info/orte-info.c index 9c45a6e906..3761115d70 100644 --- a/orte/tools/orte-info/orte-info.c +++ b/orte/tools/orte-info/orte-info.c @@ -195,7 +195,9 @@ int main(int argc, char *argv[]) opal_pointer_array_add(&mca_types, "maffinity"); opal_pointer_array_add(&mca_types, "timer"); opal_pointer_array_add(&mca_types, "installdirs"); - opal_pointer_array_add(&mca_types, "sysinfo"); +#if OPAL_HAVE_HWLOC + opal_pointer_array_add(&mca_types, "hwloc"); +#endif #if OPAL_ENABLE_FT_CR == 1 opal_pointer_array_add(&mca_types, "crs"); #endif diff --git a/orte/util/hostfile/hostfile.c b/orte/util/hostfile/hostfile.c index 2143a36b96..50dbf45030 100644 --- a/orte/util/hostfile/hostfile.c +++ b/orte/util/hostfile/hostfile.c @@ -30,7 +30,6 @@ #include "opal/class/opal_list.h" #include "opal/util/argv.h" #include "opal/util/output.h" -#include "opal/util/opal_sos.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" #include "opal/util/if.h" diff --git a/orte/util/nidmap.c b/orte/util/nidmap.c index e12a8b667a..3599189eb5 100644 --- a/orte/util/nidmap.c +++ b/orte/util/nidmap.c @@ -46,10 +46,10 @@ #include "opal/dss/dss.h" #include "opal/runtime/opal.h" #include "opal/class/opal_pointer_array.h" +#include "opal/mca/hwloc/hwloc.h" #include "opal/util/output.h" #include "opal/util/opal_sos.h" #include "opal/util/argv.h" -#include "opal/mca/sysinfo/sysinfo_types.h" #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/odls/base/odls_private.h" @@ -114,10 +114,17 @@ int orte_util_nidmap_init(opal_buffer_t *buffer) return rc; } /* the bytes in the object were free'd by the decode */ - - /* unpack the system info */ - orte_util_decode_sysinfo(buffer); - +#if OPAL_HAVE_HWLOC + /* extract the topology */ + if (NULL == opal_hwloc_topology) { + cnt=1; + if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &opal_hwloc_topology, &cnt, OPAL_HWLOC_TOPO))) { + ORTE_ERROR_LOG(rc); + return rc; + } + } +#endif + return ORTE_SUCCESS; } @@ -148,6 +155,13 @@ void orte_util_nidmap_finalize(void) } OBJ_DESTRUCT(&orte_jobmap); +#if OPAL_HAVE_HWLOC + /* destroy the topology */ + if (NULL != opal_hwloc_topology) { + hwloc_topology_destroy(opal_hwloc_topology); + } +#endif + /* flag that these are no longer initialized */ initialized = false; } @@ -911,68 +925,6 @@ void orte_jobmap_dump(void) opal_output(orte_clean_output, "\n\n"); } -void orte_util_encode_sysinfo(opal_buffer_t *buf, opal_list_t *info) -{ - opal_sysinfo_value_t *sys; - opal_list_item_t *item; - uint8_t flag; - - for (item = opal_list_get_first(info); - item != opal_list_get_end(info); - item = opal_list_get_next(item)) { - sys = (opal_sysinfo_value_t*)item; - /* pack the key */ - opal_dss.pack(buf, &sys->key, 1, OPAL_STRING); - /* pack the value */ - if (OPAL_STRING == sys->type) { - flag = 0; - opal_dss.pack(buf, &flag, 1, OPAL_UINT8); - opal_dss.pack(buf, &sys->data.str, 1, OPAL_STRING); - } else { - flag = 1; - opal_dss.pack(buf, &flag, 1, OPAL_UINT8); - opal_dss.pack(buf, &sys->data.i64, 1, OPAL_INT64); - } - } -} - -void orte_util_decode_sysinfo(opal_buffer_t *buf) -{ - orte_nid_t *nid; - int32_t n; - char *key; - opal_sysinfo_value_t *sys; - uint8_t flag; - - /* get the nid of our local node */ - if (NULL == (nid = orte_util_lookup_nid(ORTE_PROC_MY_NAME))) { - /* can't get it */ - return ; - } - - /* if it already has sysinfo, then we are receiving - * a repeat copy - so discard it - */ - if (0 < opal_list_get_size(&nid->sysinfo)) { - return; - } - - n=1; - while (ORTE_SUCCESS == opal_dss.unpack(buf, &key, &n, OPAL_STRING)) { - sys = OBJ_NEW(opal_sysinfo_value_t); - sys->key = key; - opal_dss.unpack(buf, &flag, &n, OPAL_UINT8); - if (0 == flag) { - sys->type = OPAL_STRING; - opal_dss.unpack(buf, &sys->data.str, &n, OPAL_STRING); - } else { - sys->type = OPAL_INT64; - opal_dss.unpack(buf, &sys->data.i64, &n, OPAL_INT64); - } - opal_list_append(&nid->sysinfo, &sys->super); - } -} - #if 0 /* Useful for debugging. Not used otherwise. */ void print_orte_job_data() { diff --git a/orte/util/nidmap.h b/orte/util/nidmap.h index 21b7fab2a7..abc5ec695f 100644 --- a/orte/util/nidmap.h +++ b/orte/util/nidmap.h @@ -68,9 +68,6 @@ ORTE_DECLSPEC int orte_util_decode_nodemap(opal_byte_object_t *boptr); ORTE_DECLSPEC int orte_util_encode_pidmap(opal_byte_object_t *boptr); ORTE_DECLSPEC int orte_util_decode_pidmap(opal_byte_object_t *boptr); -ORTE_DECLSPEC void orte_util_encode_sysinfo(opal_buffer_t *buf, opal_list_t *info); -ORTE_DECLSPEC void orte_util_decode_sysinfo(opal_buffer_t *buf); - ORTE_DECLSPEC int orte_util_build_daemon_nidmap(char **nodes); ORTE_DECLSPEC void orte_nidmap_dump(void);