Per the RFC from Jeff, move hwloc from opal/mca/common to its own static framework ala libevent. Have ORTE daemons collect the topology info at startup and, if --enable-hwloc-xml is set, send that info back to the HNP for later use. The HNP only retains unique topology "templates" to reduce memory footprint. Have the daemon include the local topology info in the nidmap buffer sent to each app so the apps don't all hammer the local system to discover it for themselves.
Remove the sysinfo framework as hwloc replaces that functionality. This commit was SVN r25124.
Этот коммит содержится в:
родитель
2091e39bee
Коммит
92c7372e20
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
@ -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
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
|
@ -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
|
21
opal/mca/hwloc/base/Makefile.am
Обычный файл
21
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
|
||||
|
92
opal/mca/hwloc/base/base.h
Обычный файл
92
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 */
|
43
opal/mca/hwloc/base/hwloc_base_close.c
Обычный файл
43
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;
|
||||
}
|
219
opal/mca/hwloc/base/hwloc_base_dt.c
Обычный файл
219
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)
|
||||
{
|
||||
}
|
93
opal/mca/hwloc/base/hwloc_base_open.c
Обычный файл
93
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;
|
||||
}
|
111
opal/mca/hwloc/configure.m4
Обычный файл
111
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])
|
||||
])
|
21
opal/mca/hwloc/external/Makefile.am
поставляемый
Обычный файл
21
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
|
115
opal/mca/hwloc/external/configure.m4
поставляемый
Обычный файл
115
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
|
53
opal/mca/hwloc/external/hwloc_external_component.c
поставляемый
Обычный файл
53
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;
|
||||
}
|
72
opal/mca/hwloc/hwloc.h
Обычный файл
72
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 <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#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_ */
|
28
opal/mca/hwloc/hwloc121/Makefile.am
Обычный файл
28
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
|
139
opal/mca/hwloc/hwloc121/configure.m4
Обычный файл
139
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
|
22
opal/mca/hwloc/hwloc121/hwloc121.h
Обычный файл
22
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 */
|
@ -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;
|
||||
}
|
||||
|
44
opal/mca/hwloc/hwloc121/hwloc121_module.c
Обычный файл
44
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 <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/queue.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
|
||||
#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"
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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 */
|
@ -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;
|
||||
}
|
@ -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);
|
@ -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;
|
||||
}
|
@ -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)
|
@ -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_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.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
|
@ -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 <mach/mach_host.h>
|
||||
# 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
|
||||
|
@ -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 */
|
@ -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;
|
||||
}
|
@ -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 <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче
Block a user