1
1

Upgrade hwloc from 1.3.2+patches to 1.4.2+patches.

This commit was SVN r26566.
Этот коммит содержится в:
Jeff Squyres 2012-06-07 16:24:46 +00:00
родитель 5876496f4c
Коммит ba040e3a42
82 изменённых файлов: 26508 добавлений и 1204 удалений

Просмотреть файл

@ -1,11 +0,0 @@
Applied the following patches from the upstream hwloc 1.3 branch after
the v1.3.2 release:
https://svn.open-mpi.org/trac/hwloc/changeset/4306
https://svn.open-mpi.org/trac/hwloc/changeset/4309
https://svn.open-mpi.org/trac/hwloc/changeset/4314
https://svn.open-mpi.org/trac/hwloc/changeset/4319
https://svn.open-mpi.org/trac/hwloc/changeset/4340
https://svn.open-mpi.org/trac/hwloc/changeset/4345
https://svn.open-mpi.org/trac/hwloc/changeset/4471
https://svn.open-mpi.org/trac/hwloc/changeset/4531

Просмотреть файл

@ -1,137 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Priority
#
AC_DEFUN([MCA_opal_hwloc_hwloc132_PRIORITY], [65])
#
# Force this component to compile in static-only mode
#
AC_DEFUN([MCA_opal_hwloc_hwloc132_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/hwloc132/hwloc/config/hwloc.m4)
m4_include(opal/mca/hwloc/hwloc132/hwloc/config/hwloc_pkg.m4)
m4_include(opal/mca/hwloc/hwloc132/hwloc/config/hwloc_check_attributes.m4)
m4_include(opal/mca/hwloc/hwloc132/hwloc/config/hwloc_check_visibility.m4)
m4_include(opal/mca/hwloc/hwloc132/hwloc/config/hwloc_check_vendor.m4)
# MCA_hwloc_hwloc132_POST_CONFIG()
# ---------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc132_POST_CONFIG],[
HWLOC_DO_AM_CONDITIONALS
])dnl
# MCA_hwloc_hwloc132_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc132_CONFIG],[
AC_CONFIG_FILES([opal/mca/hwloc/hwloc132/Makefile])
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc132_save_CPPFLAGS opal_hwloc_hwloc132_save_LDFLAGS opal_hwloc_hwloc132_save_LIBS opal_hwloc_hwloc132_save_cairo opal_hwloc_hwloc132_save_xml opal_hwloc_hwloc132_basedir opal_hwloc_hwloc132_file opal_hwloc_hwloc132_save_cflags])
# default to this component not providing support
opal_hwloc_hwloc132_basedir=opal/mca/hwloc/hwloc132
opal_hwloc_hwloc132_support=no
if test "$with_hwloc" = "internal" -o "$with_hwloc" = "" -o "$with_hwloc" = "yes"; then
opal_hwloc_hwloc132_save_CPPFLAGS=$CPPFLAGS
opal_hwloc_hwloc132_save_LDFLAGS=$LDFLAGS
opal_hwloc_hwloc132_save_LIBS=$LIBS
# Run the hwloc configuration - set the prefix to minimize
# the chance that someone will use the internal symbols
HWLOC_SET_SYMBOL_PREFIX([opal_hwloc132_])
# save XML or graphical options
opal_hwloc_hwloc132_save_cairo=$enable_cairo
opal_hwloc_hwloc132_save_xml=$enable_xml
# never enable hwloc's graphical option
enable_cairo=no
# Override -- disable hwloc's libxml2 support, but enable the
# native hwloc XML support
enable_libxml2=no
enable_xml=yes
# hwloc checks for compiler visibility, and its needs to do
# this without "picky" flags.
opal_hwloc_hwloc132_save_cflags=$CFLAGS
CFLAGS=$OMPI_CFLAGS_BEFORE_PICKY
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc132/hwloc],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([yes])
HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc132_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc132_basedir/hwloc/VERSION`"
# Build flags for our Makefile.am
opal_hwloc_hwloc132_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)'
opal_hwloc_hwloc132_LIBS='$(top_ompi_builddir)/'"$opal_hwloc_hwloc132_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)'
opal_hwloc_hwloc132_support=yes],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([no])
opal_hwloc_hwloc132_support=no])
CFLAGS=$opal_hwloc_hwloc132_save_cflags
# Restore some env variables, if necessary
AS_IF([test -n "$opal_hwloc_hwloc132_save_cairo"],
[enable_cairo=$opal_hwloc_hwloc132_save_cairo])
AS_IF([test -n "$opal_hwloc_hwloc132_save_xml"],
[enable_xml=$opal_hwloc_hwloc132_save_xml])
CPPFLAGS=$opal_hwloc_hwloc132_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc132_save_LDFLAGS
LIBS=$opal_hwloc_hwloc132_save_LIBS
AC_SUBST([opal_hwloc_hwloc132_CFLAGS])
AC_SUBST([opal_hwloc_hwloc132_CPPFLAGS])
AC_SUBST([opal_hwloc_hwloc132_LDFLAGS])
AC_SUBST([opal_hwloc_hwloc132_LIBS])
fi
# Done!
AS_IF([test "$opal_hwloc_hwloc132_support" = "yes"],
[AC_DEFINE_UNQUOTED([HWLOC_HWLOC132_HWLOC_VERSION],
["$HWLOC_VERSION"],
[Version of hwloc])
# Do we have verbs support?
AC_CHECK_HEADERS([infiniband/verbs.h])
# Set these variables so that the framework m4 knows
# what file to include in opal/mca/hwloc/hwloc.h
opal_hwloc_hwloc132_include="$opal_hwloc_hwloc132_basedir/hwloc132.h"
# Also pass some *_ADD_* flags upwards to the framework m4
# for various compile/link flags that are needed a) to
# build the rest of the source tree, and b) for the wrapper
# compilers (in the --with-devel-headers case).
opal_hwloc_hwloc132_file=$opal_hwloc_hwloc132_basedir/hwloc
opal_hwloc_hwloc132_ADD_CPPFLAGS="-I$OMPI_TOP_SRCDIR/$opal_hwloc_hwloc132_file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[opal_hwloc_hwloc132_ADD_CPPFLAGS="$opal_hwloc_hwloc132_ADD_CPPFLAGS -I$OMPI_TOP_BUILDDIR/$opal_hwloc_hwloc132_file/include"])
if test "$with_devel_headers" = "yes" ; then
opal_hwloc_hwloc132_ADD_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi/'"$opal_hwloc_hwloc132_basedir/hwloc/include"
fi
opal_hwloc_hwloc132_ADD_WRAPPER_EXTRA_LIBS=$HWLOC_EMBEDDED_LIBS
$1],
[$2])
OPAL_VAR_SCOPE_POP
])dnl

Просмотреть файл

@ -17,16 +17,16 @@ EXTRA_DIST = \
SUBDIRS = hwloc
# Headers and sources
headers = hwloc132.h
sources = hwloc132_component.c
headers = hwloc142.h
sources = hwloc142_component.c
# We only ever build this component statically
noinst_LTLIBRARIES = libmca_hwloc_hwloc132.la
libmca_hwloc_hwloc132_la_SOURCES = $(headers) $(sources)
nodist_libmca_hwloc_hwloc132_la_SOURCES = $(nodist_headers)
libmca_hwloc_hwloc132_la_LDFLAGS = -module -avoid-version $(opal_hwloc_hwloc132_LDFLAGS)
libmca_hwloc_hwloc132_la_LIBADD = $(opal_hwloc_hwloc132_LIBS)
libmca_hwloc_hwloc132_la_DEPENDENCIES = \
noinst_LTLIBRARIES = libmca_hwloc_hwloc142.la
libmca_hwloc_hwloc142_la_SOURCES = $(headers) $(sources)
nodist_libmca_hwloc_hwloc142_la_SOURCES = $(nodist_headers)
libmca_hwloc_hwloc142_la_LDFLAGS = -module -avoid-version $(opal_hwloc_hwloc142_LDFLAGS)
libmca_hwloc_hwloc142_la_LIBADD = $(opal_hwloc_hwloc142_LIBS)
libmca_hwloc_hwloc142_la_DEPENDENCIES = \
$(HWLOC_top_builddir)/src/libhwloc_embedded.la
# Since the rest of the code base includes the underlying hwloc.h, we

6
opal/mca/hwloc/hwloc142/README-ompi.txt Обычный файл
Просмотреть файл

@ -0,0 +1,6 @@
Applied the following patches from the upstream hwloc 1.4 branch after
the v1.4.2 release:
https://svn.open-mpi.org/trac/hwloc/changeset/4481
https://svn.open-mpi.org/trac/hwloc/changeset/4483
https://svn.open-mpi.org/trac/hwloc/changeset/4532

137
opal/mca/hwloc/hwloc142/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,137 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Priority
#
AC_DEFUN([MCA_opal_hwloc_hwloc142_PRIORITY], [65])
#
# Force this component to compile in static-only mode
#
AC_DEFUN([MCA_opal_hwloc_hwloc142_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/hwloc142/hwloc/config/hwloc.m4)
m4_include(opal/mca/hwloc/hwloc142/hwloc/config/hwloc_pkg.m4)
m4_include(opal/mca/hwloc/hwloc142/hwloc/config/hwloc_check_attributes.m4)
m4_include(opal/mca/hwloc/hwloc142/hwloc/config/hwloc_check_visibility.m4)
m4_include(opal/mca/hwloc/hwloc142/hwloc/config/hwloc_check_vendor.m4)
# MCA_hwloc_hwloc142_POST_CONFIG()
# ---------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc142_POST_CONFIG],[
HWLOC_DO_AM_CONDITIONALS
])dnl
# MCA_hwloc_hwloc142_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc142_CONFIG],[
AC_CONFIG_FILES([opal/mca/hwloc/hwloc142/Makefile])
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc142_save_CPPFLAGS opal_hwloc_hwloc142_save_LDFLAGS opal_hwloc_hwloc142_save_LIBS opal_hwloc_hwloc142_save_cairo opal_hwloc_hwloc142_save_xml opal_hwloc_hwloc142_basedir opal_hwloc_hwloc142_file opal_hwloc_hwloc142_save_cflags])
# default to this component not providing support
opal_hwloc_hwloc142_basedir=opal/mca/hwloc/hwloc142
opal_hwloc_hwloc142_support=no
if test "$with_hwloc" = "internal" -o "$with_hwloc" = "" -o "$with_hwloc" = "yes"; then
opal_hwloc_hwloc142_save_CPPFLAGS=$CPPFLAGS
opal_hwloc_hwloc142_save_LDFLAGS=$LDFLAGS
opal_hwloc_hwloc142_save_LIBS=$LIBS
# Run the hwloc configuration - set the prefix to minimize
# the chance that someone will use the internal symbols
HWLOC_SET_SYMBOL_PREFIX([opal_hwloc142_])
# save XML or graphical options
opal_hwloc_hwloc142_save_cairo=$enable_cairo
opal_hwloc_hwloc142_save_xml=$enable_xml
# never enable hwloc's graphical option
enable_cairo=no
# Override -- disable hwloc's libxml2 support, but enable the
# native hwloc XML support
enable_libxml2=no
enable_xml=yes
# hwloc checks for compiler visibility, and its needs to do
# this without "picky" flags.
opal_hwloc_hwloc142_save_cflags=$CFLAGS
CFLAGS=$OMPI_CFLAGS_BEFORE_PICKY
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc142/hwloc],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([yes])
HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc142_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc142_basedir/hwloc/VERSION`"
# Build flags for our Makefile.am
opal_hwloc_hwloc142_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)'
opal_hwloc_hwloc142_LIBS='$(top_ompi_builddir)/'"$opal_hwloc_hwloc142_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)'
opal_hwloc_hwloc142_support=yes],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([no])
opal_hwloc_hwloc142_support=no])
CFLAGS=$opal_hwloc_hwloc142_save_cflags
# Restore some env variables, if necessary
AS_IF([test -n "$opal_hwloc_hwloc142_save_cairo"],
[enable_cairo=$opal_hwloc_hwloc142_save_cairo])
AS_IF([test -n "$opal_hwloc_hwloc142_save_xml"],
[enable_xml=$opal_hwloc_hwloc142_save_xml])
CPPFLAGS=$opal_hwloc_hwloc142_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc142_save_LDFLAGS
LIBS=$opal_hwloc_hwloc142_save_LIBS
AC_SUBST([opal_hwloc_hwloc142_CFLAGS])
AC_SUBST([opal_hwloc_hwloc142_CPPFLAGS])
AC_SUBST([opal_hwloc_hwloc142_LDFLAGS])
AC_SUBST([opal_hwloc_hwloc142_LIBS])
fi
# Done!
AS_IF([test "$opal_hwloc_hwloc142_support" = "yes"],
[AC_DEFINE_UNQUOTED([HWLOC_HWLOC142_HWLOC_VERSION],
["$HWLOC_VERSION"],
[Version of hwloc])
# Do we have verbs support?
AC_CHECK_HEADERS([infiniband/verbs.h])
# Set these variables so that the framework m4 knows
# what file to include in opal/mca/hwloc/hwloc.h
opal_hwloc_hwloc142_include="$opal_hwloc_hwloc142_basedir/hwloc142.h"
# Also pass some *_ADD_* flags upwards to the framework m4
# for various compile/link flags that are needed a) to
# build the rest of the source tree, and b) for the wrapper
# compilers (in the --with-devel-headers case).
opal_hwloc_hwloc142_file=$opal_hwloc_hwloc142_basedir/hwloc
opal_hwloc_hwloc142_ADD_CPPFLAGS="-I$OMPI_TOP_SRCDIR/$opal_hwloc_hwloc142_file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[opal_hwloc_hwloc142_ADD_CPPFLAGS="$opal_hwloc_hwloc142_ADD_CPPFLAGS -I$OMPI_TOP_BUILDDIR/$opal_hwloc_hwloc142_file/include"])
if test "$with_devel_headers" = "yes" ; then
opal_hwloc_hwloc142_ADD_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi/'"$opal_hwloc_hwloc142_basedir/hwloc/include"
fi
opal_hwloc_hwloc142_ADD_WRAPPER_EXTRA_LIBS=$HWLOC_EMBEDDED_LIBS
$1],
[$2])
OPAL_VAR_SCOPE_POP
])dnl

Просмотреть файл

@ -22,6 +22,11 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = hwloc.pc
endif
# Only install the valgrind suppressions file if we're building in standalone mode
if HWLOC_BUILD_STANDALONE
dist_pkgdata_DATA = contrib/hwloc-valgrind.supp
endif
#
# "make distcheck" requires that tarballs are able to be able to "make
# dist", so we have to include config/distscript.csh.

Просмотреть файл

@ -17,10 +17,91 @@ bug fixes (and other actions) for each version of hwloc since version
in v0.9.1).
Version 1.3.3
Version 1.4.2
-------------
* Bug fixes:
+ Fix hwloc_alloc_membind, thanks Karl Napf for reporting the issue.
* Fix build on Solaris 9 and earlier when fabsf() is not a compiler
built-in. Thanks to Igor Galić for reporting the problem.
* Fix support for more than 32 processors on Windows. Thanks to Hartmut
Kaiser for reporting the problem.
* Fix process-wide binding and cpulocation routines on Linux when some
threads disappear in the meantime. Thanks to Vlad Roubtsov for reporting
the issue.
* Make installed scripts executable. Thanks to Jirka Hladky for reporting
the problem.
* Fix libtool revision management when building for Windows. This fix was
also released as hwloc v1.4.1.1 Windows builds. Thanks to Hartmut Kaiser
for reporting the problem.
* Fix the __hwloc_inline keyword in public headers when compiling with a
C++ compiler.
* Add Port info attribute to network OS devices inside OpenFabrics PCI
devices so as to identify which interface corresponds to which port.
* Document requirements for interoperability helpers: I/O devices discovery
is required for some of them; the topology must match the current host
for most of them.
Version 1.4.1
-------------
* This release contains all changes from v1.3.2.
* Fix hwloc_alloc_membind, thanks Karl Napf for reporting the issue.
* Fix memory leaks in some get_membind() functions.
* Fix helpers converting from Linux libnuma to hwloc (hwloc/linux-libnuma.h)
in case of out-of-order NUMA node ids.
* Fix some overzealous assertions in the distance grouping code.
* Workaround BIOS reporting empty I/O locality in cuda and openfabrics
helpers on Linux. Thanks to Albert Solernou for reporting the problem.
* Install a valgrind suppressions file hwloc-valgrind.supp (see the FAQ).
* Fix memory binding documentation. Thanks to Karl Napf for reporting the
issues.
Version 1.4.0 (does not contain all v1.3.2 changes)
-------------
* Major features
+ Add "custom" interface and "assembler" tools to build multi-node
topology. See the Multi-node Topologies section in the documentation
for details.
* Interface improvements
+ Add symmetric_subtree object attribute to ease assumptions when consulting
regular symmetric topologies.
+ Add a CPUModel and CPUType info attribute to Socket objects on Linux
and Solaris.
+ Add hwloc_get_obj_index_inside_cpuset() to retrieve the "logical" index
of an object within a subtree of the topology.
+ Add more NVIDIA CUDA helpers in cuda.h and cudart.h to find hwloc objects
corresponding to CUDA devices.
* Discovery improvements
+ Add a group object above partial distance matrices to make sure
the matrices are available in the final topology, except when this
new object would contradict the existing hierarchy.
+ Grouping by distances now also works when loading from XML.
+ Fix some corner cases in object insertion, for instance when dealing
with NUMA nodes without any CPU.
* Backends
+ Implement hwloc_get_area_membind() on Linux.
+ Honor I/O topology flags when importing from XML.
+ Further improve XML-related error checking and reporting.
+ Hide synthetic topology error messages unless HWLOC_SYNTHETIC_VERBOSE=1.
* Tools
+ Add synthetic exporting of symmetric topologies to lstopo.
+ lstopo --horiz and --vert can now be applied to some specific object types.
+ lstopo -v -p now displays distance matrices with physical indexes.
+ Add hwloc-distances utility to list distances.
* Documentation
+ Fix and/or document the behavior of most inline functions in hwloc/helper.h
when the topology contains some I/O or Misc objects.
+ Backend documentation enhancements.
* Bug fixes
+ Fix missing last bit in hwloc_linux_get_thread_cpubind().
Thanks to Carolina Gómez-Tostón Gutiérrez for reporting the issue.
+ Fix FreeBSD build without cpuid support.
+ Fix several Windows build issues.
+ Fix inline keyword definition in public headers.
+ Fix dependencies in the embedded library.
+ Improve visibility support detection. Thanks to Dave Love for providing
the patch.
+ Remove references to internal symbols in the tools.
Version 1.3.2
-------------

Просмотреть файл

@ -5,7 +5,9 @@ key computing elements, such as: NUMA memory nodes, shared caches, processor
sockets, processor cores, processing units (logical processors or "threads")
and even I/O devices. hwloc also gathers various attributes such as cache and
memory information, and is portable across a variety of different operating
systems and platforms.
systems and platforms. Additionally it may assemble the topologies of multiple
machines into a single one so as to let applications consult the topology of an
entire fabric or cluster at once.
hwloc primarily aims at helping high-performance computing (HPC) applications,
but is also applicable to any project seeking to exploit code and/or data
@ -705,6 +707,7 @@ The documentation chapters include
* Environment Variables
* CPU and Memory Binding Overview
* I/O Devices
* Multi-node Topologies
* Importing and exporting topologies from/to XML files
* Interoperability With Other Software
* Thread Safety
@ -715,5 +718,5 @@ Make sure to have had a look at those too!
-------------------------------------------------------------------------------
Generated on Mon Feb 13 2012 16:23:43 for Hardware Locality (hwloc) by doxygen
1.7.4
Generated on Thu May 10 2012 16:17:03 for Hardware Locality (hwloc) by
doxygen 1.7.6.1

Просмотреть файл

@ -6,7 +6,7 @@
# <major>.<minor>.<release>. If release is zero, then it is omitted.
major=1
minor=3
minor=4
release=2
# greek is used for alpha or beta release tags. If it is non-empty,
@ -41,11 +41,11 @@ want_repo_rev=0
# from an SVN checkout, if repo_rev=-1, then its value is replaced
# with the output of "svnversion".
repo_rev=r4298
repo_rev=r4474
# The date when this release was created
date="Feb 13, 2012"
date="May 10, 2012"
# The shared library version of hwloc's public library. This version
# is maintained in accordance with the "Library Interface Versions"
@ -58,4 +58,4 @@ date="Feb 13, 2012"
# 2. Version numbers are described in the Libtool current:revision:age
# format.
libhwloc_so_version=4:2:4
libhwloc_so_version=5:2:0

Просмотреть файл

@ -1,7 +1,8 @@
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -19,12 +20,15 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
@ -34,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11.1], [],
m4_if([$1], [1.11.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -50,19 +54,21 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11.1])dnl
[AM_AUTOMAKE_VERSION([1.11.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@ -144,14 +150,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
# Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
# 2010, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 10
# serial 12
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@ -191,6 +197,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
@ -255,7 +262,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
break
fi
;;
msvisualcpp | msvcmsys)
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
@ -320,10 +327,13 @@ AC_DEFUN([AM_DEP_TRACK],
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
@ -545,12 +555,15 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
@ -717,12 +730,15 @@ else
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
@ -745,13 +761,14 @@ esac
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# serial 5
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@ -759,13 +776,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@ -776,12 +793,14 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
@ -885,12 +904,14 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
@ -913,13 +934,13 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# serial 3
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
@ -928,7 +949,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])

310
opal/mca/hwloc/hwloc142/hwloc/config/compile Исполняемый файл
Просмотреть файл

@ -0,0 +1,310 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2010-11-15.09; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
# Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Win32 hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l*)
lib=${1#-l}
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
set x "$@" "$dir/$lib.dll.lib"
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
set x "$@" "$dir/$lib.lib"
break
fi
done
IFS=$save_IFS
test "$found" != yes && set x "$@" "$lib.lib"
shift
;;
-L*)
func_file_conv "${1#-L}"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1522
opal/mca/hwloc/hwloc142/hwloc/config/config.guess поставляемый Исполняемый файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1771
opal/mca/hwloc/hwloc142/hwloc/config/config.sub поставляемый Исполняемый файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

688
opal/mca/hwloc/hwloc142/hwloc/config/depcomp Исполняемый файл
Просмотреть файл

@ -0,0 +1,688 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2011-12-04.11; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test "$stat" = 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/ \1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/ /
G
p
}' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

Просмотреть файл

@ -21,6 +21,7 @@ dnl See COPYING in top-level directory.
# 4. If non-empty, print the announcement banner
#
AC_DEFUN([HWLOC_SETUP_CORE],[
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_TARGET])
AC_REQUIRE([AC_PROG_CC])
@ -141,7 +142,6 @@ EOF])
fi
# Enample system extensions for O_DIRECTORY, fdopen, fssl, etc.
AC_USE_SYSTEM_EXTENSIONS
AH_VERBATIM([USE_HPUX_SYSTEM_EXTENSIONS],
[/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
@ -250,6 +250,10 @@ EOF])
AC_MSG_RESULT([unknown -- assuming x86_64])
;;
esac
;;
*)
AC_MSG_RESULT([unknown])
;;
esac
AC_SUBST(HWLOC_MS_LIB_ARCH)
@ -365,8 +369,13 @@ EOF])
[HWLOC_LIBS="-lkstat $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBKSTAT], 1, [Define to 1 if we have -lkstat])])
])
AC_CHECK_LIB([m], [fabsf],
[HWLOC_LIBS="-lm $HWLOC_LIBS"])
AC_CHECK_DECLS([fabsf], [
AC_CHECK_LIB([m], [fabsf],
[HWLOC_LIBS="-lm $HWLOC_LIBS"])
], [], [[#include <math.h>]])
AC_CHECK_HEADERS([picl.h])
AC_CHECK_DECLS([_SC_NPROCESSORS_ONLN,
_SC_NPROCESSORS_CONF,
@ -738,7 +747,7 @@ EOF])
# Try to compile the cpuid inlines
AC_MSG_CHECKING([for cpuid])
old_CPPFLAGS="$CPPFLAGS"
CFLAGS="$CFLAGS -I$HWLOC_top_srcdir/include"
CPPFLAGS="$CPPFLAGS -I$HWLOC_top_srcdir/include"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#define __hwloc_inline

Просмотреть файл

@ -172,7 +172,7 @@ EOF
# specifically disabled by the user.
AC_MSG_CHECKING([whether to enable "picky" compiler mode])
hwloc_want_picky=0
AS_IF([test "$GCC" = "yes"],
AS_IF([test "$hwloc_c_vendor" = "gnu"],
[AS_IF([test -d "$srcdir/.svn" -o -d "$srcdir/.hg" -o -d "$srcdir/.git"],
[hwloc_want_picky=1])])
if test "$enable_picky" = "yes"; then
@ -388,14 +388,19 @@ EOF
hwloc_config_prefix[tests/linux/gather/Makefile]
hwloc_config_prefix[tests/xml/Makefile]
hwloc_config_prefix[tests/ports/Makefile]
hwloc_config_prefix[tests/rename/Makefile]
hwloc_config_prefix[tests/linux/hwloc-gather-topology]
hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh]
hwloc_config_prefix[tests/linux/test-topology.sh]
hwloc_config_prefix[tests/xml/test-topology.sh]
hwloc_config_prefix[utils/hwloc-assembler-remote]
hwloc_config_prefix[utils/test-hwloc-assembler.sh]
hwloc_config_prefix[utils/test-hwloc-calc.sh]
hwloc_config_prefix[utils/test-hwloc-distrib.sh])
hwloc_config_prefix[utils/test-hwloc-distances.sh]
hwloc_config_prefix[utils/test-hwloc-distrib.sh]
hwloc_config_prefix[utils/test-hwloc-ls.sh])
AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh])
AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[utils/hwloc-assembler-remote ]hwloc_config_prefix[utils/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-distances.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/test-hwloc-ls.sh])
# These links are only needed in standalone mode. It would
# be nice to m4 foreach this somehow, but whenever I tried
@ -408,6 +413,7 @@ EOF
hwloc_config_prefix[tests/ports/traversal.c]:hwloc_config_prefix[src/traversal.c]
hwloc_config_prefix[tests/ports/topology-synthetic.c]:hwloc_config_prefix[src/topology-synthetic.c]
hwloc_config_prefix[tests/ports/topology-solaris.c]:hwloc_config_prefix[src/topology-solaris.c]
hwloc_config_prefix[tests/ports/topology-solaris-chiptype.c]:hwloc_config_prefix[src/topology-solaris-chiptype.c]
hwloc_config_prefix[tests/ports/topology-aix.c]:hwloc_config_prefix[src/topology-aix.c]
hwloc_config_prefix[tests/ports/topology-osf.c]:hwloc_config_prefix[src/topology-osf.c]
hwloc_config_prefix[tests/ports/topology-windows.c]:hwloc_config_prefix[src/topology-windows.c]

527
opal/mca/hwloc/hwloc142/hwloc/config/install-sh Исполняемый файл
Просмотреть файл

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for `test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

7982
opal/mca/hwloc/hwloc142/hwloc/config/libtool.m4 поставляемый Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

9655
opal/mca/hwloc/hwloc142/hwloc/config/ltmain.sh Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

384
opal/mca/hwloc/hwloc142/hwloc/config/ltoptions.m4 поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,384 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 7 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])

123
opal/mca/hwloc/hwloc142/hwloc/config/ltsugar.m4 поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,123 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])

23
opal/mca/hwloc/hwloc142/hwloc/config/ltversion.m4 поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 3337 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

98
opal/mca/hwloc/hwloc142/hwloc/config/lt~obsolete.m4 поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,98 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])

376
opal/mca/hwloc/hwloc142/hwloc/config/missing Исполняемый файл
Просмотреть файл

@ -0,0 +1,376 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

Просмотреть файл

@ -0,0 +1,31 @@
# Copyright © 2012 inria. All rights reserved.
# See COPYING in top-level directory.
# suppressions file to be passed to valgrind with
# --suppressions=/path/to/hwloc-valgrind.supp
# zlib (brought by libpci or libxml2) doesn't cleanup its global state
{
inflate_init
Memcheck:Cond
fun:inflateReset2
fun:inflateInit2_
}
# hwloc cannot free the global parser (with xmlCleanupParser()) because other threads may be using it
{
xml_init_parser
Memcheck:Leak
...
fun:xmlInitParser
}
# hwloc cannot free the global xml dict RMutex because it cannot call xmlCleanupParser() as explained above
{
xml_dict_create_new_rmutex
Memcheck:Leak
fun:malloc
fun:xmlNewRMutex
...
fun:xmlDictCreate
}

Просмотреть файл

@ -1,6 +1,7 @@
# Copyright © 2009-2010 inria. All rights reserved.
# Copyright © 2009-2010 Université Bordeaux 1
# Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
# Copyright © 2011 Oracle and/or its affiliates. All rights reserved.
# See COPYING in top-level directory.
# Only install the headers if we're in standalone mode (meaning:
@ -33,6 +34,11 @@ include_hwloc_HEADERS += \
hwloc/linux-libnuma.h
endif HWLOC_HAVE_LINUX
if HWLOC_HAVE_SOLARIS
include_hwloc_HEADERS += \
private/solaris-chiptype.h
endif HWLOC_HAVE_SOLARIS
if HWLOC_HAVE_SCHED_SETAFFINITY
include_hwloc_HEADERS += hwloc/glibc-sched.h
endif HWLOC_HAVE_SCHED_SETAFFINITY

Просмотреть файл

@ -75,7 +75,7 @@ extern "C" {
*/
/** \brief Indicate at build time which hwloc API version is being used. */
#define HWLOC_API_VERSION 0x00010300
#define HWLOC_API_VERSION 0x00010400
/** \brief Indicate at runtime which hwloc API version was used at build time. */
HWLOC_DECLSPEC unsigned hwloc_get_api_version(void);
@ -338,7 +338,11 @@ struct hwloc_obj {
* may be \c NULL if no attribute value was found */
/* global position */
unsigned depth; /**< \brief Vertical index in the hierarchy */
unsigned depth; /**< \brief Vertical index in the hierarchy.
* If the topology is symmetric, this is equal to the
* parent depth plus one, and also equal to the number
* of parent/child links from the root object to here.
*/
unsigned logical_index; /**< \brief Horizontal index in the whole list of similar objects,
* could be a "cousin_rank" since it's the rank within the "cousin" list below */
signed os_level; /**< \brief OS-provided physical level, -1 if unknown or meaningless */
@ -455,6 +459,10 @@ struct hwloc_obj {
struct hwloc_obj_info_s *infos; /**< \brief Array of stringified info type=name. */
unsigned infos_count; /**< \brief Size of infos array. */
int symmetric_subtree; /**< \brief Set if the subtree of objects below this object is symmetric,
* which means all children and their children have identical subtrees.
*/
};
/**
* \brief Convenience typedef; a pointer to a struct hwloc_obj.
@ -683,7 +691,7 @@ enum hwloc_topology_flags_e {
* backend, but still having binding functions actually do bind.
*/
/* \brief Detect PCI devices.
/** \brief Detect PCI devices.
*
* By default, I/O devices are ignored. This flag enables I/O device
* detection using the libpci backend. Only the common PCI devices (GPUs,
@ -694,7 +702,7 @@ enum hwloc_topology_flags_e {
*/
HWLOC_TOPOLOGY_FLAG_IO_DEVICES = (1<<2),
/* \brief Detect PCI bridges.
/** \brief Detect PCI bridges.
*
* This flag should be combined with HWLOC_TOPOLOGY_FLAG_IO_DEVICES to enable
* the detection of both common devices and of all useful bridges (bridges that
@ -702,7 +710,7 @@ enum hwloc_topology_flags_e {
*/
HWLOC_TOPOLOGY_FLAG_IO_BRIDGES = (1<<3),
/* \brief Detect the whole PCI hierarchy.
/** \brief Detect the whole PCI hierarchy.
*
* This flag enables detection of all I/O devices (even the uncommon ones)
* and bridges (even those that have no device behind them) using the libpci
@ -717,6 +725,22 @@ enum hwloc_topology_flags_e {
*/
HWLOC_DECLSPEC int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags);
/** \brief Change which pid the topology is viewed from
*
* On some systems, processes may have different views of the machine, for
* instance the set of allowed CPUs. By default, hwloc exposes the view from
* the current process. Calling hwloc_topology_set_pid() permits to make it
* expose the topology of the machine from the point of view of another
* process.
*
* \note \p hwloc_pid_t is \p pid_t on Unix platforms,
* and \p HANDLE on native Windows platforms.
*
* \note -1 is returned and errno is set to ENOSYS on platforms that do not
* support this feature.
*/
HWLOC_DECLSPEC int hwloc_topology_set_pid(hwloc_topology_t __hwloc_restrict topology, hwloc_pid_t pid);
/** \brief Change the file-system root path when building the topology from sysfs/procfs.
*
* On Linux system, use sysfs and procfs files as if they were mounted on the given
@ -730,29 +754,19 @@ HWLOC_DECLSPEC int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned
* still need to invoke hwloc_topology_load() to actually load the
* topology information.
*
* \return -1 with errno set to ENOSYS on non-Linux and on Linux systems that
* do not support it.
* \return -1 with the appropriate errno if \p fsroot_path cannot be used.
*
* \note For convenience, this backend provides empty binding hooks which just
* return success. To have hwloc still actually call OS-specific hooks, the
* HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded
* file is really the underlying system.
*
* \note The existing topology is cleared even on failure.
*/
HWLOC_DECLSPEC int hwloc_topology_set_fsroot(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict fsroot_path);
/** \brief Change which pid the topology is viewed from
*
* On some systems, processes may have different views of the machine, for
* instance the set of allowed CPUs. By default, hwloc exposes the view from
* the current process. Calling hwloc_topology_set_pid() permits to make it
* expose the topology of the machine from the point of view of another
* process.
*
* \note \p hwloc_pid_t is \p pid_t on Unix platforms,
* and \p HANDLE on native Windows platforms.
*
* \note -1 is returned and errno is set to ENOSYS on platforms that do not
* support this feature.
*/
HWLOC_DECLSPEC int hwloc_topology_set_pid(hwloc_topology_t __hwloc_restrict topology, hwloc_pid_t pid);
/** \brief Enable synthetic topology.
*
* Gather topology information from the given \p description,
@ -774,6 +788,8 @@ HWLOC_DECLSPEC int hwloc_topology_set_pid(hwloc_topology_t __hwloc_restrict topo
*
* \note For convenience, this backend provides empty binding hooks which just
* return success.
*
* \note The existing topology is cleared even on failure.
*/
HWLOC_DECLSPEC int hwloc_topology_set_synthetic(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict description);
@ -781,17 +797,22 @@ HWLOC_DECLSPEC int hwloc_topology_set_synthetic(hwloc_topology_t __hwloc_restric
*
* Gather topology information from the XML file given at \p xmlpath.
* Setting the environment variable HWLOC_XMLFILE may also result in this behavior.
* This file may have been generated earlier with lstopo file.xml.
* This file may have been generated earlier with hwloc_topology_export_xml()
* or lstopo file.xml.
*
* Note that this function does not actually load topology
* information; it just tells hwloc where to load it from. You'll
* still need to invoke hwloc_topology_load() to actually load the
* topology information.
*
* \return -1 with errno set to EINVAL on failure to read the XML file.
*
* \note For convenience, this backend provides empty binding hooks which just
* return success. To have hwloc still actually call OS-specific hooks, the
* HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded
* file is really the underlying system.
*
* \note The existing topology is cleared even on failure.
*/
HWLOC_DECLSPEC int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict xmlpath);
@ -807,9 +828,28 @@ HWLOC_DECLSPEC int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict topo
* still need to invoke hwloc_topology_load() to actually load the
* topology information.
*
* \return -1 with errno set to EINVAL on failure to read the XML buffer.
*
* \note For convenience, this backend provides empty binding hooks which just
* return success. To have hwloc still actually call OS-specific hooks, the
* HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded
* file is really the underlying system.
*
* \note The existing topology is cleared even on failure.
*/
HWLOC_DECLSPEC int hwloc_topology_set_xmlbuffer(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict buffer, int size);
/** \brief Prepare the topology for custom assembly.
*
* The topology then contains a single root object.
* It may then be built by inserting other topologies with
* hwloc_custom_insert_topology() or single objects with
* hwloc_custom_insert_group_object_by_parent().
* hwloc_topology_load() must be called to finalize the new
* topology as usual.
*/
HWLOC_DECLSPEC int hwloc_topology_set_custom(hwloc_topology_t topology);
/** \brief Provide a distance matrix.
*
* Provide the matrix of distances between a set of objects of the given type.
@ -824,6 +864,8 @@ HWLOC_DECLSPEC int hwloc_topology_set_xmlbuffer(hwloc_topology_t __hwloc_restric
* it will be replaced by the given one.
* If \p nbobjs is \c 0, \p os_index is \c NULL and \p distances is \c NULL,
* the existing distance matrix for the given type is removed.
*
* \note Distance matrices are ignored in multi-node topologies.
*/
HWLOC_DECLSPEC int hwloc_topology_set_distance_matrix(hwloc_topology_t __hwloc_restrict topology,
hwloc_obj_type_t type, unsigned nbobjs,
@ -1064,7 +1106,9 @@ HWLOC_DECLSPEC unsigned hwloc_get_nbobjs_by_depth (hwloc_topology_t topology, un
* If no object for that type exists, 0 is returned.
* If there are several levels with objects of that type, -1 is returned.
*/
static __hwloc_inline int __hwloc_attribute_pure
static __hwloc_inline int
hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
{
int depth = hwloc_get_type_depth(topology, type);
@ -1106,7 +1150,9 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_get_obj_by_depth (hwloc_topology_t topology, un
* If there are several levels with objects of that type, \c NULL is returned
* and ther caller may fallback to hwloc_get_obj_by_depth().
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
{
int depth = hwloc_get_type_depth(topology, type);
@ -1200,7 +1246,9 @@ HWLOC_DECLSPEC int hwloc_obj_cpuset_snprintf(char * __hwloc_restrict str, size_t
*
* \return \c NULL if no such key exists.
*/
static __hwloc_inline const char * __hwloc_attribute_pure
static __hwloc_inline const char *
hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name) __hwloc_attribute_pure;
static __hwloc_inline const char *
hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name)
{
unsigned i;
@ -1488,7 +1536,10 @@ typedef enum {
* Pages are individually
* bound to the local NUMA
* node of the first thread
* that touches it.
* that touches it. If there is not
* enough memory on the node, allocation
* may be done in the specified cpuset
* before allocating on other nodes.
* \hideinitializer */
HWLOC_MEMBIND_BIND = 2, /**< \brief Allocate memory on the specified nodes.
* \hideinitializer */
@ -1911,9 +1962,9 @@ HWLOC_DECLSPEC void *hwloc_alloc(hwloc_topology_t topology, size_t len);
/** \brief Allocate some memory on the given physical nodeset \p nodeset
*
* \return -1 with errno set to ENOSYS if the action is not supported
* \return NULL with errno set to ENOSYS if the action is not supported
* and HWLOC_MEMBIND_STRICT is given
* \return -1 with errno set to EXDEV if the binding cannot be enforced
* \return NULL with errno set to EXDEV if the binding cannot be enforced
* and HWLOC_MEMBIND_STRICT is given
*
* \note The allocated memory should be freed with hwloc_free().
@ -1922,9 +1973,9 @@ HWLOC_DECLSPEC void *hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size
/** \brief Allocate some memory on memory nodes near the given physical cpuset \p cpuset
*
* \return -1 with errno set to ENOSYS if the action is not supported
* \return NULL with errno set to ENOSYS if the action is not supported
* and HWLOC_MEMBIND_STRICT is given
* \return -1 with errno set to EXDEV if the binding cannot be enforced
* \return NULL with errno set to EXDEV if the binding cannot be enforced
* and HWLOC_MEMBIND_STRICT is given
*
* \note The allocated memory should be freed with hwloc_free().
@ -1940,6 +1991,56 @@ HWLOC_DECLSPEC int hwloc_free(hwloc_topology_t topology, void *addr, size_t len)
/** \defgroup hwlocality_custom Building Custom Topologies
*
* A custom topology may be initialized by calling hwloc_topology_set_custom()
* after hwloc_topology_init(). It may then be modified by inserting objects
* or entire topologies. Once done assembling, hwloc_topology_load() should
* be invoked as usual to finalize the topology.
* @{
*/
/** \brief Insert an existing topology inside a custom topology
*
* Duplicate the existing topology \p oldtopology inside a new
* custom topology \p newtopology as a leaf of object \p newparent.
*
* If \p oldroot is not \c NULL, duplicate \p oldroot and all its
* children instead of the entire \p oldtopology. Passing the root
* object of \p oldtopology in \p oldroot is equivalent to passing
* \c NULL.
*
* The custom topology \p newtopology must have been prepared with
* hwloc_topology_set_custom() and not loaded with hwloc_topology_load()
* yet.
*
* \p newparent may be either the root of \p newtopology or an object
* that was added through hwloc_custom_insert_group_object_by_parent().
*/
HWLOC_DECLSPEC int hwloc_custom_insert_topology(hwloc_topology_t newtopology, hwloc_obj_t newparent, hwloc_topology_t oldtopology, hwloc_obj_t oldroot);
/** \brief Insert a new group object inside a custom topology
*
* An object with type ::HWLOC_OBJ_GROUP is inserted as a new child
* of object \p parent.
*
* \p groupdepth is the depth attribute to be given to the new object.
* It may for instance be 0 for top-level groups, 1 for their children,
* and so on.
*
* The custom topology \p newtopology must have been prepared with
* hwloc_topology_set_custom() and not loaded with hwloc_topology_load()
* yet.
*
* \p parent may be either the root of \p topology or an object that
* was added earlier through hwloc_custom_insert_group_object_by_parent().
*/
HWLOC_DECLSPEC hwloc_obj_t hwloc_custom_insert_group_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, int groupdepth);
/** @} */
#ifdef __cplusplus
} /* extern "C" */
#endif

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -38,11 +38,40 @@
* well-known easy cases.
*/
/* Some handy constants to make the logic below a little more readable */
#if defined(__cplusplus) && \
(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR >= 4))
#define GXX_ABOVE_3_4 1
#else
#define GXX_ABOVE_3_4 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#define GCC_ABOVE_2_95 1
#else
#define GCC_ABOVE_2_95 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
#define GCC_ABOVE_2_96 1
#else
#define GCC_ABOVE_2_96 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#define GCC_ABOVE_3_3 1
#else
#define GCC_ABOVE_3_3 0
#endif
/* Maybe before gcc 2.95 too */
#ifdef HWLOC_HAVE_ATTRIBUTE_UNUSED
#define __HWLOC_HAVE_ATTRIBUTE_UNUSED HWLOC_HAVE_ATTRIBUTE_UNUSED
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_UNUSED (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define __HWLOC_HAVE_ATTRIBUTE_UNUSED (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __HWLOC_HAVE_ATTRIBUTE_UNUSED 0
#endif
@ -55,7 +84,7 @@
#ifdef HWLOC_HAVE_ATTRIBUTE_MALLOC
#define __HWLOC_HAVE_ATTRIBUTE_MALLOC HWLOC_HAVE_ATTRIBUTE_MALLOC
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_MALLOC (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define __HWLOC_HAVE_ATTRIBUTE_MALLOC (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __HWLOC_HAVE_ATTRIBUTE_MALLOC 0
#endif
@ -68,7 +97,7 @@
#ifdef HWLOC_HAVE_ATTRIBUTE_CONST
#define __HWLOC_HAVE_ATTRIBUTE_CONST HWLOC_HAVE_ATTRIBUTE_CONST
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_CONST (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define __HWLOC_HAVE_ATTRIBUTE_CONST (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __HWLOC_HAVE_ATTRIBUTE_CONST 0
#endif
@ -81,7 +110,7 @@
#ifdef HWLOC_HAVE_ATTRIBUTE_PURE
#define __HWLOC_HAVE_ATTRIBUTE_PURE HWLOC_HAVE_ATTRIBUTE_PURE
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_PURE (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define __HWLOC_HAVE_ATTRIBUTE_PURE (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __HWLOC_HAVE_ATTRIBUTE_PURE 0
#endif
@ -94,7 +123,7 @@
#ifdef HWLOC_HAVE_ATTRIBUTE_DEPRECATED
#define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED HWLOC_HAVE_ATTRIBUTE_DEPRECATED
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
# define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED (GXX_ABOVE_3_4 || GCC_ABOVE_3_3)
#else
# define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED 0
#endif

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright © 2010 inria. All rights reserved.
* Copyright © 2010 Université Bordeaux 1
* Copyright © 2010-2012 inria. All rights reserved.
* Copyright © 2010-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -19,6 +19,7 @@
#include <hwloc.h>
#include <hwloc/autogen/config.h>
#include <hwloc/linux.h>
#include <hwloc/helper.h>
#include <cuda.h>
@ -32,6 +33,37 @@ extern "C" {
* @{
*/
/** \brief Return the domain, bus and device IDs of device \p cudevice.
*/
static __hwloc_inline int
hwloc_cuda_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
CUdevice cudevice, int *domain, int *bus, int *dev)
{
CUresult cres;
#if CUDA_VERSION >= 4000
cres = cuDeviceGetAttribute(domain, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
return -1;
}
#else
*domain = 0;
#endif
cres = cuDeviceGetAttribute(bus, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
return -1;
}
cres = cuDeviceGetAttribute(dev, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
return -1;
}
return 0;
}
/** \brief Get the CPU set of logical processors that are physically
* close to device \p cudevice.
*
@ -39,6 +71,8 @@ extern "C" {
* kernel-provided cpumap file and return the corresponding CPU set.
* This function is currently only implemented in a meaningful way for
* Linux; other systems will simply get a full cpuset.
*
* Topology \p topology must match the current machine.
*/
static __hwloc_inline int
hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
@ -47,30 +81,12 @@ hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
#ifdef HWLOC_LINUX_SYS
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
#define HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX 128
CUresult cres;
int domainid = 0;
int deviceid;
int busid;
char path[HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX];
FILE *sysfile = NULL;
int domainid, busid, deviceid;
#if CUDA_VERSION >= 4000
cres = cuDeviceGetAttribute(&domainid, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domainid, &busid, &deviceid))
return -1;
}
#endif
cres = cuDeviceGetAttribute(&busid, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
return -1;
}
cres = cuDeviceGetAttribute(&deviceid, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cudevice);
if (cres != CUDA_SUCCESS) {
errno = ENOSYS;
return -1;
}
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domainid, busid, deviceid);
sysfile = fopen(path, "r");
@ -78,6 +94,8 @@ hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);
#else
@ -87,6 +105,25 @@ hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
return 0;
}
/** \brief Get the hwloc object for the PCI device corresponding
* to device \p cudevice.
*
* For the given CUDA Runtime API device \p cudevice, return the hwloc PCI
* object containing the device. Returns NULL if there is none.
*
* IO devices detection must be enabled in topology \p topology.
*/
static __hwloc_inline hwloc_obj_t
hwloc_cuda_get_device_pcidev(hwloc_topology_t topology, CUdevice cudevice)
{
int domain, bus, dev;
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domain, &bus, &dev))
return NULL;
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
}
/** @} */

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright © 2010 inria. All rights reserved.
* Copyright © 2010 Université Bordeaux 1
* Copyright © 2010-2012 inria. All rights reserved.
* Copyright © 2010-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -19,6 +19,7 @@
#include <hwloc.h>
#include <hwloc/autogen/config.h>
#include <hwloc/linux.h>
#include <hwloc/helper.h>
#include <cuda_runtime_api.h>
@ -32,26 +33,14 @@ extern "C" {
* @{
*/
/** \brief Get the CPU set of logical processors that are physically
* close to device \p cudevice.
*
* For the given CUDA Runtime API device \p cudevice, read the corresponding
* kernel-provided cpumap file and return the corresponding CPU set.
* This function is currently only implemented in a meaningful way for
* Linux; other systems will simply get a full cpuset.
/** \brief Return the domain, bus and device IDs of device \p device.
*/
static __hwloc_inline int
hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
int device, hwloc_cpuset_t set)
hwloc_cudart_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
int device, int *domain, int *bus, int *dev)
{
#ifdef HWLOC_LINUX_SYS
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
#define HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX 128
cudaError_t cerr;
struct cudaDeviceProp prop;
char path[HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX];
FILE *sysfile = NULL;
int pciDomainID = 0;
cerr = cudaGetDeviceProperties(&prop, device);
if (cerr) {
@ -60,15 +49,49 @@ hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
}
#if CUDART_VERSION >= 4000
pciDomainID = prop.pciDomainID;
*domain = prop.pciDomainID;
#else
*domain = 0;
#endif
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", pciDomainID, prop.pciBusID, prop.pciDeviceID);
*bus = prop.pciBusID;
*dev = prop.pciDeviceID;
return 0;
}
/** \brief Get the CPU set of logical processors that are physically
* close to device \p device.
*
* For the given CUDA Runtime API device \p device, read the corresponding
* kernel-provided cpumap file and return the corresponding CPU set.
* This function is currently only implemented in a meaningful way for
* Linux; other systems will simply get a full cpuset.
*
* Topology \p topology must match the current machine.
*/
static __hwloc_inline int
hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
int device, hwloc_cpuset_t set)
{
#ifdef HWLOC_LINUX_SYS
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
#define HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX 128
char path[HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX];
FILE *sysfile = NULL;
int domain, bus, dev;
if (hwloc_cudart_get_device_pci_ids(topology, device, &domain, &bus, &dev))
return -1;
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domain, bus, dev);
sysfile = fopen(path, "r");
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);
#else
@ -78,6 +101,25 @@ hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
return 0;
}
/** \brief Get the hwloc object for the PCI device corresponding
* to device \p device.
*
* For the given CUDA Runtime API device \p device, return the hwloc PCI
* object containing the device. Returns NULL if there is none.
*
* IO devices detection must be enabled in topology \p topology.
*/
static __hwloc_inline hwloc_obj_t
hwloc_cudart_get_device_pcidev(hwloc_topology_t topology, int device)
{
int domain, bus, dev;
if (hwloc_cudart_get_device_pci_ids(topology, device, &domain, &bus, &dev))
return NULL;
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
}
/** @} */

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -12,6 +12,8 @@
* Applications that use both hwloc and glibc scheduling routines such as
* sched_getaffinity may want to include this file so as to ease conversion
* between their respective types.
*
* \note Topology \p topology must match the current machine.
*/
#ifndef HWLOC_GLIBC_SCHED_H
@ -78,8 +80,9 @@ static __hwloc_inline int
hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_cpuset_t hwlocset,
const cpu_set_t *schedset, size_t schedsetsize)
{
int cpu;
#ifdef CPU_ZERO_S
int cpu, count;
int count;
#endif
hwloc_bitmap_zero(hwlocset);
#ifdef CPU_ZERO_S
@ -96,7 +99,6 @@ hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribu
/* sched.h does not support dynamic cpu_set_t (introduced in glibc 2.7),
* assume we have a very old interface without CPU_COUNT (added in 2.6)
*/
int cpu;
assert(schedsetsize == sizeof(cpu_set_t));
for(cpu=0; cpu<CPU_SETSIZE; cpu++)
if (CPU_ISSET(cpu, schedset))

Просмотреть файл

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -44,7 +44,9 @@ extern "C" {
* If some objects of the given type exist in different levels, for instance
* L1 and L2 caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE.
*/
static __hwloc_inline int __hwloc_attribute_pure
static __hwloc_inline int
hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
{
int depth = hwloc_get_type_depth(topology, type);
@ -70,7 +72,9 @@ hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
* If some objects of the given type exist in different levels, for instance
* L1 and L2 caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE.
*/
static __hwloc_inline int __hwloc_attribute_pure
static __hwloc_inline int
hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
{
int depth = hwloc_get_type_depth(topology, type);
@ -106,14 +110,18 @@ hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
* for complex topologies. This function replaces the old deprecated
* hwloc_get_system_obj().
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_root_obj (hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_root_obj (hwloc_topology_t topology)
{
return hwloc_get_obj_by_depth (topology, 0, 0);
}
/** \brief Returns the ancestor object of \p obj at depth \p depth. */
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology __hwloc_attribute_unused, unsigned depth, hwloc_obj_t obj) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology __hwloc_attribute_unused, unsigned depth, hwloc_obj_t obj)
{
hwloc_obj_t ancestor = obj;
@ -125,7 +133,9 @@ hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology __hwloc_attribute_unu
}
/** \brief Returns the ancestor object of \p obj with type \p type. */
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_ancestor_obj_by_type (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_type_t type, hwloc_obj_t obj) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_ancestor_obj_by_type (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_type_t type, hwloc_obj_t obj)
{
hwloc_obj_t ancestor = obj->parent;
@ -172,7 +182,9 @@ hwloc_get_next_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type,
* processors.
* However, using CPU sets to hide this complexity should often be preferred.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_pu_obj_by_os_index(hwloc_topology_t topology, unsigned os_index) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_pu_obj_by_os_index(hwloc_topology_t topology, unsigned os_index)
{
hwloc_obj_t obj = NULL;
@ -197,7 +209,9 @@ hwloc_get_next_child (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_
}
/** \brief Returns the common parent object to objects lvl1 and lvl2 */
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_common_ancestor_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj1, hwloc_obj_t obj2) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_common_ancestor_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj1, hwloc_obj_t obj2)
{
/* the loop isn't so easy since intermediate ancestors may have
@ -222,7 +236,9 @@ hwloc_get_common_ancestor_obj (hwloc_topology_t topology __hwloc_attribute_unuse
*
* \note This function assumes that both \p obj and \p subtree_root have a \p cpuset.
*/
static __hwloc_inline int __hwloc_attribute_pure
static __hwloc_inline int
hwloc_obj_is_in_subtree (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj, hwloc_obj_t subtree_root) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_obj_is_in_subtree (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj, hwloc_obj_t subtree_root)
{
return hwloc_bitmap_isincluded(obj->cpuset, subtree_root->cpuset);
@ -243,13 +259,15 @@ hwloc_obj_is_in_subtree (hwloc_topology_t topology __hwloc_attribute_unused, hwl
* This is convenient for iterating over all largest objects within a CPU set
* by doing a loop getting the first largest object and clearing its CPU set
* from the remaining CPU set.
*
* \note This function cannot work if the root object does not have a CPU set,
* e.g. if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t
hwloc_get_first_largest_obj_inside_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set)
{
hwloc_obj_t obj = hwloc_get_root_obj(topology);
/* FIXME: what if !root->cpuset? */
if (!hwloc_bitmap_intersects(obj->cpuset, set))
if (!obj->cpuset || !hwloc_bitmap_intersects(obj->cpuset, set))
return NULL;
while (!hwloc_bitmap_isincluded(obj->cpuset, set)) {
/* while the object intersects without being included, look at its children */
@ -271,6 +289,9 @@ hwloc_get_first_largest_obj_inside_cpuset(hwloc_topology_t topology, hwloc_const
/** \brief Get the set of largest objects covering exactly a given cpuset \p set
*
* \return the number of objects returned in \p objs.
*
* \note This function cannot work if the root object does not have a CPU set,
* e.g. if the topology is made of different machines.
*/
HWLOC_DECLSPEC int hwloc_get_largest_objs_inside_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set,
hwloc_obj_t * __hwloc_restrict objs, int max);
@ -280,13 +301,17 @@ HWLOC_DECLSPEC int hwloc_get_largest_objs_inside_cpuset (hwloc_topology_t topolo
* If \p prev is \c NULL, return the first object at depth \p depth
* included in \p set. The next invokation should pass the previous
* return value in \p prev so as to obtain the next object in \p set.
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t
hwloc_get_next_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth, hwloc_obj_t prev)
{
hwloc_obj_t next = hwloc_get_next_obj_by_depth(topology, depth, prev);
/* no need to check next->cpuset because objects in levels always have a cpuset */
if (!next || !next->cpuset)
return NULL;
while (next && !hwloc_bitmap_isincluded(next->cpuset, set))
next = next->next_cousin;
return next;
@ -297,6 +322,9 @@ hwloc_get_next_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_cons
* If there are multiple or no depth for given type, return \c NULL
* and let the caller fallback to
* hwloc_get_next_obj_inside_cpuset_by_depth().
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t
hwloc_get_next_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
@ -309,15 +337,22 @@ hwloc_get_next_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const
}
/** \brief Return the (logically) \p idx -th object at depth \p depth included in CPU set \p set.
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth, unsigned idx) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth, unsigned idx)
{
unsigned count = 0;
hwloc_obj_t obj = hwloc_get_obj_by_depth (topology, depth, 0);
unsigned count = 0;
if (!obj || !obj->cpuset)
return NULL;
while (obj) {
/* no need to check obj->cpuset because objects in levels always have a cpuset */
if (hwloc_bitmap_isincluded(obj->cpuset, set)) {
if (count == idx)
return obj;
@ -333,8 +368,14 @@ hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpu
* If there are multiple or no depth for given type, return \c NULL
* and let the caller fallback to
* hwloc_get_obj_inside_cpuset_by_depth().
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
hwloc_obj_type_t type, unsigned idx) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
hwloc_obj_type_t type, unsigned idx)
{
@ -344,15 +385,23 @@ hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpus
return hwloc_get_obj_inside_cpuset_by_depth(topology, set, depth, idx);
}
/** \brief Return the number of objects at depth \p depth included in CPU set \p set. */
static __hwloc_inline unsigned __hwloc_attribute_pure
/** \brief Return the number of objects at depth \p depth included in CPU set \p set.
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline unsigned
hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth) __hwloc_attribute_pure;
static __hwloc_inline unsigned
hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth)
{
hwloc_obj_t obj = hwloc_get_obj_by_depth (topology, depth, 0);
int count = 0;
unsigned count = 0;
if (!obj || !obj->cpuset)
return 0;
while (obj) {
/* no need to check obj->cpuset because objects in levels always have a cpuset */
if (hwloc_bitmap_isincluded(obj->cpuset, set))
count++;
obj = obj->next_cousin;
@ -365,8 +414,14 @@ hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_
* If no object for that type exists inside CPU set \p set, 0 is
* returned. If there are several levels with objects of that type
* inside CPU set \p set, -1 is returned.
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline int __hwloc_attribute_pure
static __hwloc_inline int
hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
hwloc_obj_type_t type) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
hwloc_obj_type_t type)
{
@ -378,6 +433,31 @@ hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_c
return hwloc_get_nbobjs_inside_cpuset_by_depth(topology, set, depth);
}
/** \brief Return the logical index among the objects included in CPU set \p set.
*
* Consult all objects in the same level as \p obj and inside CPU set \p set
* in the logical order, and return the index of \p obj within them.
* If \p set covers the entire topology, this is the logical index of \p obj.
* Otherwise, this is similar to a logical index within the part of the topology
* defined by CPU set \p set.
*/
static __hwloc_inline int
hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
hwloc_obj_t obj) __hwloc_attribute_pure;
static __hwloc_inline int
hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
hwloc_obj_t obj)
{
int idx = 0;
if (!hwloc_bitmap_isincluded(obj->cpuset, set))
return -1;
/* count how many objects are inside the cpuset on the way from us to the beginning of the level */
while ((obj = obj->prev_cousin) != NULL)
if (hwloc_bitmap_isincluded(obj->cpuset, set))
idx++;
return idx;
}
/** @} */
@ -389,16 +469,19 @@ hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_c
/** \brief Get the child covering at least CPU set \p set.
*
* \return \c NULL if no child matches or if \p set is empty.
*
* \note This function cannot work if parent does not have a CPU set.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_child_covering_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
hwloc_obj_t parent) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_child_covering_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
hwloc_obj_t parent)
{
hwloc_obj_t child;
if (hwloc_bitmap_iszero(set))
if (!parent->cpuset || hwloc_bitmap_iszero(set))
return NULL;
child = parent->first_child;
while (child) {
if (child->cpuset && hwloc_bitmap_isincluded(set, child->cpuset))
@ -411,19 +494,18 @@ hwloc_get_child_covering_cpuset (hwloc_topology_t topology __hwloc_attribute_unu
/** \brief Get the lowest object covering at least CPU set \p set
*
* \return \c NULL if no object matches or if \p set is empty.
*
* \note This function cannot work if the root object does not have a CPU set,
* e.g. if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set)
{
struct hwloc_obj *current = hwloc_get_root_obj(topology);
if (hwloc_bitmap_iszero(set))
if (hwloc_bitmap_iszero(set) || !current->cpuset || !hwloc_bitmap_isincluded(set, current->cpuset))
return NULL;
/* FIXME: what if !root->cpuset? */
if (!hwloc_bitmap_isincluded(set, current->cpuset))
return NULL;
while (1) {
hwloc_obj_t child = hwloc_get_child_covering_cpuset(topology, set, current);
if (!child)
@ -447,13 +529,17 @@ hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t s
* depth covering at least part of CPU set \p set. The next
* invokation should pass the previous return value in \p prev so as
* to obtain the next object covering at least another part of \p set.
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t
hwloc_get_next_obj_covering_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set,
unsigned depth, hwloc_obj_t prev)
{
hwloc_obj_t next = hwloc_get_next_obj_by_depth(topology, depth, prev);
/* no need to check next->cpuset because objects in levels always have a cpuset */
if (!next || !next->cpuset)
return NULL;
while (next && !hwloc_bitmap_intersects(set, next->cpuset))
next = next->next_cousin;
return next;
@ -470,6 +556,9 @@ hwloc_get_next_obj_covering_cpuset_by_depth(hwloc_topology_t topology, hwloc_con
* If there are no or multiple depths for type \p type, \c NULL is returned.
* The caller may fallback to hwloc_get_next_obj_covering_cpuset_by_depth()
* for each depth.
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t
hwloc_get_next_obj_covering_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set,
@ -491,9 +580,14 @@ hwloc_get_next_obj_covering_cpuset_by_type(hwloc_topology_t topology, hwloc_cons
/** \brief Get the first cache covering a cpuset \p set
*
* \return \c NULL if no cache matches
* \return \c NULL if no cache matches.
*
* \note This function cannot work if the root object does not have a CPU set,
* e.g. if the topology is made of different machines.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_cache_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_cache_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set)
{
hwloc_obj_t current = hwloc_get_obj_covering_cpuset(topology, set);
@ -509,7 +603,9 @@ hwloc_get_cache_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t
*
* \return \c NULL if no cache matches or if an invalid object is given.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj)
{
hwloc_obj_t current = obj->parent;
@ -545,6 +641,8 @@ hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute
* \return the number of objects returned in \p objs.
*
* \return 0 if \p src is an I/O object.
*
* \note This function requires the \p src object to have a CPU set.
*/
/* TODO: rather provide an iterator? Provide a way to know how much should be allocated? By returning the total number of objects instead? */
HWLOC_DECLSPEC unsigned hwloc_get_closest_objs (hwloc_topology_t topology, hwloc_obj_t src, hwloc_obj_t * __hwloc_restrict objs, unsigned max);
@ -558,18 +656,22 @@ HWLOC_DECLSPEC unsigned hwloc_get_closest_objs (hwloc_topology_t topology, hwloc
*
* For instance, if type1 is SOCKET, idx1 is 2, type2 is CORE and idx2
* is 3, return the fourth core object below the third socket.
*
* \note This function requires these objects to have a CPU set.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_below_by_type (hwloc_topology_t topology,
hwloc_obj_type_t type1, unsigned idx1,
hwloc_obj_type_t type2, unsigned idx2) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_below_by_type (hwloc_topology_t topology,
hwloc_obj_type_t type1, unsigned idx1,
hwloc_obj_type_t type2, unsigned idx2)
{
hwloc_obj_t obj;
obj = hwloc_get_obj_by_type (topology, type1, idx1);
if (!obj)
if (!obj || !obj->cpuset)
return NULL;
return hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, type2, idx2);
}
@ -587,20 +689,22 @@ hwloc_get_obj_below_by_type (hwloc_topology_t topology,
* For instance, if nr is 3, typev contains NODE, SOCKET and CORE,
* and idxv contains 0, 1 and 2, return the third core object below
* the second socket below the first NUMA node.
*
* \note This function requires all these objects and the root object
* to have a CPU set.
*/
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv) __hwloc_attribute_pure;
static __hwloc_inline hwloc_obj_t
hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv)
{
hwloc_obj_t obj = hwloc_get_root_obj(topology);
int i;
/* FIXME: what if !root->cpuset? */
for(i=0; i<nr; i++) {
obj = hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, typev[i], idxv[i]);
if (!obj)
if (!obj || !obj->cpuset)
return NULL;
obj = hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, typev[i], idxv[i]);
}
return obj;
}
@ -624,6 +728,8 @@ hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_
*
* The caller may typically want to also call hwloc_bitmap_singlify()
* before binding a thread so that it does not move at all.
*
* \note This function requires the \p root object to have a CPU set.
*/
static __hwloc_inline void
hwloc_distributev(hwloc_topology_t topology, hwloc_obj_t *root, unsigned n_roots, hwloc_cpuset_t *cpuset, unsigned n, unsigned until);
@ -631,15 +737,12 @@ static __hwloc_inline void
hwloc_distribute(hwloc_topology_t topology, hwloc_obj_t root, hwloc_cpuset_t *cpuset, unsigned n, unsigned until)
{
unsigned i;
/* FIXME: what if !root->cpuset? */
if (!root->arity || n == 1 || root->depth >= until) {
/* Got to the bottom, we can't split any more, put everything there. */
for (i=0; i<n; i++)
cpuset[i] = hwloc_bitmap_dup(root->cpuset);
return;
}
hwloc_distributev(topology, root->children, root->arity, cpuset, n, until);
}
@ -647,6 +750,8 @@ hwloc_distribute(hwloc_topology_t topology, hwloc_obj_t root, hwloc_cpuset_t *cp
*
* This is the same as hwloc_distribute, but takes an array of roots instead of
* just one root.
*
* \note This function requires the \p roots objects to have a CPU set.
*/
static __hwloc_inline void
hwloc_distributev(hwloc_topology_t topology, hwloc_obj_t *roots, unsigned n_roots, hwloc_cpuset_t *cpuset, unsigned n, unsigned until)
@ -725,7 +830,9 @@ hwloc_alloc_membind_policy(hwloc_topology_t topology, size_t len, hwloc_const_cp
* \note The returned cpuset is not newly allocated and should thus not be
* changed or freed; hwloc_cpuset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_complete_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_complete_cpuset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->complete_cpuset;
@ -741,7 +848,9 @@ hwloc_topology_get_complete_cpuset(hwloc_topology_t topology)
* \note The returned cpuset is not newly allocated and should thus not be
* changed or freed; hwloc_cpuset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_topology_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_topology_cpuset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->cpuset;
@ -756,7 +865,9 @@ hwloc_topology_get_topology_cpuset(hwloc_topology_t topology)
* \note The returned cpuset is not newly allocated and should thus not be
* changed or freed; hwloc_cpuset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_online_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_online_cpuset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->online_cpuset;
@ -771,7 +882,9 @@ hwloc_topology_get_online_cpuset(hwloc_topology_t topology)
* \note The returned cpuset is not newly allocated and should thus not be
* changed or freed, hwloc_cpuset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_cpuset_t
hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->allowed_cpuset;
@ -793,7 +906,9 @@ hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology)
* \note The returned nodeset is not newly allocated and should thus not be
* changed or freed; hwloc_nodeset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_nodeset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_complete_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_complete_nodeset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->complete_nodeset;
@ -809,7 +924,9 @@ hwloc_topology_get_complete_nodeset(hwloc_topology_t topology)
* \note The returned nodeset is not newly allocated and should thus not be
* changed or freed; hwloc_nodeset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_nodeset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_topology_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_topology_nodeset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->nodeset;
@ -824,7 +941,9 @@ hwloc_topology_get_topology_nodeset(hwloc_topology_t topology)
* \note The returned nodeset is not newly allocated and should thus not be
* changed or freed, hwloc_nodeset_dup must be used to obtain a local copy.
*/
static __hwloc_inline hwloc_const_nodeset_t __hwloc_attribute_pure
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
static __hwloc_inline hwloc_const_nodeset_t
hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology)
{
return hwloc_get_root_obj(topology)->allowed_nodeset;

Просмотреть файл

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2010, 2012 Université Bordeaux 1
* See COPYING in top-level directory.
*/
@ -15,6 +15,8 @@
* or non-NUMA-aware kernels by assuming that the machines have a single
* NUMA node.
*
* \note Topology \p topology must match the current machine.
*
* \note The behavior of libnuma is undefined if the kernel is not NUMA-aware.
* (when CONFIG_NUMA is not set in the kernel configuration).
* This helper and libnuma may thus not be strictly compatible in this case,
@ -142,15 +144,12 @@ hwloc_cpuset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_cpuset_t
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
unsigned i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(cpuset);
for(i=0; i<maxnode; i++)
if (mask[i/sizeof(*mask)/8] & (1UL << (i% (sizeof(*mask)*8)))) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (node->os_index < maxnode
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
} else {
/* if no numa, libnuma assumes we have a single node */
if (mask[0] & 1)
@ -178,15 +177,12 @@ hwloc_nodeset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_nodeset
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
unsigned i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(nodeset);
for(i=0; i<maxnode; i++)
if (mask[i/sizeof(*mask)/8] & (1UL << (i% (sizeof(*mask)*8)))) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_set(nodeset, node->os_index);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (node->os_index < maxnode
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
hwloc_bitmap_set(nodeset, node->os_index);
} else {
/* if no numa, libnuma assumes we have a single node */
if (mask[0] & 1)
@ -216,7 +212,9 @@ hwloc_nodeset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_nodeset
*
* \return newly allocated struct bitmask.
*/
static __hwloc_inline struct bitmask * __hwloc_attribute_malloc
static __hwloc_inline struct bitmask *
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset) __hwloc_attribute_malloc;
static __hwloc_inline struct bitmask *
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
@ -247,7 +245,9 @@ hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpu
*
* \return newly allocated struct bitmask.
*/
static __hwloc_inline struct bitmask * __hwloc_attribute_malloc
static __hwloc_inline struct bitmask *
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset) __hwloc_attribute_malloc;
static __hwloc_inline struct bitmask *
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
@ -281,15 +281,11 @@ hwloc_cpuset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_cpuset_
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
int i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(cpuset);
for(i=0; i<NUMA_NUM_NODES; i++)
if (numa_bitmask_isbitset(bitmask, i)) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (numa_bitmask_isbitset(bitmask, node->os_index))
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
} else {
/* if no numa, libnuma assumes we have a single node */
if (numa_bitmask_isbitset(bitmask, 0))
@ -313,15 +309,11 @@ hwloc_nodeset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_nodese
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
int i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(nodeset);
for(i=0; i<NUMA_NUM_NODES; i++)
if (numa_bitmask_isbitset(bitmask, i)) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_set(nodeset, node->os_index);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (numa_bitmask_isbitset(bitmask, node->os_index))
hwloc_bitmap_set(nodeset, node->os_index);
} else {
/* if no numa, libnuma assumes we have a single node */
if (numa_bitmask_isbitset(bitmask, 0))
@ -339,6 +331,12 @@ hwloc_nodeset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_nodese
#ifdef NUMA_VERSION1_COMPATIBILITY
/** \defgroup hwlocality_linux_libnuma_nodemask Helpers for manipulating Linux libnuma nodemask_t
*
* \note The Linux libnuma nodemask_t interface is deprecated and
* its implementation is at least incorrect with respect to sparse
* NUMA node ids. It is strongly advised to use struct bitmask
* instead of nodemask_t, or even to use hwloc directly.
*
* @{
*/
@ -408,15 +406,11 @@ hwloc_cpuset_from_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_cpuset
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
int i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(cpuset);
for(i=0; i<NUMA_NUM_NODES; i++)
if (nodemask_isset(nodemask, i)) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (nodemask_isset(nodemask, node->os_index))
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
} else {
/* if no numa, libnuma assumes we have a single node */
if (nodemask_isset(nodemask, 0))
@ -440,15 +434,11 @@ hwloc_nodeset_from_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_nodes
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node;
int i;
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(nodeset);
for(i=0; i<NUMA_NUM_NODES; i++)
if (nodemask_isset(nodemask, i)) {
node = hwloc_get_obj_by_depth(topology, depth, i);
if (node)
hwloc_bitmap_set(nodeset, node->os_index);
}
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (nodemask_isset(nodemask, node->os_index))
hwloc_bitmap_set(nodeset, node->os_index);
} else {
/* if no numa, libnuma assumes we have a single node */
if (nodemask_isset(nodemask, 0))

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright © 2010 inria. All rights reserved.
* Copyright © 2010-2012 inria. All rights reserved.
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -36,6 +36,8 @@ extern "C" {
*
* For the given Myrinet Express board index \p id, read the
* OS-provided NUMA node and return the corresponding CPU set.
*
* Topology \p topology must match the current machine.
*/
static __hwloc_inline int
hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology,
@ -69,6 +71,8 @@ hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology,
*
* For the given Myrinet Express endpoint \p endpoint, read the
* OS-provided NUMA node and return the corresponding CPU set.
*
* Topology \p topology must match the current machine.
*/
static __hwloc_inline int
hwloc_mx_endpoint_get_device_cpuset(hwloc_topology_t topology,

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -42,6 +42,8 @@ extern "C" {
* kernel-provided cpumap file and return the corresponding CPU set.
* This function is currently only implemented in a meaningful way for
* Linux; other systems will simply get a full cpuset.
*
* Topology \p topology must match the current machine.
*/
static __hwloc_inline int
hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
@ -61,6 +63,8 @@ hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);
#else

Просмотреть файл

@ -118,6 +118,7 @@ extern "C" {
#define hwloc_topology_set_synthetic HWLOC_NAME(topology_set_synthetic)
#define hwloc_topology_set_xml HWLOC_NAME(topology_set_xml)
#define hwloc_topology_set_xmlbuffer HWLOC_NAME(topology_set_xmlbuffer)
#define hwloc_topology_set_custom HWLOC_NAME(topology_set_custom)
#define hwloc_topology_set_distance_matrix HWLOC_NAME(topology_set_distance_matrix)
#define hwloc_topology_discovery_support HWLOC_NAME(topology_discovery_support)
@ -132,6 +133,9 @@ extern "C" {
#define hwloc_topology_insert_misc_object_by_cpuset HWLOC_NAME(topology_insert_misc_object_by_cpuset)
#define hwloc_topology_insert_misc_object_by_parent HWLOC_NAME(topology_insert_misc_object_by_parent)
#define hwloc_custom_insert_topology HWLOC_NAME(custom_insert_topology)
#define hwloc_custom_insert_group_object_by_parent HWLOC_NAME(custom_insert_group_object_by_parent)
#define hwloc_restrict_flags_e HWLOC_NAME(restrict_flags_e)
#define HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_DISTANCES)
#define HWLOC_RESTRICT_FLAG_ADAPT_MISC HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_MISC)
@ -229,7 +233,6 @@ extern "C" {
/* hwloc/bitmap.h */
#define hwloc_bitmap HWLOC_NAME(bitmap)
#define hwloc_bitmap_s HWLOC_NAME(bitmap_s)
#define hwloc_bitmap_t HWLOC_NAME(bitmap_t)
#define hwloc_const_bitmap_t HWLOC_NAME(const_bitmap_t)
@ -283,11 +286,6 @@ extern "C" {
/* hwloc/cpuset.h -- deprecated but still available */
#define hwloc_cpuset HWLOC_NAME(cpuset)
#define hwloc_cpuset_s HWLOC_NAME(cpuset_s)
#define hwloc_cpuset_t HWLOC_NAME(cpuset_t)
#define hwloc_const_cpuset_t HWLOC_NAME(const_cpuset_t)
#define hwloc_cpuset_alloc HWLOC_NAME(cpuset_alloc)
#define hwloc_cpuset_free HWLOC_NAME(cpuset_free)
#define hwloc_cpuset_dup HWLOC_NAME(cpuset_dup)
@ -419,11 +417,15 @@ extern "C" {
/* cuda.h */
#define hwloc_cuda_get_device_pci_ids HWLOC_NAME(cuda_get_device_pci_ids)
#define hwloc_cuda_get_device_cpuset HWLOC_NAME(cuda_get_device_cpuset)
#define hwloc_cuda_get_device_pcidev HWLOC_NAME(cuda_get_device_pcidev)
/* cudart.h */
#define hwloc_cudart_get_device_pci_ids HWLOC_NAME(cudart_get_device_pci_ids)
#define hwloc_cudart_get_device_cpuset HWLOC_NAME(cudart_get_device_cpuset)
#define hwloc_cudart_get_device_pcidev HWLOC_NAME(cudart_get_device_pcidev)
/* private/debug.h */
@ -458,29 +460,31 @@ extern "C" {
#define HWLOC_BACKEND_NONE HWLOC_NAME_CAPS(BACKEND_NONE)
#define HWLOC_BACKEND_SYNTHETIC HWLOC_NAME_CAPS(BACKEND_SYNTHETIC)
#define HWLOC_BACKEND_SYSFS HWLOC_NAME_CAPS(BACKEND_SYSFS)
#define HWLOC_BACKEND_LINUXFS HWLOC_NAME_CAPS(BACKEND_LINUXFS)
#define HWLOC_BACKEND_XML HWLOC_NAME_CAPS(BACKEND_XML)
#define HWLOC_BACKEND_MAX HWLOC_NAME_CAPS(BACKEND_MAX)
#define hwloc_backend_params_u HWLOC_NAME(backend_params_u)
#define hwloc_backend_params_sysfs_s HWLOC_NAME(backend_params_sysfs_s)
#define hwloc_backend_params_linuxfs_s HWLOC_NAME(backend_params_linuxfs_s)
#define hwloc_backend_params_osf HWLOC_NAME(backend_params_osf)
#define hwloc_backend_params_xml_s HWLOC_NAME(backend_params_xml_s)
#define hwloc_backend_params_synthetic_s HWLOC_NAME(backend_params_synthetic_s)
#define hwloc_xml_imported_distances_s HWLOC_NAME(xml_imported_distances_s)
#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
#define hwloc_setup_misc_level_from_distances HWLOC_NAME(setup_misc_level_from_distances)
#define hwloc_get_sysctlbyname HWLOC_NAME(get_sysctlbyname)
#define hwloc_get_sysctl HWLOC_NAME(get_sysctl)
#define hwloc_fallback_nbprocessors HWLOC_NAME(fallback_nbprocessors)
#define hwloc_connect_children HWLOC_NAME(connect_children)
#define hwloc_connect_levels HWLOC_NAME(connect_levels)
#define hwloc_look_linux HWLOC_NAME(look_linux)
#define hwloc_set_linux_hooks HWLOC_NAME(set_linux_hooks)
#define hwloc_backend_sysfs_init HWLOC_NAME(backend_sysfs_init)
#define hwloc_backend_sysfs_exit HWLOC_NAME(backend_sysfs_exit)
#define hwloc_look_linuxfs HWLOC_NAME(look_linuxfs)
#define hwloc_set_linuxfs_hooks HWLOC_NAME(set_linuxfs_hooks)
#define hwloc_backend_linuxfs_init HWLOC_NAME(backend_linuxfs_init)
#define hwloc_backend_linuxfs_exit HWLOC_NAME(backend_linuxfs_exit)
#define hwloc_backend_xml_init HWLOC_NAME(backend_xml_init)
#define hwloc_xml_check_distances HWLOC_NAME(xml_check_distances)
#define hwloc_look_xml HWLOC_NAME(look_xml)
#define hwloc_backend_xml_exit HWLOC_NAME(backend_xml_exit)
@ -520,7 +524,6 @@ extern "C" {
#define hwloc__insert_object_by_cpuset HWLOC_NAME(_insert_object_by_cpuset)
#define hwloc_insert_object_by_parent HWLOC_NAME(insert_object_by_parent)
#define hwloc_add_uname_info HWLOC_NAME(add_uname_info)
#define hwloc_free_object HWLOC_NAME(free_object)
#define hwloc_bitmap_printf_value HWLOC_NAME(bitmap_printf_value)
#define hwloc_alloc_setup_object HWLOC_NAME(alloc_setup_object)
#define hwloc_free_unlinked_object HWLOC_NAME(free_unlinked_object)
@ -532,15 +535,17 @@ extern "C" {
#define hwloc_free_mmap HWLOC_NAME(free_mmap)
#define hwloc_alloc_or_fail HWLOC_NAME(alloc_or_fail)
#define hwloc_topology_distances_init HWLOC_NAME(topology_distances_init)
#define hwloc_topology_distances_clear HWLOC_NAME(topology_distances_clear)
#define hwloc_topology_distances_destroy HWLOC_NAME(topology_distances_destroy)
#define hwloc_topology__set_distance_matrix HWLOC_NAME(topology__set_distance_matrix)
#define hwloc_store_distances_from_env HWLOC_NAME(store_distances_from_env)
#define hwloc_convert_distances_indexes_into_objects HWLOC_NAME(convert_distances_indexes_into_objects)
#define hwloc_finalize_logical_distances HWLOC_NAME(finalize_logical_distances)
#define hwloc_restrict_distances HWLOC_NAME(restrict_distances)
#define hwloc_free_logical_distances HWLOC_NAME(free_logical_distances)
#define hwloc_distances_init HWLOC_NAME(distances_init)
#define hwloc_distances_clear HWLOC_NAME(distances_clear)
#define hwloc_distances_destroy HWLOC_NAME(distances_destroy)
#define hwloc_distances_set HWLOC_NAME(distances_set)
#define hwloc_distances_set_from_env HWLOC_NAME(distances_set_from_env)
#define hwloc_distances_restrict_os HWLOC_NAME(distances_restrict_os)
#define hwloc_distances_restrict HWLOC_NAME(distances_restrict)
#define hwloc_distances_finalize_os HWLOC_NAME(distances_finalize_os)
#define hwloc_distances_finalize_logical HWLOC_NAME(distances_finalize_logical)
#define hwloc_clear_object_distances HWLOC_NAME(clear_object_distances)
#define hwloc_clear_object_distances_one HWLOC_NAME(clear_object_distances_one)
#define hwloc_group_by_distances HWLOC_NAME(group_by_distances)
#endif /* HWLOC_SYM_TRANSFORM */

Просмотреть файл

@ -46,6 +46,10 @@
*/
#undef HAVE_DECL_CTL_HW
/* Define to 1 if you have the declaration of `fabsf', and to 0 if you don't.
*/
#undef HAVE_DECL_FABSF
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
don't. */
#undef HAVE_DECL_HW_NCPU
@ -178,6 +182,9 @@
/* Define to 1 if you have the <pci/pci.h> header file. */
#undef HAVE_PCI_PCI_H
/* Define to 1 if you have the <picl.h> header file. */
#undef HAVE_PICL_H
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN

Просмотреть файл

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -89,7 +89,9 @@ extern int ffs(int) __hwloc_attribute_const;
#ifdef HWLOC_NO_FFS
/* no ffs or it is known to be broken */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_ffsl(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_ffsl(unsigned long x)
{
int i;
@ -133,7 +135,9 @@ hwloc_ffsl(unsigned long x)
/* We only have an int ffs(int) implementation, build a long one. */
/* First make it 32 bits if it was only 16. */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_ffs32(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_ffs32(unsigned long x)
{
#if HWLOC_BITS_PER_INT == 16
@ -154,7 +158,9 @@ hwloc_ffs32(unsigned long x)
}
/* Then make it 64 bit if longs are. */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_ffsl(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_ffsl(unsigned long x)
{
#if HWLOC_BITS_PER_LONG == 64
@ -223,7 +229,9 @@ extern int clz(int) __hwloc_attribute_const;
#else /* no fls implementation */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_flsl(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_flsl(unsigned long x)
{
int i = 0;
@ -269,7 +277,9 @@ hwloc_flsl(unsigned long x)
/* We only have an int fls(int) implementation, build a long one. */
/* First make it 32 bits if it was only 16. */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_fls32(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_fls32(unsigned long x)
{
#if HWLOC_BITS_PER_INT == 16
@ -290,7 +300,9 @@ hwloc_fls32(unsigned long x)
}
/* Then make it 64 bit if longs are. */
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_flsl(unsigned long x) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_flsl(unsigned long x)
{
#if HWLOC_BITS_PER_LONG == 64
@ -311,7 +323,9 @@ hwloc_flsl(unsigned long x)
}
#endif
static __hwloc_inline int __hwloc_attribute_const
static __hwloc_inline int
hwloc_weight_long(unsigned long w) __hwloc_attribute_const;
static __hwloc_inline int
hwloc_weight_long(unsigned long w)
{
#if HWLOC_BITS_PER_LONG == 32

Просмотреть файл

@ -20,7 +20,9 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
#include <string.h>
#ifdef HWLOC_HAVE_ATTRIBUTE_FORMAT
@ -45,9 +47,10 @@ typedef enum hwloc_backend_e {
HWLOC_BACKEND_NONE,
HWLOC_BACKEND_SYNTHETIC,
#ifdef HWLOC_LINUX_SYS
HWLOC_BACKEND_SYSFS,
HWLOC_BACKEND_LINUXFS,
#endif
HWLOC_BACKEND_XML,
HWLOC_BACKEND_CUSTOM,
/* This value is only here so that we can end the enum list without
a comma (thereby preventing compiler warnings) */
HWLOC_BACKEND_MAX
@ -108,6 +111,7 @@ struct hwloc_topology {
struct hwloc_topology_support support;
struct hwloc_os_distances_s {
hwloc_obj_type_t type;
int nbobjs;
unsigned *indexes; /* array of OS indexes before we can convert them into objs. always available.
*/
@ -120,16 +124,19 @@ struct hwloc_topology {
* will be copied into the main logical-index-ordered distance at the end of the discovery.
*/
int forced; /* set if the user forced a matrix to ignore the OS one */
} os_distances[HWLOC_OBJ_TYPE_MAX];
struct hwloc_os_distances_s *prev, *next;
} *first_osdist, *last_osdist;
hwloc_backend_t backend_type;
union hwloc_backend_params_u {
#ifdef HWLOC_LINUX_SYS
struct hwloc_backend_params_sysfs_s {
/* sysfs backend parameters */
struct hwloc_backend_params_linuxfs_s {
/* FS root parameters */
char *root_path; /* The path of the file system root, used when browsing, e.g., Linux' sysfs and procfs. */
int root_fd; /* The file descriptor for the file system root, used when browsing, e.g., Linux' sysfs and procfs. */
} sysfs;
struct utsname utsname; /* cached result of uname, used multiple times */
} linuxfs;
#endif /* HWLOC_LINUX_SYS */
#if defined(HWLOC_OSF_SYS) || defined(HWLOC_COMPILE_PORTS)
struct hwloc_backend_params_osf {
@ -142,9 +149,15 @@ struct hwloc_topology {
void *doc;
#endif /* HWLOC_HAVE_LIBXML2 */
char *buffer; /* only used when not using libxml2 */
struct hwloc_xml_imported_distances_s {
hwloc_obj_t root;
struct hwloc_distances_s distances;
struct hwloc_xml_imported_distances_s *prev, *next;
} *first_distances, *last_distances;
} xml;
struct hwloc_backend_params_synthetic_s {
/* synthetic backend parameters */
char *string;
#define HWLOC_SYNTHETIC_MAX_DEPTH 128
unsigned arity[HWLOC_SYNTHETIC_MAX_DEPTH];
hwloc_obj_type_t type[HWLOC_SYNTHETIC_MAX_DEPTH];
@ -159,16 +172,18 @@ extern void hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb_pu
extern int hwloc_get_sysctlbyname(const char *name, int64_t *n);
extern int hwloc_get_sysctl(int name[], unsigned namelen, int *n);
extern unsigned hwloc_fallback_nbprocessors(struct hwloc_topology *topology);
extern void hwloc_connect_children(hwloc_obj_t obj);
extern int hwloc_connect_levels(hwloc_topology_t topology);
#if defined(HWLOC_LINUX_SYS)
extern void hwloc_look_linux(struct hwloc_topology *topology);
extern void hwloc_set_linux_hooks(struct hwloc_topology *topology);
extern int hwloc_backend_sysfs_init(struct hwloc_topology *topology, const char *fsroot_path);
extern void hwloc_backend_sysfs_exit(struct hwloc_topology *topology);
extern void hwloc_look_linuxfs(struct hwloc_topology *topology);
extern void hwloc_set_linuxfs_hooks(struct hwloc_topology *topology);
extern int hwloc_backend_linuxfs_init(struct hwloc_topology *topology, const char *fsroot_path);
extern void hwloc_backend_linuxfs_exit(struct hwloc_topology *topology);
#endif /* HWLOC_LINUX_SYS */
extern int hwloc_backend_xml_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int buflen);
extern void hwloc_xml_check_distances(struct hwloc_topology *topology);
extern int hwloc_look_xml(struct hwloc_topology *topology);
extern void hwloc_backend_xml_exit(struct hwloc_topology *topology);
@ -342,15 +357,21 @@ hwloc_alloc_or_fail(hwloc_topology_t topology, size_t len, int flags)
return hwloc_alloc(topology, len);
}
extern void hwloc_topology_distances_init(struct hwloc_topology *topology);
extern void hwloc_topology_distances_clear(struct hwloc_topology *topology);
extern void hwloc_topology_distances_destroy(struct hwloc_topology *topology);
extern void hwloc_topology__set_distance_matrix(struct hwloc_topology *topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances, int force);
extern void hwloc_store_distances_from_env(struct hwloc_topology *topology);
extern void hwloc_convert_distances_indexes_into_objects(struct hwloc_topology *topology);
extern void hwloc_finalize_logical_distances(struct hwloc_topology *topology);
extern void hwloc_restrict_distances(struct hwloc_topology *topology, unsigned long flags);
extern void hwloc_free_logical_distances(struct hwloc_distances_s *dist);
extern void hwloc_distances_init(struct hwloc_topology *topology);
extern void hwloc_distances_clear(struct hwloc_topology *topology);
extern void hwloc_distances_destroy(struct hwloc_topology *topology);
extern void hwloc_distances_set(struct hwloc_topology *topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances, int force);
extern void hwloc_distances_set_from_env(struct hwloc_topology *topology);
extern void hwloc_distances_restrict_os(struct hwloc_topology *topology);
extern void hwloc_distances_restrict(struct hwloc_topology *topology, unsigned long flags);
extern void hwloc_distances_finalize_os(struct hwloc_topology *topology);
extern void hwloc_distances_finalize_logical(struct hwloc_topology *topology);
extern void hwloc_clear_object_distances(struct hwloc_obj *obj);
extern void hwloc_clear_object_distances_one(struct hwloc_distances_s *distances);
extern void hwloc_group_by_distances(struct hwloc_topology *topology);
#if !HAVE_DECL_FABSF
#define fabsf(f) fabs((double)(f))
#endif
#endif /* HWLOC_PRIVATE_H */

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/* SPARC Chip Modes. */
#define MODE_UNKNOWN 0
#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* hwloc_solaris_get_chip_type(void);
char* hwloc_solaris_get_chip_model(void);

Просмотреть файл

@ -1,6 +1,7 @@
# Copyright © 2009-2010 inria. All rights reserved.
# Copyright © 2009-2010, 2012 Université Bordeaux 1
# Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
# Copyright © 2011 Oracle and/or its affiliates. All rights reserved.
# See COPYING in top-level directory.
AM_CFLAGS = $(HWLOC_CFLAGS)
@ -39,6 +40,8 @@ endif HWLOC_HAVE_LIBPCI
if HWLOC_HAVE_SOLARIS
sources += topology-solaris.c
sources += topology-solaris-chiptype.c
ldflags += -lpicl
endif HWLOC_HAVE_SOLARIS
if HWLOC_HAVE_LINUX
@ -83,7 +86,7 @@ ldflags += -Xlinker --output-def -Xlinker .libs/libhwloc.def
if HWLOC_HAVE_MS_LIB
.libs/libhwloc.lib: libhwloc.la dolib
[ ! -r .libs/libhwloc.def ] || ./dolib "$(HWLOC_MS_LIB)" $(HWLOC_MS_LIB_ARCH) .libs/libhwloc.def libhwloc-$(HWLOC_SOVERSION) .libs/libhwloc.lib
[ ! -r .libs/libhwloc.def ] || ./dolib "$(HWLOC_MS_LIB)" $(HWLOC_MS_LIB_ARCH) .libs/libhwloc.def $(libhwloc_so_version) .libs/libhwloc.lib
all-local: .libs/libhwloc.lib
endif HWLOC_HAVE_MS_LIB
@ -100,7 +103,7 @@ sources += topology-x86.c
# Installable library
libhwloc_la_SOURCES = $(sources)
libhwloc_la_LDFLAGS = $(ldflags) -version-number $(libhwloc_so_version) $(HWLOC_LIBS)
libhwloc_la_LDFLAGS = $(ldflags) -version-info $(libhwloc_so_version) $(HWLOC_LIBS)
# Embedded library (note the lack of a .so version number -- that
# intentionally only appears in the installable library). Also note

Просмотреть файл

@ -13,76 +13,113 @@
#include <float.h>
#include <math.h>
/**************************
* Main Init/Clear/Destroy
*/
/* called during topology init */
void hwloc_topology_distances_init(struct hwloc_topology *topology)
void hwloc_distances_init(struct hwloc_topology *topology)
{
unsigned i;
for (i = HWLOC_OBJ_SYSTEM; i < HWLOC_OBJ_TYPE_MAX; i++) {
/* no distances yet */
topology->os_distances[i].nbobjs = 0;
topology->os_distances[i].objs = NULL;
topology->os_distances[i].indexes = NULL;
topology->os_distances[i].distances = NULL;
topology->os_distances[i].forced = 0;
}
topology->first_osdist = topology->last_osdist = NULL;
}
/* called when reloading a topology.
* keep initial parameters (from set_distances and environment),
* but drop what was generated during previous load().
*/
void hwloc_topology_distances_clear(struct hwloc_topology *topology)
void hwloc_distances_clear(struct hwloc_topology *topology)
{
unsigned i;
for (i = HWLOC_OBJ_SYSTEM; i < HWLOC_OBJ_TYPE_MAX; i++) {
struct hwloc_os_distances_s * osdist;
for(osdist = topology->first_osdist; osdist; osdist = osdist->next) {
/* remove final distance matrices, but keep physically-ordered ones */
free(topology->os_distances[i].objs);
topology->os_distances[i].objs = NULL;
free(osdist->objs);
osdist->objs = NULL;
}
}
/* called during topology destroy */
void hwloc_topology_distances_destroy(struct hwloc_topology *topology)
void hwloc_distances_destroy(struct hwloc_topology * topology)
{
unsigned i;
for (i = HWLOC_OBJ_SYSTEM; i < HWLOC_OBJ_TYPE_MAX; i++) {
struct hwloc_os_distances_s *osdist, *next = topology->first_osdist;
while ((osdist = next) != NULL) {
next = osdist->next;
/* remove final distance matrics AND physically-ordered ones */
free(topology->os_distances[i].indexes);
topology->os_distances[i].indexes = NULL;
free(topology->os_distances[i].objs);
topology->os_distances[i].objs = NULL;
free(topology->os_distances[i].distances);
topology->os_distances[i].distances = NULL;
free(osdist->indexes);
free(osdist->objs);
free(osdist->distances);
free(osdist);
}
topology->first_osdist = topology->last_osdist = NULL;
}
/******************************************************
* Inserting distances in the topology
* from a backend, from the environment or by the user
*/
/* insert a distance matrix in the topology.
* the caller gives us those pointers, we take care of freeing them later and so on.
*/
void hwloc_topology__set_distance_matrix(hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances,
int force)
void hwloc_distances_set(hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances,
int force)
{
if (topology->os_distances[type].forced && !force) {
free(indexes);
free(objs);
free(distances);
return;
struct hwloc_os_distances_s *osdist, *next = topology->first_osdist;
/* look for existing distances for the same type */
while ((osdist = next) != NULL) {
next = osdist->next;
if (osdist->type == type) {
if (osdist->forced && !force) {
/* there is a forced distance element, ignore the new non-forced one */
free(indexes);
free(objs);
free(distances);
return;
} else if (force) {
/* we're forcing a new distance, remove the old ones */
free(osdist->indexes);
free(osdist->objs);
free(osdist->distances);
/* remove current object */
if (osdist->prev)
osdist->prev->next = next;
else
topology->first_osdist = next;
if (next)
next->prev = osdist->prev;
else
topology->last_osdist = osdist->prev;
/* free current object */
free(osdist);
}
}
}
free(topology->os_distances[type].indexes);
free(topology->os_distances[type].objs);
free(topology->os_distances[type].distances);
topology->os_distances[type].nbobjs = nbobjs;
topology->os_distances[type].indexes = indexes;
topology->os_distances[type].objs = objs;
topology->os_distances[type].distances = distances;
topology->os_distances[type].forced = force;
if (!nbobjs)
/* we're just clearing, return now */
return;
/* create the new element */
osdist = malloc(sizeof(struct hwloc_os_distances_s));
osdist->nbobjs = nbobjs;
osdist->indexes = indexes;
osdist->objs = objs;
osdist->distances = distances;
osdist->forced = force;
osdist->type = type;
/* insert it */
osdist->next = NULL;
osdist->prev = topology->last_osdist;
if (topology->last_osdist)
topology->last_osdist->next = osdist;
else
topology->first_osdist = osdist;
topology->last_osdist = osdist;
}
/* make sure a user-given distance matrix is sane */
static int hwloc_topology__check_distance_matrix(hwloc_topology_t __hwloc_restrict topology __hwloc_attribute_unused, hwloc_obj_type_t type __hwloc_attribute_unused,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs __hwloc_attribute_unused, float *distances __hwloc_attribute_unused)
static int hwloc_distances__check_matrix(hwloc_topology_t __hwloc_restrict topology __hwloc_attribute_unused, hwloc_obj_type_t type __hwloc_attribute_unused,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs __hwloc_attribute_unused, float *distances __hwloc_attribute_unused)
{
unsigned i,j;
/* make sure we don't have the same index twice */
@ -95,23 +132,8 @@ static int hwloc_topology__check_distance_matrix(hwloc_topology_t __hwloc_restri
return 0;
}
static hwloc_obj_t hwloc_find_obj_by_type_and_os_index(hwloc_obj_t root, hwloc_obj_type_t type, unsigned os_index)
{
hwloc_obj_t child;
if (root->type == type && root->os_index == os_index)
return root;
child = root->first_child;
while (child) {
hwloc_obj_t found = hwloc_find_obj_by_type_and_os_index(child, type, os_index);
if (found)
return found;
child = child->next_sibling;
}
return NULL;
}
static void hwloc_get_type_distances_from_string(struct hwloc_topology *topology,
hwloc_obj_type_t type, char *string)
static void hwloc_distances__set_from_string(struct hwloc_topology *topology,
hwloc_obj_type_t type, char *string)
{
/* the string format is: "index[0],...,index[N-1]:distance[0],...,distance[N*N-1]"
* or "index[0],...,index[N-1]:X*Y" or "index[0],...,index[N-1]:X*Y*Z"
@ -122,39 +144,57 @@ static void hwloc_get_type_distances_from_string(struct hwloc_topology *topology
unsigned nbobjs = 0, i, j, x, y, z;
if (!strcmp(string, "none")) {
hwloc_topology__set_distance_matrix(topology, type, 0, NULL, NULL, NULL, 1 /* force */);
hwloc_distances_set(topology, type, 0, NULL, NULL, NULL, 1 /* force */);
return;
}
/* count indexes */
while (1) {
size_t size = strspn(tmp, "0123456789");
if (tmp[size] != ',') {
/* last element */
tmp += size;
nbobjs++;
break;
if (sscanf(string, "%u-%u:", &i, &j) == 2) {
/* range i-j */
nbobjs = j-i+1;
indexes = calloc(nbobjs, sizeof(unsigned));
distances = calloc(nbobjs*nbobjs, sizeof(float));
/* make sure the user didn't give a veeeeery large range */
if (!indexes || !distances) {
free(indexes);
free(distances);
return;
}
for(j=0; j<nbobjs; j++)
indexes[j] = j+i;
tmp = strchr(string, ':') + 1;
} else {
/* explicit list of indexes, count them */
while (1) {
size_t size = strspn(tmp, "0123456789");
if (tmp[size] != ',') {
/* last element */
tmp += size;
nbobjs++;
break;
}
/* another index */
tmp += size+1;
nbobjs++;
}
if (*tmp != ':') {
fprintf(stderr, "Ignoring %s distances from environment variable, missing colon\n",
hwloc_obj_type_string(type));
return;
}
indexes = calloc(nbobjs, sizeof(unsigned));
distances = calloc(nbobjs*nbobjs, sizeof(float));
tmp = string;
/* parse indexes */
for(i=0; i<nbobjs; i++) {
indexes[i] = strtoul(tmp, &next, 0);
tmp = next+1;
}
/* another index */
tmp += size+1;
nbobjs++;
}
if (*tmp != ':') {
fprintf(stderr, "Ignoring %s distances from environment variable, missing colon\n",
hwloc_obj_type_string(type));
return;
}
indexes = calloc(nbobjs, sizeof(unsigned));
distances = calloc(nbobjs*nbobjs, sizeof(float));
tmp = string;
/* parse indexes */
for(i=0; i<nbobjs; i++) {
indexes[i] = strtoul(tmp, &next, 0);
tmp = next+1;
}
/* parse distances */
z=1; /* default if sscanf finds only 2 values below */
@ -195,20 +235,20 @@ static void hwloc_get_type_distances_from_string(struct hwloc_topology *topology
}
}
if (hwloc_topology__check_distance_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0) {
if (hwloc_distances__check_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0) {
fprintf(stderr, "Ignoring invalid %s distances from environment variable\n", hwloc_obj_type_string(type));
free(indexes);
free(distances);
return;
}
hwloc_topology__set_distance_matrix(topology, type, nbobjs, indexes, NULL, distances, 1 /* force */);
hwloc_distances_set(topology, type, nbobjs, indexes, NULL, distances, 1 /* force */);
}
/* take distances in the environment, store them as is in the topology.
* we'll convert them into object later once the tree is filled
*/
void hwloc_store_distances_from_env(struct hwloc_topology *topology)
void hwloc_distances_set_from_env(struct hwloc_topology *topology)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
@ -216,11 +256,13 @@ void hwloc_store_distances_from_env(struct hwloc_topology *topology)
snprintf(envname, sizeof(envname), "HWLOC_%s_DISTANCES", hwloc_obj_type_string(type));
env = getenv(envname);
if (env)
hwloc_get_type_distances_from_string(topology, type, env);
hwloc_distances__set_from_string(topology, type, env);
}
}
/* take the given distance, store them as is in the topology.
/* The actual set() function exported to the user
*
* take the given distance, store them as is in the topology.
* we'll convert them into object later once the tree is filled.
*/
int hwloc_topology_set_distance_matrix(hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type,
@ -230,14 +272,14 @@ int hwloc_topology_set_distance_matrix(hwloc_topology_t __hwloc_restrict topolog
float *_distances;
if (!nbobjs && !indexes && !distances) {
hwloc_topology__set_distance_matrix(topology, type, 0, NULL, NULL, NULL, 1 /* force */);
hwloc_distances_set(topology, type, 0, NULL, NULL, NULL, 1 /* force */);
return 0;
}
if (!nbobjs || !indexes || !distances)
return -1;
if (hwloc_topology__check_distance_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0)
if (hwloc_distances__check_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0)
return -1;
/* copy the input arrays and give them to the topology */
@ -245,131 +287,258 @@ int hwloc_topology_set_distance_matrix(hwloc_topology_t __hwloc_restrict topolog
memcpy(_indexes, indexes, nbobjs*sizeof(unsigned));
_distances = malloc(nbobjs*nbobjs*sizeof(float));
memcpy(_distances, distances, nbobjs*nbobjs*sizeof(float));
hwloc_topology__set_distance_matrix(topology, type, nbobjs, _indexes, NULL, _distances, 1 /* force */);
hwloc_distances_set(topology, type, nbobjs, _indexes, NULL, _distances, 1 /* force */);
return 0;
}
/************************
* Restricting distances
*/
/* called when some objects have been removed because empty/ignored/cgroup/restrict,
* we must rebuild the list of objects from indexes (in hwloc_distances_finalize_os())
*/
void hwloc_distances_restrict_os(struct hwloc_topology *topology)
{
struct hwloc_os_distances_s * osdist;
for(osdist = topology->first_osdist; osdist; osdist = osdist->next) {
/* remove the objs array, we'll rebuild it from the indexes
* depending on remaining objects */
free(osdist->objs);
osdist->objs = NULL;
}
}
/* cleanup everything we created from distances so that we may rebuild them
* at the end of restrict()
*/
void hwloc_restrict_distances(struct hwloc_topology *topology, unsigned long flags)
void hwloc_distances_restrict(struct hwloc_topology *topology, unsigned long flags)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
/* remove the objs array, we'll rebuild it from the indexes
* depending on remaining objects */
free(topology->os_distances[type].objs);
topology->os_distances[type].objs = NULL;
if (flags & HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES) {
/* some objects may have been removed, clear objects arrays so that finalize_os rebuilds them properly */
hwloc_distances_restrict_os(topology);
} else {
/* if not adapting distances, drop everything */
if (!(flags & HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES)) {
free(topology->os_distances[type].indexes);
topology->os_distances[type].indexes = NULL;
free(topology->os_distances[type].distances);
topology->os_distances[type].distances = NULL;
topology->os_distances[type].nbobjs = 0;
}
hwloc_distances_destroy(topology);
}
}
/**************************************************************
* Convert user/env given array of indexes into actual objects
*/
static hwloc_obj_t hwloc_find_obj_by_type_and_os_index(hwloc_obj_t root, hwloc_obj_type_t type, unsigned os_index)
{
hwloc_obj_t child;
if (root->type == type && root->os_index == os_index)
return root;
child = root->first_child;
while (child) {
hwloc_obj_t found = hwloc_find_obj_by_type_and_os_index(child, type, os_index);
if (found)
return found;
child = child->next_sibling;
}
return NULL;
}
/* convert distance indexes that were previously stored in the topology
* into actual objects if not done already.
* it's already done when distances come from backends.
* it's already done when distances come from backends (this function should not be called then).
* it's not done when distances come from the user.
*
* returns -1 if the matrix was invalid
*/
void hwloc_convert_distances_indexes_into_objects(struct hwloc_topology *topology)
static int
hwloc_distances__finalize_os(struct hwloc_topology *topology, struct hwloc_os_distances_s *osdist)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
unsigned nbobjs = topology->os_distances[type].nbobjs;
unsigned *indexes = topology->os_distances[type].indexes;
float *distances = topology->os_distances[type].distances;
unsigned i, j;
if (!topology->os_distances[type].objs) {
hwloc_obj_t *objs = calloc(nbobjs, sizeof(hwloc_obj_t));
/* traverse the topology and look for the relevant objects */
for(i=0; i<nbobjs; i++) {
hwloc_obj_t obj = hwloc_find_obj_by_type_and_os_index(topology->levels[0][0], type, indexes[i]);
if (!obj) {
unsigned nbobjs = osdist->nbobjs;
unsigned *indexes = osdist->indexes;
float *distances = osdist->distances;
unsigned i, j;
hwloc_obj_type_t type = osdist->type;
hwloc_obj_t *objs = calloc(nbobjs, sizeof(hwloc_obj_t));
/* shift the matrix */
assert(!osdist->objs);
/* traverse the topology and look for the relevant objects */
for(i=0; i<nbobjs; i++) {
hwloc_obj_t obj = hwloc_find_obj_by_type_and_os_index(topology->levels[0][0], type, indexes[i]);
if (!obj) {
/* shift the matrix */
#define OLDPOS(i,j) (distances+(i)*nbobjs+(j))
#define NEWPOS(i,j) (distances+(i)*(nbobjs-1)+(j))
if (i>0) {
/** no need to move beginning of 0th line */
for(j=0; j<i-1; j++)
/** move end of jth line + beginning of (j+1)th line */
memmove(NEWPOS(j,i), OLDPOS(j,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (i-1)th line */
memmove(NEWPOS(i-1,i), OLDPOS(i-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
if (i<nbobjs-1) {
/** move beginning of (i+1)th line */
memmove(NEWPOS(i,0), OLDPOS(i+1,0), i*sizeof(*distances));
/** move end of jth line + beginning of (j+1)th line */
for(j=i; j<nbobjs-2; j++)
memmove(NEWPOS(j,i), OLDPOS(j+1,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (nbobjs-2)th line */
memmove(NEWPOS(nbobjs-2,i), OLDPOS(nbobjs-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
/* shift the indexes array */
memmove(indexes+i, indexes+i+1, (nbobjs-i-1)*sizeof(*indexes));
/* update counters */
nbobjs--;
i--;
continue;
}
objs[i] = obj;
if (i>0) {
/** no need to move beginning of 0th line */
for(j=0; j<i-1; j++)
/** move end of jth line + beginning of (j+1)th line */
memmove(NEWPOS(j,i), OLDPOS(j,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (i-1)th line */
memmove(NEWPOS(i-1,i), OLDPOS(i-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
if (i<nbobjs-1) {
/** move beginning of (i+1)th line */
memmove(NEWPOS(i,0), OLDPOS(i+1,0), i*sizeof(*distances));
/** move end of jth line + beginning of (j+1)th line */
for(j=i; j<nbobjs-2; j++)
memmove(NEWPOS(j,i), OLDPOS(j+1,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (nbobjs-2)th line */
memmove(NEWPOS(nbobjs-2,i), OLDPOS(nbobjs-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
topology->os_distances[type].nbobjs = nbobjs;
if (!nbobjs) {
/* the whole matrix was invalid */
free(objs);
free(topology->os_distances[type].indexes);
topology->os_distances[type].indexes = NULL;
free(topology->os_distances[type].distances);
topology->os_distances[type].distances = NULL;
} else {
/* setup the objs array */
topology->os_distances[type].objs = objs;
}
/* shift the indexes array */
memmove(indexes+i, indexes+i+1, (nbobjs-i-1)*sizeof(*indexes));
/* update counters */
nbobjs--;
i--;
continue;
}
objs[i] = obj;
}
osdist->nbobjs = nbobjs;
if (!nbobjs) {
/* the whole matrix was invalid, let the caller remove this distances */
free(objs);
return -1;
}
/* setup the objs array */
osdist->objs = objs;
return 0;
}
void hwloc_distances_finalize_os(struct hwloc_topology *topology)
{
int dropall = !topology->levels[0][0]->cpuset; /* we don't support distances on multinode systems */
struct hwloc_os_distances_s *osdist, *next = topology->first_osdist;
while ((osdist = next) != NULL) {
int err;
next = osdist->next;
if (dropall)
goto drop;
/* remove final distance matrics AND physically-ordered ones */
if (osdist->objs)
/* nothing to do, switch to the next element */
continue;
err = hwloc_distances__finalize_os(topology, osdist);
if (!err)
/* convert ok, switch to the next element */
continue;
drop:
/* remove this element */
free(osdist->indexes);
free(osdist->distances);
/* remove current object */
if (osdist->prev)
osdist->prev->next = next;
else
topology->first_osdist = next;
if (next)
next->prev = osdist->prev;
else
topology->last_osdist = osdist->prev;
/* free current object */
free(osdist);
}
}
/***********************************************************
* Convert internal distances given by the backend/env/user
* into exported logical distances attached to objects
*/
static hwloc_obj_t
hwloc_get_obj_covering_cpuset_nodeset(struct hwloc_topology *topology,
hwloc_const_cpuset_t cpuset,
hwloc_const_nodeset_t nodeset)
{
hwloc_obj_t parent = hwloc_get_root_obj(topology), child;
assert(cpuset);
assert(nodeset);
assert(hwloc_bitmap_isincluded(cpuset, parent->cpuset));
assert(!nodeset || hwloc_bitmap_isincluded(nodeset, parent->nodeset));
trychildren:
child = parent->first_child;
while (child) {
/* look for a child with a cpuset containing ours.
* if it has a nodeset, it must also contain ours.
*/
if (child->cpuset && hwloc_bitmap_isincluded(cpuset, child->cpuset)
&& (!child->nodeset || hwloc_bitmap_isincluded(nodeset, child->nodeset))) {
parent = child;
goto trychildren;
}
child = child->next_sibling;
}
return parent;
}
static void
hwloc_setup_distances_from_os_matrix(struct hwloc_topology *topology,
unsigned nbobjs,
hwloc_obj_t *objs, float *osmatrix)
hwloc_distances__finalize_logical(struct hwloc_topology *topology,
unsigned nbobjs,
hwloc_obj_t *objs, float *osmatrix)
{
unsigned i, j, li, lj, minl;
float min = FLT_MAX, max = FLT_MIN;
hwloc_obj_t root;
float *matrix;
hwloc_cpuset_t set;
hwloc_cpuset_t cpuset;
hwloc_nodeset_t nodeset;
unsigned relative_depth;
int idx;
/* find the root */
set = hwloc_bitmap_alloc();
for(i=0; i<nbobjs; i++)
hwloc_bitmap_or(set, set, objs[i]->cpuset);
root = hwloc_get_obj_covering_cpuset(topology, set);
if (!root || !hwloc_bitmap_isequal(set, root->cpuset)) {
/* When cgroups are involved, some objects may disappear.
* ignore_keep_structure can also remove some objects with non-empty cpusets.
* "set" can get smaller than expected, and the distance matrix
* would not include all children of root.
* If "set" is empty, root is NULL.
* Ignore the distance matrix in both cases, we can't insert it properly.
*/
hwloc_bitmap_free(set);
cpuset = hwloc_bitmap_alloc();
nodeset = hwloc_bitmap_alloc();
for(i=0; i<nbobjs; i++) {
hwloc_bitmap_or(cpuset, cpuset, objs[i]->cpuset);
if (objs[i]->nodeset)
hwloc_bitmap_or(nodeset, nodeset, objs[i]->nodeset);
}
/* find the object covering cpuset AND nodeset (can't use hwloc_get_obj_covering_cpuset()) */
root = hwloc_get_obj_covering_cpuset_nodeset(topology, cpuset, nodeset);
if (!root) {
/* should not happen, ignore the distance matrix and report an error. */
if (!hwloc_hide_errors()) {
char *a, *b;
hwloc_bitmap_asprintf(&a, cpuset);
hwloc_bitmap_asprintf(&b, nodeset);
fprintf(stderr, "****************************************************************************\n");
fprintf(stderr, "* Hwloc has encountered an error when adding a distance matrix to the topology.\n");
fprintf(stderr, "*\n");
fprintf(stderr, "* hwloc_distances__finalize_logical() could not find any object covering\n");
fprintf(stderr, "* cpuset %s and nodeset %s\n", a, b);
fprintf(stderr, "*\n");
fprintf(stderr, "* Please report this error message to the hwloc user's mailing list,\n");
fprintf(stderr, "* along with the output from the hwloc-gather-topology.sh script.\n");
fprintf(stderr, "****************************************************************************\n");
free(a);
free(b);
}
hwloc_bitmap_free(cpuset);
hwloc_bitmap_free(nodeset);
return;
}
hwloc_bitmap_free(set);
/* ideally, root has the exact cpuset and nodeset.
* but ignoring or other things that remove objects may cause the object array to reduce */
assert(hwloc_bitmap_isincluded(cpuset, root->cpuset));
assert(hwloc_bitmap_isincluded(nodeset, root->nodeset));
hwloc_bitmap_free(cpuset);
hwloc_bitmap_free(nodeset);
if (root->depth >= objs[0]->depth) {
/* strange topology led us to find invalid relative depth, ignore */
return;
@ -425,39 +594,58 @@ hwloc_setup_distances_from_os_matrix(struct hwloc_topology *topology,
* that can be exposed in the API
*/
void
hwloc_finalize_logical_distances(struct hwloc_topology *topology)
hwloc_distances_finalize_logical(struct hwloc_topology *topology)
{
unsigned nbobjs;
hwloc_obj_type_t type;
int depth;
struct hwloc_os_distances_s * osdist;
for(osdist = topology->first_osdist; osdist; osdist = osdist->next) {
for (type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
nbobjs = topology->os_distances[type].nbobjs;
nbobjs = osdist->nbobjs;
if (!nbobjs)
continue;
depth = hwloc_get_type_depth(topology, type);
depth = hwloc_get_type_depth(topology, osdist->type);
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
continue;
if (topology->os_distances[type].objs) {
assert(topology->os_distances[type].distances);
hwloc_setup_distances_from_os_matrix(topology, nbobjs,
topology->os_distances[type].objs,
topology->os_distances[type].distances);
if (osdist->objs) {
assert(osdist->distances);
hwloc_distances__finalize_logical(topology, nbobjs,
osdist->objs,
osdist->distances);
}
}
}
/* destroy a object distances structure */
/***************************************************
* Destroying logical distances attached to objects
*/
/* destroy an object distances structure */
void
hwloc_free_logical_distances(struct hwloc_distances_s * dist)
hwloc_clear_object_distances_one(struct hwloc_distances_s * distances)
{
free(dist->latency);
free(dist);
free(distances->latency);
free(distances);
}
void
hwloc_clear_object_distances(hwloc_obj_t obj)
{
unsigned i;
for (i=0; i<obj->distances_count; i++)
hwloc_clear_object_distances_one(obj->distances[i]);
free(obj->distances);
obj->distances = NULL;
obj->distances_count = 0;
}
/******************************************
* Grouping objects according to distances
*/
static void hwloc_report_user_distance_error(const char *msg, int line)
{
static int reported = 0;
@ -488,11 +676,11 @@ static int hwloc_compare_distances(float a, float b, float accuracy)
* Return how many groups were created, or 0 if some incomplete distance graphs were found.
*/
static unsigned
hwloc_setup_group_from_min_distance(unsigned nbobjs,
float *_distances,
float accuracy,
unsigned *groupids,
int verbose)
hwloc__find_groups_by_min_distance(unsigned nbobjs,
float *_distances,
float accuracy,
unsigned *groupids,
int verbose)
{
float min_distance = FLT_MAX;
unsigned groupid = 1;
@ -601,14 +789,14 @@ hwloc__check_grouping_matrix(unsigned nbobjs, float *_distances, float accuracy,
* Look at object physical distances to group them.
*/
static void
hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
unsigned nbobjs,
struct hwloc_obj **objs,
float *_distances,
unsigned nbaccuracies, float *accuracies,
int fromuser,
int needcheck,
int verbose)
hwloc__groups_by_distances(struct hwloc_topology *topology,
unsigned nbobjs,
struct hwloc_obj **objs,
float *_distances,
unsigned nbaccuracies, float *accuracies,
int fromuser,
int needcheck,
int verbose)
{
unsigned *groupids = NULL;
unsigned nbgroups = 0;
@ -629,7 +817,7 @@ hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
nbobjs, hwloc_obj_type_string(objs[0]->type), accuracies[i]);
if (needcheck && hwloc__check_grouping_matrix(nbobjs, _distances, accuracies[i], verbose) < 0)
continue;
nbgroups = hwloc_setup_group_from_min_distance(nbobjs, _distances, accuracies[i], groupids, verbose);
nbgroups = hwloc__find_groups_by_min_distance(nbobjs, _distances, accuracies[i], groupids, verbose);
if (nbgroups)
break;
}
@ -659,10 +847,17 @@ hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
group_obj->cpuset = hwloc_bitmap_alloc();
group_obj->attr->group.depth = topology->next_group_depth;
for (j=0; j<nbobjs; j++)
if (groupids[j] == i+1) {
hwloc_bitmap_or(group_obj->cpuset, group_obj->cpuset, objs[j]->cpuset);
groupsizes[i]++;
}
if (groupids[j] == i+1) {
/* assemble the group cpuset */
hwloc_bitmap_or(group_obj->cpuset, group_obj->cpuset, objs[j]->cpuset);
/* if one obj has a nodeset, assemble a group nodeset */
if (objs[j]->nodeset) {
if (!group_obj->nodeset)
group_obj->nodeset = hwloc_bitmap_alloc();
hwloc_bitmap_or(group_obj->nodeset, group_obj->nodeset, objs[j]->nodeset);
}
groupsizes[i]++;
}
hwloc_debug_1arg_bitmap("adding Group object with %u objects and cpuset %s\n",
groupsizes[i], group_obj->cpuset);
hwloc__insert_object_by_cpuset(topology, group_obj,
@ -701,7 +896,7 @@ hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
#endif
topology->next_group_depth++;
hwloc_setup_groups_from_distances(topology, nbgroups, groupobjs, (float*) groupdistances, nbaccuracies, accuracies, fromuser, 0 /* no need to check generated matrix */, verbose);
hwloc__groups_by_distances(topology, nbgroups, groupobjs, (float*) groupdistances, nbaccuracies, accuracies, fromuser, 0 /* no need to check generated matrix */, verbose);
inner_free:
/* Safely free everything */
@ -726,13 +921,15 @@ void
hwloc_group_by_distances(struct hwloc_topology *topology)
{
unsigned nbobjs;
hwloc_obj_type_t type;
struct hwloc_os_distances_s * osdist;
char *env;
float accuracies[5] = { 0.0, 0.01, 0.02, 0.05, 0.1 };
unsigned nbaccuracies = 5;
hwloc_obj_t group_obj;
int verbose = 0;
unsigned i;
#ifdef HWLOC_DEBUG
unsigned i,j;
unsigned j;
#endif
env = getenv("HWLOC_GROUPING");
@ -760,38 +957,60 @@ hwloc_group_by_distances(struct hwloc_topology *topology)
verbose = atoi(env);
#endif
for (type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
nbobjs = topology->os_distances[type].nbobjs;
for(osdist = topology->first_osdist; osdist; osdist = osdist->next) {
nbobjs = osdist->nbobjs;
if (!nbobjs)
continue;
if (topology->os_distances[type].objs) {
if (osdist->objs) {
/* if we have objs, we must have distances as well,
* thanks to hwloc_convert_distances_indexes_into_objects()
*/
assert(topology->os_distances[type].distances);
assert(osdist->distances);
#ifdef HWLOC_DEBUG
hwloc_debug("%s", "trying to group objects using distance matrix:\n");
hwloc_debug("%s", " index");
for(j=0; j<nbobjs; j++)
hwloc_debug(" % 5d", (int) topology->os_distances[type].objs[j]->os_index);
hwloc_debug(" % 5d", (int) osdist->objs[j]->os_index);
hwloc_debug("%s", "\n");
for(i=0; i<nbobjs; i++) {
hwloc_debug(" % 5d", (int) topology->os_distances[type].objs[i]->os_index);
hwloc_debug(" % 5d", (int) osdist->objs[i]->os_index);
for(j=0; j<nbobjs; j++)
hwloc_debug(" %2.3f", topology->os_distances[type].distances[i*nbobjs + j]);
hwloc_debug(" %2.3f", osdist->distances[i*nbobjs + j]);
hwloc_debug("%s", "\n");
}
#endif
hwloc_setup_groups_from_distances(topology, nbobjs,
topology->os_distances[type].objs,
topology->os_distances[type].distances,
nbaccuracies, accuracies,
topology->os_distances[type].indexes != NULL,
1 /* check the first matrice */,
verbose);
hwloc__groups_by_distances(topology, nbobjs,
osdist->objs,
osdist->distances,
nbaccuracies, accuracies,
osdist->indexes != NULL,
1 /* check the first matrice */,
verbose);
/* add a final group object covering everybody so that the distance matrix can be stored somewhere.
* this group will be merged into a regular object if the matrix isn't strangely incomplete
*/
group_obj = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, -1);
group_obj->attr->group.depth = topology->next_group_depth++;
group_obj->cpuset = hwloc_bitmap_alloc();
for(i=0; i<nbobjs; i++) {
/* assemble the group cpuset */
hwloc_bitmap_or(group_obj->cpuset, group_obj->cpuset, osdist->objs[i]->cpuset);
/* if one obj has a nodeset, assemble a group nodeset */
if (osdist->objs[i]->nodeset) {
if (!group_obj->nodeset)
group_obj->nodeset = hwloc_bitmap_alloc();
hwloc_bitmap_or(group_obj->nodeset, group_obj->nodeset, osdist->objs[i]->nodeset);
}
}
hwloc_debug_1arg_bitmap("adding Group object (as root of distance matrix with %u objects) with cpuset %s\n",
nbobjs, group_obj->cpuset);
hwloc__insert_object_by_cpuset(topology, group_obj,
osdist->indexes != NULL ? hwloc_report_user_distance_error : hwloc_report_os_error);
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009 inria. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009, 2012 Université Bordeaux 1
* See COPYING in top-level directory.
*/
@ -12,8 +12,10 @@
#include <stdlib.h>
int main(int argc, char *argv[]) {
char *prog, *arch, *def, *name, *lib;
char *prog, *arch, *def, *version, *lib;
char s[1024];
char name[16];
int current, age, revision;
if (argc != 6) {
fprintf(stderr,"bad number of arguments");
@ -23,9 +25,15 @@ int main(int argc, char *argv[]) {
prog = argv[1];
arch = argv[2];
def = argv[3];
name = argv[4];
version = argv[4];
lib = argv[5];
if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
exit(EXIT_FAILURE);
snprintf(name, sizeof(name), "libhwloc-%d", current - age);
printf("using soname %s\n", name);
snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib);
if (system(s)) {

Просмотреть файл

@ -25,6 +25,7 @@
#include <hwloc/linux.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
#define CONFIG_SPACE_CACHESIZE 256
@ -123,6 +124,7 @@ static void
hwloc_linux_net_class_fillinfos(struct hwloc_topology *topology __hwloc_attribute_unused, struct hwloc_obj *obj, const char *osdevpath)
{
FILE *fd;
struct stat st;
char path[256];
snprintf(path, sizeof(path), "%s/address", osdevpath);
fd = fopen(path, "r");
@ -136,6 +138,25 @@ hwloc_linux_net_class_fillinfos(struct hwloc_topology *topology __hwloc_attribut
}
fclose(fd);
}
snprintf(path, sizeof(path), "%s/device/infiniband", osdevpath);
if (!stat(path, &st)) {
snprintf(path, sizeof(path), "%s/dev_id", osdevpath);
fd = fopen(path, "r");
if (fd) {
char hexid[16];
if (fgets(hexid, sizeof(hexid), fd)) {
char *eoid;
unsigned long port;
port = strtoul(hexid, &eoid, 0);
if (eoid != hexid) {
char portstr[16];
snprintf(portstr, sizeof(portstr), "%ld", port+1);
hwloc_obj_add_info(obj, "Port", portstr);
}
}
fclose(fd);
}
}
}
static void
hwloc_linux_lookup_net_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -313,7 +313,7 @@ hwloc_look_osf(struct hwloc_topology *topology)
}
}
hwloc_topology__set_distance_matrix(topology, HWLOC_OBJ_NODE, nbnodes, indexes, nodes, distances, 0 /* OS cannot force */);
hwloc_distances_set(topology, HWLOC_OBJ_NODE, nbnodes, indexes, nodes, distances, 0 /* OS cannot force */);
}
radsetdestroy(&radset2);
radsetdestroy(&radset);

Просмотреть файл

@ -0,0 +1,331 @@
/*
* Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <private/autogen/config.h>
#include <private/solaris-chiptype.h>
#include <stdlib.h>
#include <strings.h>
#ifdef HAVE_PICL_H
#include <sys/systeminfo.h>
#include <picl.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",
"ProcessorType",
"vendor-id",
"brand-string"
};
#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"
};
/*****************************************************************************
Default values are for Unknown so we can build up from there.
*****************************************************************************/
static long dss_chip_mode = MODE_UNKNOWN;
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 char dss_chip_type[PICL_PROPNAMELEN_MAX];
static char dss_chip_model[PICL_PROPNAMELEN_MAX];
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;
}
} else if (index == 8) { /* ProcessorType */
strncpy(&dss_chip_type[0], string_val, PICL_PROPNAMELEN_MAX);
} else if (index == 10) { /* brand-string */
strncpy(&dss_chip_model[0], string_val, PICL_PROPNAMELEN_MAX);
}
}
/*****************************************************************************
Gets called by probe_cpu. Cycles through the table values until we find
what we are looking for.
*****************************************************************************/
static void 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;
} else if (index == NUM_ITEMS-1) {
if (p_info.type == PICL_PTYPE_CHARSTRING) {
val = picl_get_propval(p_hdl, &string_val, sizeof(string_val));
if (val == PICL_SUCCESS) {
}
}
}
}
}
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* hwloc_solaris_get_chip_type(void) {
picl_nodehdl_t root;
int val;
static char chip_type[PICL_PROPNAMELEN_MAX];
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) {
strncpy(chip_type, dss_chip_type, PICL_PROPNAMELEN_MAX);
} else {
/* no picl information on machine available */
sysinfo(SI_HW_PROVIDER, chip_type, PICL_PROPNAMELEN_MAX);
}
return(chip_type);
}
/*****************************************************************************
Initializes, gets the root, then walks the picl tree looking for information
Currently, the "core" class is only needed for OPL systems
*****************************************************************************/
char *hwloc_solaris_get_chip_model(void) {
if (called_cpu_probe) {
if (dss_chip_mode != MODE_UNKNOWN) { /* SPARC chip */
strncpy(dss_chip_model, sparc_modes[dss_chip_mode],
PICL_PROPNAMELEN_MAX);
}
} else {
/* no picl information on machine available */
sysinfo(SI_PLATFORM, dss_chip_model, PICL_PROPNAMELEN_MAX);
}
return(dss_chip_model);
}
#else
char* hwloc_solaris_get_chip_type(void) {
return NULL;
}
char *hwloc_solaris_get_chip_model(void) {
return NULL;
}
#endif

Просмотреть файл

@ -3,6 +3,7 @@
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2011 Oracle and/or its affiliates. All rights reserved.
* See COPYING in top-level directory.
*/
@ -10,6 +11,7 @@
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#include <private/solaris-chiptype.h>
#include <stdio.h>
#include <errno.h>
@ -426,7 +428,7 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
for (j = 0; j < curlgrp; j++)
distances[i*curlgrp+j] = (float) lgrp_latency_cookie(cookie, glob_lgrps[i]->os_index, glob_lgrps[j]->os_index, LGRP_LAT_CPU_TO_MEM);
}
hwloc_topology__set_distance_matrix(topology, HWLOC_OBJ_NODE, curlgrp, indexes, glob_lgrps, distances, 0 /* OS cannot force */);
hwloc_distances_set(topology, HWLOC_OBJ_NODE, curlgrp, indexes, glob_lgrps, distances, 0 /* OS cannot force */);
}
#endif /* HAVE_LGRP_LATENCY_COOKIE */
}
@ -440,6 +442,10 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
static int
hwloc_look_kstat(struct hwloc_topology *topology)
{
/* FIXME this assumes that all sockets are identical */
char *CPUType = hwloc_solaris_get_chip_type();
char *CPUModel = hwloc_solaris_get_chip_model();
kstat_ctl_t *kc = kstat_open();
kstat_t *ksp;
kstat_named_t *stat;
@ -608,8 +614,22 @@ hwloc_look_kstat(struct hwloc_topology *topology)
* however. */
}
if (look_chips)
hwloc_setup_level(procid_max, numsockets, osphysids, proc_physids, topology, HWLOC_OBJ_SOCKET);
if (look_chips) {
struct hwloc_obj *obj;
unsigned j;
hwloc_debug("%d Sockets\n", numsockets);
for (j = 0; j < numsockets; j++) {
obj = hwloc_alloc_setup_object(HWLOC_OBJ_SOCKET, osphysids[j]);
if (CPUType)
hwloc_obj_add_info(obj, "CPUType", CPUType);
if (CPUModel)
hwloc_obj_add_info(obj, "CPUModel", CPUModel);
hwloc_object_cpuset_from_array(obj, j, proc_physids, procid_max);
hwloc_debug_1arg_bitmap("Socket %d has cpuset %s\n", j, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
hwloc_debug("%s", "\n");
}
if (look_cores)
hwloc_setup_level(procid_max, numcores, oscoreids, proc_coreids, topology, HWLOC_OBJ_CORE);

Просмотреть файл

@ -28,6 +28,11 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
int cache_depth = 0, group_depth = 0;
int nb_machine_levels = 0, nb_node_levels = 0;
int nb_pu_levels = 0;
int verbose = 0;
char *env = getenv("HWLOC_SYNTHETIC_VERBOSE");
if (env)
verbose = atoi(env);
assert(topology->backend_type == HWLOC_BACKEND_NONE);
@ -58,12 +63,13 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
type = HWLOC_OBJ_MISC;
else if (!hwloc_namecoloncmp(pos, "group", 2))
type = HWLOC_OBJ_GROUP;
else
fprintf(stderr, "Unknown object type `%s'\n", pos);
else if (verbose)
fprintf(stderr, "Synthetic string with unknown object type `%s'\n", pos);
next_pos = strchr(pos, ':');
if (!next_pos) {
fprintf(stderr,"synthetic string doesn't have a `:' after object type at '%s'\n", pos);
if (verbose)
fprintf(stderr,"Synthetic string doesn't have a `:' after object type at '%s'\n", pos);
errno = EINVAL;
return -1;
}
@ -71,18 +77,21 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
}
item = strtoul(pos, (char **)&next_pos, 0);
if (next_pos == pos) {
fprintf(stderr,"synthetic string doesn't have a number of objects at '%s'\n", pos);
if (verbose)
fprintf(stderr,"Synthetic string doesn't have a number of objects at '%s'\n", pos);
errno = EINVAL;
return -1;
}
if (count + 1 >= HWLOC_SYNTHETIC_MAX_DEPTH) {
fprintf(stderr,"Too many synthetic levels, max %d\n", HWLOC_SYNTHETIC_MAX_DEPTH);
if (verbose)
fprintf(stderr,"Too many synthetic levels, max %d\n", HWLOC_SYNTHETIC_MAX_DEPTH);
errno = EINVAL;
return -1;
}
if (item > UINT_MAX) {
fprintf(stderr,"Too big arity, max %u\n", UINT_MAX);
if (verbose)
fprintf(stderr,"Too big arity, max %u\n", UINT_MAX);
errno = EINVAL;
return -1;
}
@ -93,7 +102,8 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
}
if (count <= 0) {
fprintf(stderr,"synthetic string doesn't contain any object\n");
if (verbose)
fprintf(stderr, "Synthetic string doesn't contain any object\n");
errno = EINVAL;
return -1;
}
@ -125,9 +135,10 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
switch (type) {
case HWLOC_OBJ_PU:
if (nb_pu_levels) {
fprintf(stderr,"synthetic string can not have several PU levels\n");
errno = EINVAL;
return -1;
if (verbose)
fprintf(stderr, "Synthetic string can not have several PU levels\n");
errno = EINVAL;
return -1;
}
nb_pu_levels++;
break;
@ -149,23 +160,27 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
}
if (!nb_pu_levels) {
fprintf(stderr,"synthetic string missing ending number of PUs\n");
if (verbose)
fprintf(stderr, "Synthetic string missing ending number of PUs\n");
errno = EINVAL;
return -1;
}
if (nb_pu_levels > 1) {
fprintf(stderr,"synthetic string can not have several PU levels\n");
if (verbose)
fprintf(stderr, "Synthetic string can not have several PU levels\n");
errno = EINVAL;
return -1;
}
if (nb_node_levels > 1) {
fprintf(stderr,"synthetic string can not have several NUMA node levels\n");
if (verbose)
fprintf(stderr, "Synthetic string can not have several NUMA node levels\n");
errno = EINVAL;
return -1;
}
if (nb_machine_levels > 1) {
fprintf(stderr,"synthetic string can not have several machine levels\n");
if (verbose)
fprintf(stderr, "Synthetic string can not have several machine levels\n");
errno = EINVAL;
return -1;
}
@ -191,6 +206,7 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
}
topology->backend_type = HWLOC_BACKEND_SYNTHETIC;
topology->backend_params.synthetic.string = strdup(description);
topology->backend_params.synthetic.arity[count-1] = 0;
topology->is_thissystem = 0;
@ -201,6 +217,7 @@ void
hwloc_backend_synthetic_exit(struct hwloc_topology *topology)
{
assert(topology->backend_type == HWLOC_BACKEND_SYNTHETIC);
free(topology->backend_params.synthetic.string);
topology->backend_type = HWLOC_BACKEND_NONE;
}
@ -343,5 +360,6 @@ hwloc_look_synthetic(struct hwloc_topology *topology)
hwloc_bitmap_free(cpuset);
hwloc_obj_add_info(topology->levels[0][0], "Backend", "Synthetic");
hwloc_obj_add_info(topology->levels[0][0], "SyntheticDescription", topology->backend_params.synthetic.string);
}

Просмотреть файл

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -177,13 +177,15 @@ typedef struct _PSAPI_WORKING_SET_EX_INFORMATION {
static int
hwloc_win_set_thread_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_thread_t thread, hwloc_const_bitmap_t hwloc_set, int flags)
{
DWORD mask;
if (flags & HWLOC_CPUBIND_NOMEMBIND) {
errno = ENOSYS;
return -1;
}
/* TODO: groups SetThreadGroupAffinity */
/* The resulting binding is always strict */
DWORD mask = hwloc_bitmap_to_ulong(hwloc_set);
mask = hwloc_bitmap_to_ulong(hwloc_set);
if (!SetThreadAffinityMask(thread, mask))
return -1;
return 0;
@ -219,6 +221,7 @@ hwloc_win_set_thisthread_membind(hwloc_topology_t topology, hwloc_const_nodeset_
static int
hwloc_win_set_proc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_pid_t proc, hwloc_const_bitmap_t hwloc_set, int flags)
{
DWORD mask;
if (flags & HWLOC_CPUBIND_NOMEMBIND) {
errno = ENOSYS;
return -1;
@ -226,7 +229,7 @@ hwloc_win_set_proc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, h
/* TODO: groups, hard: has to manually bind all threads into the other group,
* and the bind the process inside the group */
/* The resulting binding is always strict */
DWORD mask = hwloc_bitmap_to_ulong(hwloc_set);
mask = hwloc_bitmap_to_ulong(hwloc_set);
if (!SetProcessAffinityMask(proc, mask))
return -1;
return 0;
@ -411,39 +414,48 @@ hwloc_win_get_area_membind(hwloc_topology_t topology __hwloc_attribute_unused, c
{
SYSTEM_INFO SystemInfo;
DWORD page_size;
uintptr_t start;
unsigned nb;
GetSystemInfo(&SystemInfo);
page_size = SystemInfo.dwPageSize;
uintptr_t start = (((uintptr_t) addr) / page_size) * page_size;
unsigned nb = (((uintptr_t) addr + len - start) + page_size - 1) / page_size;
start = (((uintptr_t) addr) / page_size) * page_size;
nb = (((uintptr_t) addr + len - start) + page_size - 1) / page_size;
if (!nb)
nb = 1;
{
PSAPI_WORKING_SET_EX_INFORMATION pv[nb];
PSAPI_WORKING_SET_EX_INFORMATION *pv;
unsigned i;
pv = calloc(nb, sizeof(*pv));
for (i = 0; i < nb; i++)
pv[i].VirtualAddress = (void*) (start + i * page_size);
if (!QueryWorkingSetExProc(GetCurrentProcess(), &pv, sizeof(pv)))
if (!QueryWorkingSetExProc(GetCurrentProcess(), pv, nb * sizeof(*pv))) {
free(pv);
return -1;
}
*policy = HWLOC_MEMBIND_BIND;
if (flags & HWLOC_MEMBIND_STRICT) {
unsigned node = pv[0].VirtualAttributes.Node;
for (i = 1; i < nb; i++) {
if (pv[i].VirtualAttributes.Node != node) {
errno = EXDEV;
free(pv);
return -1;
}
}
hwloc_bitmap_only(nodeset, node);
free(pv);
return 0;
}
hwloc_bitmap_zero(nodeset);
for (i = 0; i < nb; i++)
hwloc_bitmap_set(nodeset, pv[i].VirtualAttributes.Node);
free(pv);
return 0;
}
}
@ -520,7 +532,15 @@ hwloc_look_windows(struct hwloc_topology *topology)
obj = hwloc_alloc_setup_object(type, id);
obj->cpuset = hwloc_bitmap_alloc();
hwloc_debug("%s#%u mask %lx\n", hwloc_obj_type_string(type), id, procInfo[i].ProcessorMask);
hwloc_bitmap_from_ulong(obj->cpuset, procInfo[i].ProcessorMask);
/* ProcessorMask is a ULONG_PTR (64/32bits depending on the arch)
* while unsigned long is always 32bits */
#if SIZEOF_VOID_P == 8
hwloc_bitmap_set_ith_ulong(obj->cpuset, 0, procInfo[i].ProcessorMask & 0xffffffff);
hwloc_bitmap_set_ith_ulong(obj->cpuset, 1, procInfo[i].ProcessorMask >> 32);
#else
hwloc_bitmap_set_ith_ulong(obj->cpuset, 0, procInfo[i].ProcessorMask);
#endif
hwloc_debug_2args_bitmap("%s#%u bitmap %s\n", hwloc_obj_type_string(type), id, obj->cpuset);
switch (type) {
case HWLOC_OBJ_NODE:
@ -622,7 +642,15 @@ hwloc_look_windows(struct hwloc_topology *topology)
mask = procInfo->Group.GroupInfo[id].ActiveProcessorMask;
hwloc_debug("group %u %d cpus mask %lx\n", id,
procInfo->Group.GroupInfo[id].ActiveProcessorCount, mask);
hwloc_bitmap_from_ith_ulong(obj->cpuset, id, mask);
/* KAFFINITY is ULONG_PTR (64/32bits depending on the arch)
* while unsigned long is always 32bits */
#if SIZEOF_VOID_P == 8
hwloc_bitmap_set_ith_ulong(obj->cpuset, 2*id, mask & 0xffffffff);
hwloc_bitmap_set_ith_ulong(obj->cpuset, 2*id+1, mask >> 32);
#else
hwloc_bitmap_set_ith_ulong(obj->cpuset, id, mask);
#endif
hwloc_debug_2args_bitmap("group %u %d bitmap %s\n", id, procInfo->Group.GroupInfo[id].ActiveProcessorCount, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
continue;
@ -636,8 +664,16 @@ hwloc_look_windows(struct hwloc_topology *topology)
obj->cpuset = hwloc_bitmap_alloc();
for (i = 0; i < num; i++) {
hwloc_debug("%s#%u %d: mask %d:%lx\n", hwloc_obj_type_string(type), id, i, GroupMask[i].Group, GroupMask[i].Mask);
hwloc_bitmap_from_ith_ulong(obj->cpuset, GroupMask[i].Group, GroupMask[i].Mask);
/* GROUP_AFFINITY.Mask is KAFFINITY, which is ULONG_PTR (64/32bits depending on the arch)
* while unsigned long is always 32bits */
#if SIZEOF_VOID_P == 8
hwloc_bitmap_set_ith_ulong(obj->cpuset, 2*GroupMask[i].Group, GroupMask[i].Mask & 0xffffffff);
hwloc_bitmap_set_ith_ulong(obj->cpuset, 2*GroupMask[i].Group+1, GroupMask[i].Mask >> 32);
#else
hwloc_bitmap_set_ith_ulong(obj->cpuset, GroupMask[i].Group, GroupMask[i].Mask);
#endif
}
hwloc_debug("%s#%u bitmap %s\n", hwloc_obj_type_string(type), id, obj->cpuset);
switch (type) {
case HWLOC_OBJ_NODE:

Просмотреть файл

@ -164,7 +164,6 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
/* AMD doesn't actually provide 0x04 information */
if (cpuid_type != amd && highest_cpuid >= 0x04) {
cachenum = 0;
for (cachenum = 0; ; cachenum++) {
unsigned type;
eax = 0x04;
@ -323,7 +322,7 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
if (infos[one].otherids[level] != UINT_MAX) {
hwloc_bitmap_t unknowns_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t unknown_cpuset;
hwloc_obj_t unknown;
hwloc_obj_t unknown_obj;
while ((i = hwloc_bitmap_first(unknowns_cpuset)) != (unsigned) -1) {
unsigned unknownid = infos[i].otherids[level];
@ -335,12 +334,12 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
hwloc_bitmap_clr(unknowns_cpuset, j);
}
}
unknown = hwloc_alloc_setup_object(HWLOC_OBJ_MISC, unknownid);
unknown->cpuset = unknown_cpuset;
unknown->os_level = level;
unknown_obj = hwloc_alloc_setup_object(HWLOC_OBJ_MISC, unknownid);
unknown_obj->cpuset = unknown_cpuset;
unknown_obj->os_level = level;
hwloc_debug_2args_bitmap("os unknown%d %u has cpuset %s\n",
level, unknownid, unknown_cpuset);
hwloc_insert_object_by_cpuset(topology, unknown);
hwloc_insert_object_by_cpuset(topology, unknown_obj);
}
hwloc_bitmap_free(unknowns_cpuset);
}

Просмотреть файл

@ -116,7 +116,7 @@ hwloc_backend_xml_init(struct hwloc_topology *topology, const char *xmlpath, con
fclose(file);
topology->backend_params.xml.buffer = buffer;
buflen = offset+1;
/* buflen = offset+1; */
}
topology->is_thissystem = 0;
@ -577,7 +577,7 @@ hwloc__xml_import_find_child(hwloc__xml_import_state_t state,
if (child->content && child->content[0] != '\0' && child->content[0] != '\n')
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring object text content %s\n", (const char*) child->content);
} else {
} else if (child->type != XML_COMMENT_NODE) {
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring unexpected xml node type %u\n", child->type);
}
@ -768,17 +768,16 @@ hwloc__xml_import_distances(hwloc_topology_t topology __hwloc_attribute_unused,
}
if (nbobjs && reldepth && latbase) {
int idx = obj->distances_count;
unsigned i;
float *matrix, latmax = 0;
struct hwloc_xml_imported_distances_s *distances;
obj->distances = realloc(obj->distances, (idx+1)*sizeof(*obj->distances));
obj->distances_count = idx+1;
obj->distances[idx] = malloc(sizeof(**obj->distances));
obj->distances[idx]->relative_depth = reldepth;
obj->distances[idx]->nbobjs = nbobjs;
obj->distances[idx]->latency = matrix = malloc(nbobjs*nbobjs*sizeof(float));
obj->distances[idx]->latency_base = latbase;
distances = malloc(sizeof(*distances));
distances->root = obj;
distances->distances.relative_depth = reldepth;
distances->distances.nbobjs = nbobjs;
distances->distances.latency = matrix = malloc(nbobjs*nbobjs*sizeof(float));
distances->distances.latency_base = latbase;
for(i=0; i<nbobjs*nbobjs; i++) {
struct hwloc__xml_import_state_s childstate;
@ -788,17 +787,15 @@ hwloc__xml_import_distances(hwloc_topology_t topology __hwloc_attribute_unused,
ret = hwloc__xml_import_find_child(state, &childstate, &tag);
if (ret <= 0 || strcmp(tag, "latency")) {
/* a latency child is needed */
free(obj->distances[idx]->latency);
free(obj->distances[idx]);
obj->distances_count--;
free(distances->distances.latency);
free(distances);
return -1;
}
ret = hwloc__xml_import_next_attr(&childstate, &attrname, &attrvalue);
if (ret < 0 || strcmp(attrname, "value")) {
free(obj->distances[idx]->latency);
free(obj->distances[idx]);
obj->distances_count--;
free(distances->distances.latency);
free(distances);
return -1;
}
@ -814,7 +811,14 @@ hwloc__xml_import_distances(hwloc_topology_t topology __hwloc_attribute_unused,
hwloc__xml_import_close_child(&childstate);
}
obj->distances[idx]->latency_max = latmax;
distances->distances.latency_max = latmax;
if (topology->backend_params.xml.last_distances)
topology->backend_params.xml.last_distances->next = distances;
else
topology->backend_params.xml.first_distances = distances;
distances->prev = topology->backend_params.xml.last_distances;
distances->next = NULL;
}
return hwloc__xml_import_close_tag(state);
@ -879,6 +883,49 @@ hwloc__xml_import_object(hwloc_topology_t topology, hwloc_obj_t obj,
********* main XML import *********
***********************************/
static void
hwloc_xml__handle_distances(struct hwloc_topology *topology)
{
struct hwloc_xml_imported_distances_s *xmldist, *next = topology->backend_params.xml.first_distances;
if (!next)
return;
/* connect things now because we need levels to check/build, they'll be reconnected properly later anyway */
hwloc_connect_children(topology->levels[0][0]);
hwloc_connect_levels(topology);
while ((xmldist = next) != NULL) {
hwloc_obj_t root = xmldist->root;
unsigned depth = root->depth + xmldist->distances.relative_depth;
unsigned nbobjs = hwloc_get_nbobjs_inside_cpuset_by_depth(topology, root->cpuset, depth);
if (nbobjs != xmldist->distances.nbobjs) {
/* distances invalid, drop */
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring invalid distance matrix with %u objs instead of %u\n",
xmldist->distances.nbobjs, nbobjs);
free(xmldist->distances.latency);
} else {
/* distances valid, add it to the internal OS distances list for grouping */
unsigned *indexes = malloc(nbobjs * sizeof(unsigned));
hwloc_obj_t child, *objs = malloc(nbobjs * sizeof(hwloc_obj_t));
unsigned j;
for(j=0, child = hwloc_get_next_obj_inside_cpuset_by_depth(topology, root->cpuset, depth, NULL);
j<nbobjs;
j++, child = hwloc_get_next_obj_inside_cpuset_by_depth(topology, root->cpuset, depth, child)) {
indexes[j] = child->os_index;
objs[j] = child;
}
for(j=0; j<nbobjs*nbobjs; j++)
xmldist->distances.latency[j] *= xmldist->distances.latency_base;
hwloc_distances_set(topology, objs[0]->type, nbobjs, indexes, objs, xmldist->distances.latency, 0 /* XML cannot force */);
}
next = xmldist->next;
free(xmldist);
}
}
/* this canNOT be the first XML call */
int
hwloc_look_xml(struct hwloc_topology *topology)
@ -893,6 +940,8 @@ hwloc_look_xml(struct hwloc_topology *topology)
state.use_libxml = 0;
state.parent = NULL;
topology->backend_params.xml.first_distances = topology->backend_params.xml.last_distances = NULL;
#ifdef HWLOC_HAVE_LIBXML2
env = getenv("HWLOC_NO_LIBXML_IMPORT");
if (!env || !atoi(env)) {
@ -942,7 +991,7 @@ hwloc_look_xml(struct hwloc_topology *topology)
/* prepare parsing state */
state.tagbuffer = buffer+10;
state.tagname = "topology";
state.tagname = (char *) "topology";
state.attrbuffer = NULL;
}
@ -963,6 +1012,9 @@ hwloc_look_xml(struct hwloc_topology *topology)
/* keep the "Backend" information intact */
/* we could add "BackendSource=XML" to notify that XML was used between the actual backend and here */
/* if we added some distances, we must check them, and make them groupable */
hwloc_xml__handle_distances(topology);
topology->backend_params.xml.first_distances = topology->backend_params.xml.last_distances = NULL;
topology->support.discovery->pu = 1;
return 0;
@ -975,41 +1027,6 @@ hwloc_look_xml(struct hwloc_topology *topology)
return -1;
}
static void
hwloc_xml__check_distances(struct hwloc_topology *topology, hwloc_obj_t obj)
{
hwloc_obj_t child;
unsigned i=0;
while (i<obj->distances_count) {
unsigned depth = obj->depth + obj->distances[i]->relative_depth;
unsigned nbobjs = hwloc_get_nbobjs_inside_cpuset_by_depth(topology, obj->cpuset, depth);
if (nbobjs != obj->distances[i]->nbobjs) {
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring invalid distance matrix with %u objs instead of %u\n",
obj->distances[i]->nbobjs, nbobjs);
hwloc_free_logical_distances(obj->distances[i]);
memmove(&obj->distances[i], &obj->distances[i+1], (obj->distances_count-i-1)*sizeof(*obj->distances));
obj->distances_count--;
} else
i++;
}
child = obj->first_child;
while (child != NULL) {
hwloc_xml__check_distances(topology, child);
child = child->next_sibling;
}
}
/* this canNOT be the first XML call */
void
hwloc_xml_check_distances(struct hwloc_topology *topology)
{
/* now that the topology tree has been properly setup,
* check that our distance matrice sizes make sense */
hwloc_xml__check_distances(topology, topology->levels[0][0]);
}
/************************************************
********* XML export (common routines) *********
************************************************/
@ -1163,8 +1180,10 @@ hwloc__xml_export_object (hwloc__xml_export_output_t output, hwloc_topology_t to
hwloc__xml_export_new_child(output, "object");
hwloc__xml_export_new_prop(output, "type", hwloc_obj_type_string(obj->type));
sprintf(tmp, "%d", obj->os_level);
hwloc__xml_export_new_prop(output, "os_level", tmp);
if (obj->os_level != -1) {
sprintf(tmp, "%d", obj->os_level);
hwloc__xml_export_new_prop(output, "os_level", tmp);
}
if (obj->os_index != (unsigned) -1) {
sprintf(tmp, "%u", obj->os_index);
hwloc__xml_export_new_prop(output, "os_index", tmp);
@ -1329,7 +1348,6 @@ hwloc__libxml2_prepare_export(hwloc_topology_t topology)
struct hwloc__xml_export_output_s output;
xmlDocPtr doc = NULL; /* document pointer */
xmlNodePtr root_node = NULL; /* root pointer */
xmlDtdPtr dtd = NULL; /* DTD pointer */
LIBXML_TEST_VERSION;
hwloc_libxml2_disable_stderrwarnings();
@ -1340,7 +1358,7 @@ hwloc__libxml2_prepare_export(hwloc_topology_t topology)
xmlDocSetRootElement(doc, root_node);
/* Creates a DTD declaration. Isn't mandatory. */
dtd = xmlCreateIntSubset(doc, BAD_CAST "topology", NULL, BAD_CAST "hwloc.dtd");
(void) xmlCreateIntSubset(doc, BAD_CAST "topology", NULL, BAD_CAST "hwloc.dtd");
output.use_libxml = 1;
output.current_node = root_node;

Просмотреть файл

@ -82,6 +82,9 @@ void hwloc_report_os_error(const char *msg, int line)
static void
hwloc_topology_clear (struct hwloc_topology *topology);
static void
hwloc_topology_setup_defaults(struct hwloc_topology *topology);
#if defined(HAVE_SYSCTLBYNAME)
int hwloc_get_sysctlbyname(const char *name, int64_t *ret)
@ -200,6 +203,8 @@ print_object(struct hwloc_topology *topology, int indent __hwloc_attribute_unuse
hwloc_debug("%*s", 2*indent, "");
hwloc_obj_snprintf(line, sizeof(line), topology, obj, "#", 1);
hwloc_debug("%s", line);
if (obj->name)
hwloc_debug(" name %s", obj->name);
if (obj->cpuset) {
hwloc_bitmap_asprintf(&cpuset, obj->cpuset);
hwloc_debug(" cpuset %s", cpuset);
@ -263,17 +268,6 @@ void hwloc_obj_add_info(hwloc_obj_t obj, const char *name, const char *value)
obj->infos_count++;
}
static void
hwloc_clear_object_distances(hwloc_obj_t obj)
{
unsigned i;
for (i=0; i<obj->distances_count; i++)
hwloc_free_logical_distances(obj->distances[i]);
free(obj->distances);
obj->distances = NULL;
obj->distances_count = 0;
}
/* Free an object and all its content. */
void
hwloc_free_unlinked_object(hwloc_obj_t obj)
@ -303,6 +297,57 @@ hwloc_free_unlinked_object(hwloc_obj_t obj)
free(obj);
}
static void
hwloc__duplicate_objects(struct hwloc_topology *newtopology,
struct hwloc_obj *newparent,
struct hwloc_obj *src)
{
hwloc_obj_t newobj;
hwloc_obj_t child;
size_t len;
unsigned i;
newobj = hwloc_alloc_setup_object(src->type, src->os_index);
if (src->name)
newobj->name = strdup(src->name);
newobj->userdata = src->userdata;
memcpy(&newobj->memory, &src->memory, sizeof(struct hwloc_obj_memory_s));
if (src->memory.page_types_len) {
len = src->memory.page_types_len * sizeof(struct hwloc_obj_memory_page_type_s);
newobj->memory.page_types = malloc(len);
memcpy(newobj->memory.page_types, src->memory.page_types, len);
}
memcpy(newobj->attr, src->attr, sizeof(*newobj->attr));
newobj->cpuset = hwloc_bitmap_dup(src->cpuset);
newobj->nodeset = hwloc_bitmap_dup(src->nodeset);
if (src->distances_count) {
newobj->distances_count = src->distances_count;
newobj->distances = malloc(src->distances_count * sizeof(struct hwloc_distances_s *));
for(i=0; i<src->distances_count; i++) {
newobj->distances[i] = malloc(sizeof(struct hwloc_distances_s));
/* ugly copy first */
memcpy(newobj->distances[i], src->distances[i], sizeof(struct hwloc_distances_s));
/* now duplicate matrices for real */
len = src->distances[i]->nbobjs * src->distances[i]->nbobjs * sizeof(float);
newobj->distances[i]->latency = malloc(len);
memcpy(newobj->distances[i]->latency, src->distances[i]->latency, len);
}
}
for(i=0; i<src->infos_count; i++)
hwloc_obj_add_info(newobj, src->infos[i].name, src->infos[i].value);
child = NULL;
while ((child = hwloc_get_next_child(newtopology, src, child)) != NULL)
hwloc__duplicate_objects(newtopology, newobj, child);
hwloc_insert_object_by_parent(newtopology, newparent, newobj);
}
/*
* How to compare objects based on types.
*
@ -381,19 +426,22 @@ static hwloc_obj_type_t hwloc_get_order_type(int order)
}
#endif
static int hwloc_obj_type_is_io (hwloc_obj_type_t type)
{
return type == HWLOC_OBJ_BRIDGE || type == HWLOC_OBJ_PCI_DEVICE || type == HWLOC_OBJ_OS_DEVICE;
}
int hwloc_compare_types (hwloc_obj_type_t type1, hwloc_obj_type_t type2)
{
unsigned order1 = hwloc_get_type_order(type1);
unsigned order2 = hwloc_get_type_order(type2);
/* bridge and devices are only comparable with each others and with machine and system */
if ((type1 == HWLOC_OBJ_BRIDGE || type1 == HWLOC_OBJ_PCI_DEVICE || type1 == HWLOC_OBJ_OS_DEVICE)
&& type2 != HWLOC_OBJ_BRIDGE && type2 != HWLOC_OBJ_PCI_DEVICE && type2 != HWLOC_OBJ_OS_DEVICE
&& type2 != HWLOC_OBJ_SYSTEM && type2 != HWLOC_OBJ_MACHINE)
if (hwloc_obj_type_is_io(type1)
&& !hwloc_obj_type_is_io(type2) && type2 != HWLOC_OBJ_SYSTEM && type2 != HWLOC_OBJ_MACHINE)
return HWLOC_TYPE_UNORDERED;
if ((type2 == HWLOC_OBJ_BRIDGE || type2 == HWLOC_OBJ_PCI_DEVICE || type2 == HWLOC_OBJ_OS_DEVICE)
&& type1 != HWLOC_OBJ_BRIDGE && type1 != HWLOC_OBJ_PCI_DEVICE && type1 != HWLOC_OBJ_OS_DEVICE
&& type1 != HWLOC_OBJ_SYSTEM && type1 != HWLOC_OBJ_MACHINE)
if (hwloc_obj_type_is_io(type2)
&& !hwloc_obj_type_is_io(type1) && type1 != HWLOC_OBJ_SYSTEM && type1 != HWLOC_OBJ_MACHINE)
return HWLOC_TYPE_UNORDERED;
return order1 - order2;
@ -449,13 +497,24 @@ enum hwloc_obj_cmp_e {
static int
hwloc_obj_cmp(hwloc_obj_t obj1, hwloc_obj_t obj2)
{
if (!obj1->cpuset || hwloc_bitmap_iszero(obj1->cpuset)
|| !obj2->cpuset || hwloc_bitmap_iszero(obj2->cpuset))
hwloc_bitmap_t set1, set2;
/* compare cpusets if possible, or fallback to nodeset, or return */
if (obj1->cpuset && !hwloc_bitmap_iszero(obj1->cpuset)
&& obj2->cpuset && !hwloc_bitmap_iszero(obj2->cpuset)) {
set1 = obj1->cpuset;
set2 = obj2->cpuset;
} else if (obj1->nodeset && !hwloc_bitmap_iszero(obj1->nodeset)
&& obj2->nodeset && !hwloc_bitmap_iszero(obj2->nodeset)) {
set1 = obj1->nodeset;
set2 = obj2->nodeset;
} else {
return HWLOC_OBJ_DIFFERENT;
}
if (hwloc_bitmap_isequal(obj1->cpuset, obj2->cpuset)) {
if (hwloc_bitmap_isequal(set1, set2)) {
/* Same cpuset, subsort by type to have a consistent ordering. */
/* Same sets, subsort by type to have a consistent ordering. */
switch (hwloc_type_cmp(obj1, obj2)) {
case HWLOC_TYPE_DEEPER:
@ -475,7 +534,7 @@ hwloc_obj_cmp(hwloc_obj_t obj1, hwloc_obj_t obj2)
return HWLOC_OBJ_EQUAL;
}
/* Same level cpuset and type! Let's hope it's coherent. */
/* Same sets and types! Let's hope it's coherent. */
return HWLOC_OBJ_EQUAL;
}
@ -484,15 +543,15 @@ hwloc_obj_cmp(hwloc_obj_t obj1, hwloc_obj_t obj2)
} else {
/* Different cpusets, sort by inclusion. */
/* Different sets, sort by inclusion. */
if (hwloc_bitmap_isincluded(obj1->cpuset, obj2->cpuset))
if (hwloc_bitmap_isincluded(set1, set2))
return HWLOC_OBJ_INCLUDED;
if (hwloc_bitmap_isincluded(obj2->cpuset, obj1->cpuset))
if (hwloc_bitmap_isincluded(set2, set1))
return HWLOC_OBJ_CONTAINS;
if (hwloc_bitmap_intersects(obj1->cpuset, obj2->cpuset))
if (hwloc_bitmap_intersects(set1, set2))
return HWLOC_OBJ_INTERSECTS;
return HWLOC_OBJ_DIFFERENT;
@ -550,6 +609,37 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
fprintf(stderr, "Different OS indexes\n");
return -1;
}
if (obj->distances_count) {
if (child->distances_count) {
child->distances_count += obj->distances_count;
child->distances = realloc(child->distances, child->distances_count * sizeof(*child->distances));
memcpy(child->distances + obj->distances_count, obj->distances, obj->distances_count * sizeof(*child->distances));
} else {
child->distances_count = obj->distances_count;
child->distances = obj->distances;
}
obj->distances_count = 0;
obj->distances = NULL;
}
if (obj->infos_count) {
if (child->infos_count) {
child->infos_count += obj->infos_count;
child->infos = realloc(child->infos, child->infos_count * sizeof(*child->infos));
memcpy(child->infos + obj->infos_count, obj->infos, obj->infos_count * sizeof(*child->infos));
} else {
child->infos_count = obj->infos_count;
child->infos = obj->infos;
}
obj->infos_count = 0;
obj->infos = NULL;
}
if (obj->name) {
if (child->name)
free(child->name);
child->name = obj->name;
obj->name = NULL;
}
assert(!obj->userdata); /* user could not set userdata here (we're before load() */
switch(obj->type) {
case HWLOC_OBJ_NODE:
/* Do not check these, it may change between calls */
@ -632,7 +722,7 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
case HWLOC_OBJ_DIFFERENT:
/* Leave CHILD in CUR. */
if (!put && hwloc_bitmap_compare_first(obj->cpuset, child->cpuset) < 0) {
if (!put && (!child->cpuset || hwloc_bitmap_compare_first(obj->cpuset, child->cpuset) < 0)) {
/* Sort children by cpuset: put OBJ before CHILD in CUR's children. */
*cur_children = obj;
cur_children = &obj->next_sibling;
@ -719,8 +809,6 @@ hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t paren
}
}
static void
hwloc_connect_children(hwloc_obj_t parent);
/* Adds a misc object _after_ detection, and thus has to reconnect all the pointers */
hwloc_obj_t
hwloc_topology_insert_misc_object_by_cpuset(struct hwloc_topology *topology, hwloc_const_bitmap_t cpuset, const char *name)
@ -728,6 +816,11 @@ hwloc_topology_insert_misc_object_by_cpuset(struct hwloc_topology *topology, hwl
hwloc_obj_t obj, child;
int err;
if (!topology->is_loaded) {
errno = EINVAL;
return NULL;
}
if (hwloc_bitmap_iszero(cpuset))
return NULL;
if (!hwloc_bitmap_isincluded(cpuset, hwloc_topology_get_complete_cpuset(topology)))
@ -737,6 +830,9 @@ hwloc_topology_insert_misc_object_by_cpuset(struct hwloc_topology *topology, hwl
if (name)
obj->name = strdup(name);
/* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */
obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
obj->cpuset = hwloc_bitmap_dup(cpuset);
/* initialize default cpusets, we'll adjust them later */
obj->complete_cpuset = hwloc_bitmap_dup(cpuset);
@ -786,6 +882,15 @@ hwloc_topology_insert_misc_object_by_parent(struct hwloc_topology *topology, hwl
if (name)
obj->name = strdup(name);
if (!topology->is_loaded) {
hwloc_free_unlinked_object(obj);
errno = EINVAL;
return NULL;
}
/* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */
obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
hwloc_insert_object_by_parent(topology, parent, obj);
hwloc_connect_children(topology->levels[0][0]);
@ -794,6 +899,22 @@ hwloc_topology_insert_misc_object_by_parent(struct hwloc_topology *topology, hwl
return obj;
}
hwloc_obj_t
hwloc_custom_insert_group_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t parent, int groupdepth)
{
hwloc_obj_t obj = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, -1);
obj->attr->group.depth = groupdepth;
if (topology->backend_type != HWLOC_BACKEND_CUSTOM || topology->is_loaded) {
errno = EINVAL;
return NULL;
}
hwloc_insert_object_by_parent(topology, parent, obj);
return obj;
}
/* Traverse children of a parent in a safe way: reread the next pointer as
* appropriate to prevent crash on child deletion: */
#define for_each_child_safe(child, parent, pchild) \
@ -997,9 +1118,7 @@ add_default_object_sets(hwloc_obj_t obj, int parent_has_sets)
hwloc_obj_t child, *temp;
/* I/O devices (and their children) have no sets */
if (obj->type == HWLOC_OBJ_BRIDGE
|| obj->type == HWLOC_OBJ_PCI_DEVICE
|| obj->type == HWLOC_OBJ_OS_DEVICE)
if (hwloc_obj_type_is_io(obj->type))
return;
if (parent_has_sets || obj->cpuset) {
@ -1056,9 +1175,7 @@ propagate_nodeset(hwloc_obj_t obj, hwloc_obj_t sys)
for_each_child_safe(child, obj, temp) {
/* don't propagate nodesets in I/O objects, keep them NULL */
if (child->type == HWLOC_OBJ_BRIDGE
|| child->type == HWLOC_OBJ_PCI_DEVICE
|| child->type == HWLOC_OBJ_OS_DEVICE)
if (hwloc_obj_type_is_io(child->type))
return;
/* Propagate singleton nodesets down */
@ -1090,9 +1207,7 @@ propagate_nodesets(hwloc_obj_t obj)
for_each_child_safe(child, obj, temp) {
/* don't propagate nodesets in I/O objects, keep them NULL */
if (child->type == HWLOC_OBJ_BRIDGE
|| child->type == HWLOC_OBJ_PCI_DEVICE
|| child->type == HWLOC_OBJ_OS_DEVICE)
if (hwloc_obj_type_is_io(child->type))
continue;
if (obj->nodeset) {
@ -1246,9 +1361,8 @@ remove_empty(hwloc_topology_t topology, hwloc_obj_t *pobj)
if (obj->type != HWLOC_OBJ_NODE
&& !obj->first_child /* only remove if all children were removed above, so that we don't remove parents of NUMAnode */
&& obj->type != HWLOC_OBJ_BRIDGE
&& obj->type != HWLOC_OBJ_PCI_DEVICE
&& obj->type != HWLOC_OBJ_OS_DEVICE
&& !hwloc_obj_type_is_io(obj->type)
&& obj->cpuset /* don't remove if no cpuset at all, there's likely a good reason why it's different from having an empty cpuset */
&& hwloc_bitmap_iszero(obj->cpuset)) {
/* Remove empty children */
hwloc_debug("%s", "\nRemoving empty object ");
@ -1281,7 +1395,7 @@ restrict_object(hwloc_topology_t topology, unsigned long flags, hwloc_obj_t *pob
if (obj->type == HWLOC_OBJ_MISC) {
dropping = droppingparent && !(flags & HWLOC_RESTRICT_FLAG_ADAPT_MISC);
} else if (obj->type == HWLOC_OBJ_BRIDGE || obj->type == HWLOC_OBJ_PCI_DEVICE || obj->type == HWLOC_OBJ_OS_DEVICE) {
} else if (hwloc_obj_type_is_io(obj->type)) {
dropping = droppingparent && !(flags & HWLOC_RESTRICT_FLAG_ADAPT_IO);
} else {
dropping = droppingparent || (obj->cpuset && hwloc_bitmap_iszero(obj->cpuset));
@ -1357,7 +1471,9 @@ merge_useless_child(hwloc_topology_t topology, hwloc_obj_t *pparent)
}
}
/* If WHOLE_IO is not set, we drop non-interesting devices,
/*
* If IO_DEVICES and WHOLE_IO are not set, we drop everything.
* If WHOLE_IO is not set, we drop non-interesting devices,
* and bridges that have no children.
* If IO_BRIDGES is also not set, we also drop all bridges
* except the hostbridges.
@ -1367,6 +1483,14 @@ hwloc_drop_useless_io(hwloc_topology_t topology, hwloc_obj_t root)
{
hwloc_obj_t child, *pchild;
if (!(topology->flags & (HWLOC_TOPOLOGY_FLAG_IO_DEVICES|HWLOC_TOPOLOGY_FLAG_WHOLE_IO))) {
/* drop all I/O children */
for_each_child_safe(child, root, pchild)
if (hwloc_obj_type_is_io(child->type))
unlink_and_free_object_and_children(pchild);
return;
}
if (!(topology->flags & HWLOC_TOPOLOGY_FLAG_WHOLE_IO)) {
/* drop non-interesting devices */
for_each_child_safe(child, root, pchild) {
@ -1376,6 +1500,7 @@ hwloc_drop_useless_io(hwloc_topology_t topology, hwloc_obj_t root)
if (baseclass != 0x03 /* PCI_BASE_CLASS_DISPLAY */
&& baseclass != 0x02 /* PCI_BASE_CLASS_NETWORK */
&& baseclass != 0x01 /* PCI_BASE_CLASS_STORAGE */
&& baseclass != 0x0b /* PCI_BASE_CLASS_PROCESSOR */
&& classid != 0x0c06 /* PCI_CLASS_SERIAL_INFINIBAND */)
unlink_and_free_object_and_children(pchild);
}
@ -1423,6 +1548,55 @@ hwloc_propagate_bridge_depth(hwloc_topology_t topology, hwloc_obj_t root, unsign
}
}
static void
hwloc_propagate_symmetric_subtree(hwloc_topology_t topology, hwloc_obj_t root)
{
hwloc_obj_t child, *array;
/* assume we're not symmetric by default */
root->symmetric_subtree = 0;
/* if no child, we are symmetric */
if (!root->arity) {
root->symmetric_subtree = 1;
return;
}
/* look at children, and return if they are not symmetric */
child = NULL;
while ((child = hwloc_get_next_child(topology, root, child)) != NULL)
hwloc_propagate_symmetric_subtree(topology, child);
while ((child = hwloc_get_next_child(topology, root, child)) != NULL)
if (!child->symmetric_subtree)
return;
/* now check that children subtrees are identical.
* just walk down the first child in each tree and compare their depth and arities
*/
array = malloc(root->arity * sizeof(*array));
memcpy(array, root->children, root->arity * sizeof(*array));
while (1) {
unsigned i;
/* check current level arities and depth */
for(i=1; i<root->arity; i++)
if (array[i]->depth != array[0]->depth
|| array[i]->arity != array[0]->arity) {
free(array);
return;
}
if (!array[0]->arity)
/* no more children level, we're ok */
break;
/* look at first child of each element now */
for(i=0; i<root->arity; i++)
array[i] = array[i]->first_child;
}
free(array);
/* everything went fine, we're symmetric */
root->symmetric_subtree = 1;
}
/*
* Initialize handy pointers in the whole topology.
* The topology only had first_child and next_sibling pointers.
@ -1430,7 +1604,7 @@ hwloc_propagate_bridge_depth(hwloc_topology_t topology, hwloc_obj_t root, unsign
* The remaining fields (levels, cousins, logical_index, depth, ...) will
* be setup later in hwloc_connect_levels().
*/
static void
void
hwloc_connect_children(hwloc_obj_t parent)
{
unsigned n;
@ -1521,9 +1695,7 @@ hwloc_level_filter_object(hwloc_topology_t topology,
hwloc_obj_t *new_obj, hwloc_obj_t old)
{
unsigned i, total;
if (old->type == HWLOC_OBJ_BRIDGE
|| old->type == HWLOC_OBJ_PCI_DEVICE
|| old->type == HWLOC_OBJ_OS_DEVICE) {
if (hwloc_obj_type_is_io(old->type)) {
if (new_obj)
append_iodevs(topology, old);
return 0;
@ -1535,8 +1707,11 @@ hwloc_level_filter_object(hwloc_topology_t topology,
}
for(i=0, total=0; i<old->arity; i++) {
int nb = hwloc_level_filter_object(topology, new_obj, old->children[i]);
if (new_obj)
if (new_obj) {
new_obj += nb;
/* misc objects go in no level (needed here because insert_misc() not always involved e.g. during XML import) */
old->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
}
total += nb;
}
return total;
@ -1556,9 +1731,7 @@ hwloc_level_filter_objects(hwloc_topology_t topology,
/* anything to filter? */
for(i=0; i<nold; i++)
if (old[i]->type == HWLOC_OBJ_BRIDGE
|| old[i]->type == HWLOC_OBJ_PCI_DEVICE
|| old[i]->type == HWLOC_OBJ_OS_DEVICE
if (hwloc_obj_type_is_io(old[i]->type)
|| old[i]->type == HWLOC_OBJ_MISC)
break;
if (i==nold)
@ -1616,7 +1789,7 @@ hwloc_build_level_from_list(struct hwloc_obj *first, struct hwloc_obj ***levelp)
/*
* Do the remaining work that hwloc_connect_children() did not do earlier.
*/
static int
int
hwloc_connect_levels(hwloc_topology_t topology)
{
unsigned l, i=0;
@ -1775,6 +1948,8 @@ hwloc_connect_levels(hwloc_topology_t topology)
topology->pcidev_nbobjects = hwloc_build_level_from_list(topology->first_pcidev, &topology->pcidev_level);
topology->osdev_nbobjects = hwloc_build_level_from_list(topology->first_osdev, &topology->osdev_level);
hwloc_propagate_symmetric_subtree(topology, topology->levels[0][0]);
return 0;
}
@ -1901,9 +2076,13 @@ static void hwloc_topology_setup_defaults(struct hwloc_topology *topology);
static int
hwloc_discover(struct hwloc_topology *topology)
{
int gotsomeio = 1;
if (topology->backend_type == HWLOC_BACKEND_SYNTHETIC) {
alloc_cpusets(topology->levels[0][0]);
hwloc_look_synthetic(topology);
} else if (topology->backend_type == HWLOC_BACKEND_CUSTOM) {
/* nothing to do, just connect levels below */
} else if (topology->backend_type == HWLOC_BACKEND_XML) {
if (hwloc_look_xml(topology) < 0) {
hwloc_topology_clear(topology);
@ -1961,7 +2140,7 @@ hwloc_discover(struct hwloc_topology *topology)
# ifdef HWLOC_LINUX_SYS
# define HAVE_OS_SUPPORT
hwloc_look_linux(topology);
hwloc_look_linuxfs(topology);
# endif /* HWLOC_LINUX_SYS */
# ifdef HWLOC_AIX_SYS
@ -2020,7 +2199,7 @@ hwloc_discover(struct hwloc_topology *topology)
/*
* Group levels by distances
*/
hwloc_convert_distances_indexes_into_objects(topology);
hwloc_distances_finalize_os(topology);
hwloc_group_by_distances(topology);
/* First tweak a bit to clean the topology. */
@ -2100,57 +2279,51 @@ hwloc_discover(struct hwloc_topology *topology)
* and there.
*/
/* PCI */
if (topology->flags & (HWLOC_TOPOLOGY_FLAG_IO_DEVICES|HWLOC_TOPOLOGY_FLAG_WHOLE_IO)) {
int gotsome = 0;
hwloc_debug("%s", "\nLooking for PCI devices\n");
/* I/O devices */
if (topology->backend_type == HWLOC_BACKEND_SYNTHETIC) {
/* TODO */
}
else if (topology->backend_type == HWLOC_BACKEND_XML) {
/* TODO */
}
#ifdef HWLOC_HAVE_LIBPCI
else if (topology->is_thissystem) {
hwloc_look_libpci(topology);
gotsome = 1;
}
/* see if the backend already imported some I/O devices */
if (topology->backend_type == HWLOC_BACKEND_XML
|| topology->backend_type == HWLOC_BACKEND_SYNTHETIC
|| topology->backend_type == HWLOC_BACKEND_CUSTOM)
gotsomeio = 1;
/* import from libpci if needed */
if (topology->flags & (HWLOC_TOPOLOGY_FLAG_IO_DEVICES|HWLOC_TOPOLOGY_FLAG_WHOLE_IO)
&& (topology->backend_type == HWLOC_BACKEND_NONE
#ifdef HWLOC_LINUX_SYS
|| topology->backend_type == HWLOC_BACKEND_LINUXFS
#endif
if (gotsome) {
)) {
hwloc_debug("%s", "\nLooking for PCI devices\n");
#ifdef HWLOC_HAVE_LIBPCI
if (topology->is_thissystem) {
hwloc_look_libpci(topology);
print_objects(topology, 0, topology->levels[0][0]);
hwloc_drop_useless_io(topology, topology->levels[0][0]);
hwloc_propagate_bridge_depth(topology, topology->levels[0][0], 0);
hwloc_debug("%s", "\nNow reconnecting\n");
hwloc_connect_children(topology->levels[0][0]);
hwloc_connect_levels(topology);
print_objects(topology, 0, topology->levels[0][0]);
} else {
gotsomeio = 1;
} else
#endif
{
hwloc_debug("%s", "\nno PCI detection\n");
}
}
/* if we got anything, filter interesting objects and update the tree */
if (gotsomeio) {
hwloc_drop_useless_io(topology, topology->levels[0][0]);
hwloc_debug("%s", "\nNow reconnecting\n");
hwloc_connect_children(topology->levels[0][0]);
hwloc_connect_levels(topology);
print_objects(topology, 0, topology->levels[0][0]);
hwloc_propagate_bridge_depth(topology, topology->levels[0][0], 0);
}
/*
* Now that objects are numbered, take distance matrices from backends and put them in the main topology.
*
* Some objects may have disappeared (in removed_empty or removed_ignored) since we setup os distances
* (hwloc_convert_distances_indexes_into_objects()) above. Reset them so as to not point to disappeared objects anymore.
* (hwloc_distances_finalize_os()) above. Reset them so as to not point to disappeared objects anymore.
*/
hwloc_restrict_distances(topology, HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES);
hwloc_convert_distances_indexes_into_objects(topology);
hwloc_finalize_logical_distances(topology);
# ifdef HWLOC_HAVE_XML
if (topology->backend_type == HWLOC_BACKEND_XML)
/* make sure the XML-imported distances are ok now that the tree is properly setup */
hwloc_xml_check_distances(topology);
# endif
hwloc_distances_restrict_os(topology);
hwloc_distances_finalize_os(topology);
hwloc_distances_finalize_logical(topology);
/*
* Now set binding hooks.
@ -2163,7 +2336,7 @@ hwloc_discover(struct hwloc_topology *topology)
if (topology->is_thissystem) {
# ifdef HWLOC_LINUX_SYS
hwloc_set_linux_hooks(topology);
hwloc_set_linuxfs_hooks(topology);
# endif /* HWLOC_LINUX_SYS */
# ifdef HWLOC_AIX_SYS
@ -2292,7 +2465,7 @@ hwloc_topology_setup_defaults(struct hwloc_topology *topology)
/* Only the System object on top by default */
topology->nb_levels = 1; /* there's at least SYSTEM */
topology->next_group_depth = 0;
topology->levels[0] = malloc (sizeof (struct hwloc_obj));
topology->levels[0] = malloc (sizeof (hwloc_obj_t));
topology->level_nbobjects[0] = 1;
/* NULLify other levels so that we can detect and free old ones in hwloc_connect_levels() if needed */
memset(topology->levels+1, 0, (HWLOC_DEPTH_MAX-1)*sizeof(*topology->levels));
@ -2340,7 +2513,7 @@ hwloc_topology_init (struct hwloc_topology **topologyp)
topology->ignored_types[i] = HWLOC_IGNORE_TYPE_NEVER;
topology->ignored_types[HWLOC_OBJ_GROUP] = HWLOC_IGNORE_TYPE_KEEP_STRUCTURE;
hwloc_topology_distances_init(topology);
hwloc_distances_init(topology);
/* Make the topology look like something coherent but empty */
hwloc_topology_setup_defaults(topology);
@ -2349,13 +2522,64 @@ hwloc_topology_init (struct hwloc_topology **topologyp)
return 0;
}
int
hwloc_topology_set_pid(struct hwloc_topology *topology __hwloc_attribute_unused,
hwloc_pid_t pid __hwloc_attribute_unused)
{
/* this does *not* change the backend */
#ifdef HWLOC_LINUX_SYS
topology->pid = pid;
return 0;
#else /* HWLOC_LINUX_SYS */
errno = ENOSYS;
return -1;
#endif /* HWLOC_LINUX_SYS */
}
static int
hwloc_backend_custom_init(struct hwloc_topology *topology)
{
assert(topology->backend_type == HWLOC_BACKEND_NONE);
topology->levels[0][0]->type = HWLOC_OBJ_SYSTEM;
topology->is_thissystem = 0;
topology->backend_type = HWLOC_BACKEND_CUSTOM;
return 0;
}
int
hwloc_custom_insert_topology(struct hwloc_topology *newtopology,
struct hwloc_obj *newparent,
struct hwloc_topology *oldtopology,
struct hwloc_obj *oldroot)
{
if (newtopology->backend_type != HWLOC_BACKEND_CUSTOM || newtopology->is_loaded || !oldtopology->is_loaded) {
errno = EINVAL;
return -1;
}
hwloc__duplicate_objects(newtopology, newparent, oldroot ? oldroot : oldtopology->levels[0][0]);
return 0;
}
static void
hwloc_backend_custom_exit(struct hwloc_topology *topology)
{
assert(topology->backend_type == HWLOC_BACKEND_CUSTOM);
hwloc_topology_clear(topology);
hwloc_topology_setup_defaults(topology);
topology->backend_type = HWLOC_BACKEND_NONE;
}
static void
hwloc_backend_exit(struct hwloc_topology *topology)
{
switch (topology->backend_type) {
#ifdef HWLOC_LINUX_SYS
case HWLOC_BACKEND_SYSFS:
hwloc_backend_sysfs_exit(topology);
case HWLOC_BACKEND_LINUXFS:
hwloc_backend_linuxfs_exit(topology);
break;
#endif
case HWLOC_BACKEND_XML:
@ -2364,11 +2588,21 @@ hwloc_backend_exit(struct hwloc_topology *topology)
case HWLOC_BACKEND_SYNTHETIC:
hwloc_backend_synthetic_exit(topology);
break;
case HWLOC_BACKEND_CUSTOM:
hwloc_backend_custom_exit(topology);
break;
default:
break;
}
assert(topology->backend_type == HWLOC_BACKEND_NONE);
if (topology->is_loaded) {
hwloc_topology_clear(topology);
hwloc_distances_destroy(topology);
hwloc_topology_setup_defaults(topology);
topology->is_loaded = 0;
}
}
int
@ -2378,19 +2612,8 @@ hwloc_topology_set_fsroot(struct hwloc_topology *topology, const char *fsroot_pa
hwloc_backend_exit(topology);
#ifdef HWLOC_LINUX_SYS
if (hwloc_backend_sysfs_init(topology, fsroot_path) < 0)
if (hwloc_backend_linuxfs_init(topology, fsroot_path) < 0)
return -1;
#endif /* HWLOC_LINUX_SYS */
return 0;
}
int
hwloc_topology_set_pid(struct hwloc_topology *topology __hwloc_attribute_unused,
hwloc_pid_t pid __hwloc_attribute_unused)
{
#ifdef HWLOC_LINUX_SYS
topology->pid = pid;
return 0;
#else /* HWLOC_LINUX_SYS */
errno = ENOSYS;
@ -2417,6 +2640,15 @@ hwloc_topology_set_xml(struct hwloc_topology *topology __hwloc_attribute_unused,
return hwloc_backend_xml_init(topology, xmlpath, NULL, 0);
}
int
hwloc_topology_set_custom(struct hwloc_topology *topology)
{
/* cleanup existing backend */
hwloc_backend_exit(topology);
return hwloc_backend_custom_init(topology);
}
int
hwloc_topology_set_xmlbuffer(struct hwloc_topology *topology __hwloc_attribute_unused,
const char *xmlbuffer __hwloc_attribute_unused,
@ -2447,9 +2679,7 @@ hwloc_topology_ignore_type(struct hwloc_topology *topology, hwloc_obj_type_t typ
/* we need the PU level */
errno = EINVAL;
return -1;
} else if (type == HWLOC_OBJ_PCI_DEVICE
|| type == HWLOC_OBJ_BRIDGE
|| type == HWLOC_OBJ_OS_DEVICE) {
} else if (hwloc_obj_type_is_io(type)) {
/* I/O devices aren't in any level, use topology flags to ignore them */
errno = EINVAL;
return -1;
@ -2471,9 +2701,7 @@ hwloc_topology_ignore_type_keep_structure(struct hwloc_topology *topology, hwloc
/* we need the PU level */
errno = EINVAL;
return -1;
} else if (type == HWLOC_OBJ_PCI_DEVICE
|| type == HWLOC_OBJ_BRIDGE
|| type == HWLOC_OBJ_OS_DEVICE) {
} else if (hwloc_obj_type_is_io(type)) {
/* I/O devices aren't in any level, use topology flags to ignore them */
errno = EINVAL;
return -1;
@ -2489,19 +2717,24 @@ hwloc_topology_ignore_all_keep_structure(struct hwloc_topology *topology)
unsigned type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++)
if (type != HWLOC_OBJ_PU
&& type != HWLOC_OBJ_PCI_DEVICE
&& type != HWLOC_OBJ_BRIDGE
&& type != HWLOC_OBJ_OS_DEVICE)
&& !hwloc_obj_type_is_io(type))
topology->ignored_types[type] = HWLOC_IGNORE_TYPE_KEEP_STRUCTURE;
return 0;
}
/* traverse the tree and free everything.
* only use first_child/next_sibling so that it works before load()
* and may be used when switching between backend.
*/
static void
hwloc_topology_clear_tree (struct hwloc_topology *topology, struct hwloc_obj *root)
{
unsigned i;
for(i=0; i<root->arity; i++)
hwloc_topology_clear_tree (topology, root->children[i]);
hwloc_obj_t child = root->first_child;
while (child) {
hwloc_obj_t nextchild = child->next_sibling;
hwloc_topology_clear_tree (topology, child);
child = nextchild;
}
hwloc_free_unlinked_object (root);
}
@ -2509,10 +2742,12 @@ static void
hwloc_topology_clear (struct hwloc_topology *topology)
{
unsigned l;
hwloc_topology_distances_clear(topology);
hwloc_distances_clear(topology);
hwloc_topology_clear_tree (topology, topology->levels[0][0]);
for (l=0; l<topology->nb_levels; l++)
for (l=0; l<topology->nb_levels; l++) {
free(topology->levels[l]);
topology->levels[l] = NULL;
}
free(topology->bridge_level);
free(topology->pcidev_level);
free(topology->osdev_level);
@ -2521,9 +2756,9 @@ hwloc_topology_clear (struct hwloc_topology *topology)
void
hwloc_topology_destroy (struct hwloc_topology *topology)
{
hwloc_topology_clear(topology);
hwloc_topology_distances_destroy(topology);
hwloc_backend_exit(topology);
hwloc_topology_clear(topology);
hwloc_distances_destroy(topology);
free(topology->support.discovery);
free(topology->support.cpubind);
free(topology->support.membind);
@ -2548,7 +2783,7 @@ hwloc_topology_load (struct hwloc_topology *topology)
char *fsroot_path_env = getenv("HWLOC_FORCE_FSROOT");
if (fsroot_path_env) {
hwloc_backend_exit(topology);
hwloc_backend_sysfs_init(topology, fsroot_path_env);
hwloc_backend_linuxfs_init(topology, fsroot_path_env);
}
}
#endif
@ -2565,7 +2800,7 @@ hwloc_topology_load (struct hwloc_topology *topology)
if (topology->backend_type == HWLOC_BACKEND_NONE) {
char *fsroot_path_env = getenv("HWLOC_FSROOT");
if (fsroot_path_env)
hwloc_backend_sysfs_init(topology, fsroot_path_env);
hwloc_backend_linuxfs_init(topology, fsroot_path_env);
}
#endif
if (topology->backend_type == HWLOC_BACKEND_NONE) {
@ -2582,7 +2817,7 @@ hwloc_topology_load (struct hwloc_topology *topology)
/* if we haven't chosen the backend, set the OS-specific one if needed */
if (topology->backend_type == HWLOC_BACKEND_NONE) {
#ifdef HWLOC_LINUX_SYS
if (hwloc_backend_sysfs_init(topology, "/") < 0)
if (hwloc_backend_linuxfs_init(topology, "/") < 0)
return -1;
#endif
}
@ -2590,7 +2825,7 @@ hwloc_topology_load (struct hwloc_topology *topology)
/* get distance matrix from the environment are store them (as indexes) in the topology.
* indexes will be converted into objects later once the tree will be filled
*/
hwloc_store_distances_from_env(topology);
hwloc_distances_set_from_env(topology);
/* actual topology discovery */
err = hwloc_discover(topology);
@ -2637,9 +2872,9 @@ hwloc_topology_restrict(struct hwloc_topology *topology, hwloc_const_cpuset_t cp
hwloc_connect_children(topology->levels[0][0]);
hwloc_connect_levels(topology);
propagate_total_memory(topology->levels[0][0]);
hwloc_restrict_distances(topology, flags);
hwloc_convert_distances_indexes_into_objects(topology);
hwloc_finalize_logical_distances(topology);
hwloc_distances_restrict(topology, flags);
hwloc_distances_finalize_os(topology);
hwloc_distances_finalize_logical(topology);
return 0;
}
@ -2716,6 +2951,25 @@ hwloc__check_children(struct hwloc_obj *parent)
}
}
static void
hwloc__check_children_depth(struct hwloc_topology *topology, struct hwloc_obj *parent)
{
hwloc_obj_t child = NULL;
while ((child = hwloc_get_next_child(topology, parent, child)) != NULL) {
if (child->type == HWLOC_OBJ_BRIDGE)
assert(child->depth == (unsigned) HWLOC_TYPE_DEPTH_BRIDGE);
else if (child->type == HWLOC_OBJ_PCI_DEVICE)
assert(child->depth == (unsigned) HWLOC_TYPE_DEPTH_PCI_DEVICE);
else if (child->type == HWLOC_OBJ_OS_DEVICE)
assert(child->depth == (unsigned) HWLOC_TYPE_DEPTH_OS_DEVICE);
else if (child->type == HWLOC_OBJ_MISC)
assert(child->depth == (unsigned) -1);
else if (parent->depth != (unsigned) -1)
assert(child->depth > parent->depth);
hwloc__check_children_depth(topology, child);
}
}
/* check a whole topology structure */
void
hwloc_topology_check(struct hwloc_topology *topology)
@ -2811,6 +3065,11 @@ hwloc_topology_check(struct hwloc_topology *topology)
/* bottom-level object must always be PU */
assert(obj->type == HWLOC_OBJ_PU);
}
/* check relative depths */
obj = hwloc_get_root_obj(topology);
assert(obj->depth == 0);
hwloc__check_children_depth(topology, obj);
}
const struct hwloc_topology_support *

Просмотреть файл

@ -12,8 +12,8 @@
* this header represents the public interface to this static component.
*/
#ifndef MCA_OPAL_HWLOC_HWLOC132_H
#define MCA_OPAL_HWLOC_HWLOC132_H
#ifndef MCA_OPAL_HWLOC_HWLOC142_H
#define MCA_OPAL_HWLOC_HWLOC142_H
BEGIN_C_DECLS
@ -41,4 +41,4 @@ BEGIN_C_DECLS
END_C_DECLS
#endif /* MCA_OPAL_HWLOC_HWLOC132_H */
#endif /* MCA_OPAL_HWLOC_HWLOC142_H */

Просмотреть файл

@ -18,20 +18,20 @@
#include "opal/constants.h"
#include "opal/mca/hwloc/hwloc.h"
#include "hwloc132.h"
#include "hwloc142.h"
/*
* Public string showing the sysinfo ompi_linux component version number
*/
const char *opal_hwloc_hwloc132_component_version_string =
"OPAL hwloc132 hwloc MCA component version " OPAL_VERSION;
const char *opal_hwloc_hwloc142_component_version_string =
"OPAL hwloc142 hwloc MCA component version " OPAL_VERSION;
/*
* 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_hwloc132_component = {
const opal_hwloc_component_t mca_hwloc_hwloc142_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
@ -40,7 +40,7 @@ const opal_hwloc_component_t mca_hwloc_hwloc132_component = {
OPAL_HWLOC_BASE_VERSION_2_0_0,
/* Component name and version */
"hwloc132",
"hwloc142",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,