1
1

Update the embedded hwloc from v1.4.2 to v1.5.1.

This commit was SVN r27797.
Этот коммит содержится в:
Jeff Squyres 2013-01-12 02:08:04 +00:00
родитель 427c154800
Коммит 3ce170d463
96 изменённых файлов: 11983 добавлений и 2344 удалений

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

@ -1,7 +0,0 @@
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
https://svn.open-mpi.org/trac/hwloc/changeset/4542

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

@ -1,75 +0,0 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/** \file
* \brief The old deprecated Cpuset API.
* This interface should not be used anymore, it will be dropped in a later release.
*
* hwloc/bitmap.h should be used instead. Most hwloc_cpuset_foo functions are
* replaced with hwloc_bitmap_foo. The only exceptions are:
* - hwloc_cpuset_from_string -> hwloc_bitmap_sscanf
* - hwloc_cpuset_cpu -> hwloc_bitmap_only
* - hwloc_cpuset_all_but_cpu -> hwloc_bitmap_allbut
*/
#ifndef HWLOC_CPUSET_H
#define HWLOC_CPUSET_H
#ifdef __cplusplus
extern "C" {
#endif
#include "hwloc/bitmap.h"
static __hwloc_inline hwloc_bitmap_t __hwloc_attribute_deprecated hwloc_cpuset_alloc(void) { return hwloc_bitmap_alloc(); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_free(hwloc_bitmap_t bitmap) { hwloc_bitmap_free(bitmap); }
static __hwloc_inline hwloc_bitmap_t __hwloc_attribute_deprecated hwloc_cpuset_dup(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_dup(bitmap); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src) { hwloc_bitmap_copy(dst, src); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_snprintf(buf, buflen, bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_asprintf(char ** strp, hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_asprintf(strp, bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_from_string(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string) { return hwloc_bitmap_sscanf(bitmap, string); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_zero(hwloc_bitmap_t bitmap) { hwloc_bitmap_zero(bitmap); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_fill(hwloc_bitmap_t bitmap) { hwloc_bitmap_fill(bitmap); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask) { hwloc_bitmap_from_ulong(bitmap, mask); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask) { hwloc_bitmap_from_ith_ulong(bitmap, i, mask); }
static __hwloc_inline unsigned __hwloc_attribute_deprecated long hwloc_cpuset_to_ulong(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_to_ulong(bitmap); }
static __hwloc_inline unsigned __hwloc_attribute_deprecated long hwloc_cpuset_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) { return hwloc_bitmap_to_ith_ulong(bitmap, i); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_cpu(hwloc_bitmap_t bitmap, unsigned index_) { hwloc_bitmap_only(bitmap, index_); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_all_but_cpu(hwloc_bitmap_t bitmap, unsigned index_) { hwloc_bitmap_allbut(bitmap, index_); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_set(hwloc_bitmap_t bitmap, unsigned index_) { hwloc_bitmap_set(bitmap, index_); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_set_range(hwloc_bitmap_t bitmap, unsigned begin, unsigned end) { hwloc_bitmap_set_range(bitmap, begin, end); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask) { hwloc_bitmap_set_ith_ulong(bitmap, i, mask); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_clr(hwloc_bitmap_t bitmap, unsigned index_) { hwloc_bitmap_clr(bitmap, index_); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_clr_range(hwloc_bitmap_t bitmap, unsigned begin, unsigned end) { hwloc_bitmap_clr_range(bitmap, begin, end); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_isset(hwloc_const_bitmap_t bitmap, unsigned index_) { return hwloc_bitmap_isset(bitmap, index_); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_iszero(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_iszero(bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_isfull(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_isfull(bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_isequal(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { return hwloc_bitmap_isequal(bitmap1, bitmap2); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_intersects(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { return hwloc_bitmap_intersects(bitmap1, bitmap2); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_isincluded(hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) { return hwloc_bitmap_isincluded(sub_bitmap, super_bitmap); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_or(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { hwloc_bitmap_or(res, bitmap1, bitmap2); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_and(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { hwloc_bitmap_and(res, bitmap1, bitmap2); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_andnot(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { hwloc_bitmap_andnot(res, bitmap1, bitmap2); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_xor(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { hwloc_bitmap_xor(res, bitmap1, bitmap2); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_not(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap) { hwloc_bitmap_not(res, bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_first(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_first(bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_last(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_last(bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_next(hwloc_const_bitmap_t bitmap, unsigned prev) { return hwloc_bitmap_next(bitmap, prev); }
static __hwloc_inline void __hwloc_attribute_deprecated hwloc_cpuset_singlify(hwloc_bitmap_t bitmap) { hwloc_bitmap_singlify(bitmap); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { return hwloc_bitmap_compare_first(bitmap1, bitmap2); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) { return hwloc_bitmap_compare(bitmap1, bitmap2); }
static __hwloc_inline int __hwloc_attribute_deprecated hwloc_cpuset_weight(hwloc_const_bitmap_t bitmap) { return hwloc_bitmap_weight(bitmap); }
#define hwloc_cpuset_foreach_begin hwloc_bitmap_foreach_begin
#define hwloc_cpuset_foreach_end hwloc_bitmap_foreach_end
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_CPUSET_H */

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

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

@ -1,5 +1,5 @@
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -18,16 +18,16 @@ EXTRA_DIST = \
SUBDIRS = hwloc
# Headers and sources
headers = hwloc142.h
sources = hwloc142_component.c
headers = hwloc151.h
sources = hwloc151_component.c
# We only ever build this component statically
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 = \
noinst_LTLIBRARIES = libmca_hwloc_hwloc151.la
libmca_hwloc_hwloc151_la_SOURCES = $(headers) $(sources)
nodist_libmca_hwloc_hwloc151_la_SOURCES = $(nodist_headers)
libmca_hwloc_hwloc151_la_LDFLAGS = -module -avoid-version $(opal_hwloc_hwloc151_LDFLAGS)
libmca_hwloc_hwloc151_la_LIBADD = $(opal_hwloc_hwloc151_LIBS)
libmca_hwloc_hwloc151_la_DEPENDENCIES = \
$(HWLOC_top_builddir)/src/libhwloc_embedded.la
# Since the rest of the code base includes the underlying hwloc.h, we

1988
opal/mca/hwloc/hwloc151/Makefile.in Обычный файл

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

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

@ -0,0 +1,4 @@
Applied the following patches from the upstream hwloc 1.5 branch after
the v1.5.1 release:
(none so far)

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

@ -12,40 +12,40 @@
#
# Priority
#
AC_DEFUN([MCA_opal_hwloc_hwloc142_PRIORITY], [50])
AC_DEFUN([MCA_opal_hwloc_hwloc151_PRIORITY], [75])
#
# Force this component to compile in static-only mode
#
AC_DEFUN([MCA_opal_hwloc_hwloc142_COMPILE_MODE], [
AC_DEFUN([MCA_opal_hwloc_hwloc151_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)
m4_include(opal/mca/hwloc/hwloc151/hwloc/config/hwloc.m4)
m4_include(opal/mca/hwloc/hwloc151/hwloc/config/hwloc_pkg.m4)
m4_include(opal/mca/hwloc/hwloc151/hwloc/config/hwloc_check_attributes.m4)
m4_include(opal/mca/hwloc/hwloc151/hwloc/config/hwloc_check_visibility.m4)
m4_include(opal/mca/hwloc/hwloc151/hwloc/config/hwloc_check_vendor.m4)
# MCA_hwloc_hwloc142_POST_CONFIG()
# MCA_hwloc_hwloc151_POST_CONFIG()
# ---------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc142_POST_CONFIG],[
OPAL_VAR_SCOPE_PUSH([opal_hwloc_hwloc142_basedir])
AC_DEFUN([MCA_opal_hwloc_hwloc151_POST_CONFIG],[
OPAL_VAR_SCOPE_PUSH([opal_hwloc_hwloc151_basedir])
# If we won, then do all the rest of the setup
AS_IF([test "$1" = "1"],
[
# Set this variable so that the framework m4 knows what
# file to include in opal/mca/hwloc/hwloc.h
opal_hwloc_hwloc142_basedir=opal/mca/hwloc/hwloc142
opal_hwloc_base_include="$opal_hwloc_hwloc142_basedir/hwloc142.h"
opal_hwloc_hwloc151_basedir=opal/mca/hwloc/hwloc151
opal_hwloc_base_include="$opal_hwloc_hwloc151_basedir/hwloc151.h"
# Add some stuff to CPPFLAGS so that the rest of the source
# tree can be built
file=$opal_hwloc_hwloc142_basedir/hwloc
file=$opal_hwloc_hwloc151_basedir/hwloc
CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_SRCDIR/$file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[$CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_BUILDDIR/$file/include"])
@ -55,7 +55,7 @@ AC_DEFUN([MCA_opal_hwloc_hwloc142_POST_CONFIG],[
# building with developer headers so that our headers can
# be found.
AS_IF([test "$with_devel_headers" = "yes"],
[OPAL_WRAPPER_EXTRA_CPPFLAGS="$OPAL_WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/'"$opal_hwloc_hwloc142_basedir/hwloc/include"])
[OPAL_WRAPPER_EXTRA_CPPFLAGS="$OPAL_WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/'"$opal_hwloc_hwloc151_basedir/hwloc/include"])
OPAL_WRAPPER_EXTRA_LIBS="$OPAL_WRAPPER_EXTRA_LIBS $HWLOC_EMBEDDED_LIBS"
HWLOC_DO_AM_CONDITIONALS
@ -64,32 +64,32 @@ AC_DEFUN([MCA_opal_hwloc_hwloc142_POST_CONFIG],[
])dnl
# MCA_hwloc_hwloc142_CONFIG([action-if-found], [action-if-not-found])
# MCA_hwloc_hwloc151_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc142_CONFIG],[
AC_DEFUN([MCA_opal_hwloc_hwloc151_CONFIG],[
# Hwloc needs to know if we have Verbs support
AC_REQUIRE([OPAL_CHECK_VERBS_DIR])
AC_CONFIG_FILES([opal/mca/hwloc/hwloc142/Makefile])
AC_CONFIG_FILES([opal/mca/hwloc/hwloc151/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])
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc151_save_CPPFLAGS opal_hwloc_hwloc151_save_LDFLAGS opal_hwloc_hwloc151_save_LIBS opal_hwloc_hwloc151_save_cairo opal_hwloc_hwloc151_save_xml opal_hwloc_hwloc151_basedir opal_hwloc_hwloc151_file opal_hwloc_hwloc151_save_cflags])
# default to this component not providing support
opal_hwloc_hwloc142_basedir=opal/mca/hwloc/hwloc142
opal_hwloc_hwloc142_support=no
opal_hwloc_hwloc151_basedir=opal/mca/hwloc/hwloc151
opal_hwloc_hwloc151_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
opal_hwloc_hwloc151_save_CPPFLAGS=$CPPFLAGS
opal_hwloc_hwloc151_save_LDFLAGS=$LDFLAGS
opal_hwloc_hwloc151_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_])
HWLOC_SET_SYMBOL_PREFIX([opal_hwloc151_])
# save XML or graphical options
opal_hwloc_hwloc142_save_cairo=$enable_cairo
opal_hwloc_hwloc142_save_xml=$enable_xml
opal_hwloc_hwloc151_save_cairo=$enable_cairo
opal_hwloc_hwloc151_save_xml=$enable_xml
# never enable hwloc's graphical option
enable_cairo=no
@ -101,19 +101,19 @@ AC_DEFUN([MCA_opal_hwloc_hwloc142_CONFIG],[
# hwloc checks for compiler visibility, and its needs to do
# this without "picky" flags.
opal_hwloc_hwloc142_save_cflags=$CFLAGS
opal_hwloc_hwloc151_save_cflags=$CFLAGS
CFLAGS=$OMPI_CFLAGS_BEFORE_PICKY
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc142/hwloc],
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc151/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`"
HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc151_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc151_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
opal_hwloc_hwloc151_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)'
opal_hwloc_hwloc151_LIBS='$(top_ompi_builddir)/'"$opal_hwloc_hwloc151_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)'
opal_hwloc_hwloc151_support=yes
AC_DEFINE_UNQUOTED([HWLOC_HWLOC142_HWLOC_VERSION],
AC_DEFINE_UNQUOTED([HWLOC_HWLOC151_HWLOC_VERSION],
["$HWLOC_VERSION"],
[Version of hwloc])
@ -126,27 +126,27 @@ AC_DEFUN([MCA_opal_hwloc_hwloc142_CONFIG],[
],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([no])
opal_hwloc_hwloc142_support=no])
CFLAGS=$opal_hwloc_hwloc142_save_cflags
opal_hwloc_hwloc151_support=no])
CFLAGS=$opal_hwloc_hwloc151_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])
AS_IF([test -n "$opal_hwloc_hwloc151_save_cairo"],
[enable_cairo=$opal_hwloc_hwloc151_save_cairo])
AS_IF([test -n "$opal_hwloc_hwloc151_save_xml"],
[enable_xml=$opal_hwloc_hwloc151_save_xml])
CPPFLAGS=$opal_hwloc_hwloc142_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc142_save_LDFLAGS
LIBS=$opal_hwloc_hwloc142_save_LIBS
CPPFLAGS=$opal_hwloc_hwloc151_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc151_save_LDFLAGS
LIBS=$opal_hwloc_hwloc151_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])
AC_SUBST([opal_hwloc_hwloc151_CFLAGS])
AC_SUBST([opal_hwloc_hwloc151_CPPFLAGS])
AC_SUBST([opal_hwloc_hwloc151_LDFLAGS])
AC_SUBST([opal_hwloc_hwloc151_LIBS])
fi
# Done!
AS_IF([test "$opal_hwloc_hwloc142_support" = "yes"],
AS_IF([test "$opal_hwloc_hwloc151_support" = "yes"],
[$1],
[$2])

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

@ -71,3 +71,15 @@ if HWLOC_BUILD_STANDALONE
doc readme:
$(MAKE) -C doc readme
endif HWLOC_BUILD_STANDALONE
#
# Winball specific rules, to be manually run after make install
#
if HWLOC_BUILD_STANDALONE
.PHONY: install-winball
install-winball:
sed -e 's/$$/'$$'\015'/ < $(srcdir)/README > $(prefix)/README.txt
sed -e 's/$$/'$$'\015'/ < $(srcdir)/NEWS > $(prefix)/NEWS.txt
sed -e 's/$$/'$$'\015'/ < $(srcdir)/COPYING > $(prefix)/COPYING.txt
$(RM) $(pkgconfigdir)/hwloc.pc
endif HWLOC_BUILD_STANDALONE

1880
opal/mca/hwloc/hwloc151/hwloc/Makefile.in Обычный файл

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

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

@ -1,5 +1,5 @@
Copyright © 2009 CNRS
Copyright © 2009-2011 inria. All rights reserved.
Copyright © 2009-2012 inria. All rights reserved.
Copyright © 2009-2012 Université Bordeaux 1
Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
@ -17,6 +17,84 @@ bug fixes (and other actions) for each version of hwloc since version
in v0.9.1).
Version 1.5.1
-------------
* Fix block OS device detection on Linux kernel 3.3 and later.
Thanks to Guy Streeter for reporting the problem and testing the fix.
* Fix the cpuid code in the x86 backend (for FreeBSD). Thanks to
Sebastian Kuzminsky for reporting problems and testing patches.
* Fix 64bit detection on FreeBSD.
* Fix some corner cases in the management of the thissystem flag with
respect to topology flags and environment variables.
* Fix some corner cases in command-line parsing checks in hwloc-distrib
and hwloc-distances.
* Make sure we do not miss some block OS devices on old Linux kernels
when a single PCI device has multiple IDE hosts/devices behind it.
* Do not disable I/O devices or instruction caches in hwloc-assembler output.
Version 1.5.0
-------------
* Backends
+ Do not limit the number of processors to 1024 on Solaris anymore.
+ Gather total machine memory on FreeBSD.
+ XML topology files do not depend on the locale anymore. Float numbers
such as NUMA distances or PCI link speeds now always use a dot as a
decimal separator.
+ Add instruction caches detection on Linux, AIX, Windows and Darwin.
+ Add get_last_cpu_location() support for the current thread on AIX.
+ Support binding on AIX when threads or processes were bound with
bindprocessor(). Thanks to Hendryk Bockelmann for reporting the issue
and testing patches, and to Farid Parpia for explaining the binding
interfaces.
+ Improve AMD topology detection in the x86 backend (for FreeBSD) using
the topoext feature.
* API
+ Increase HWLOC_API_VERSION to 0x00010500 so that API changes may be
detected at build-time.
+ Add a cache type attribute describind Data, Instruction and Unified
caches. Caches with different types but same depth (for instance L1d
and L1i) are placed on different levels.
+ Add hwloc_get_cache_type_depth() to retrieve the hwloc level depth of
of the given cache depth and type, for instance L1i or L2.
It helps disambiguating the case where hwloc_get_type_depth() returns
HWLOC_TYPE_DEPTH_MULTIPLE.
+ Instruction caches are ignored unless HWLOC_TOPOLOGY_FLAG_ICACHES is
passed to hwloc_topology_set_flags() before load.
+ Add hwloc_ibv_get_device_osdev_by_name() OpenFabrics helper in
openfabrics-verbs.h to find the hwloc OS device object corresponding to
an OpenFabrics device.
* Tools
+ Add lstopo-no-graphics, a lstopo built without graphical support to
avoid dependencies on external libraries such as Cairo and X11. When
supported, graphical outputs are only available in the original lstopo
program.
- Packagers splitting lstopo and lstopo-no-graphics into different
packages are advised to use the alternatives system so that lstopo
points to the best available binary.
+ Instruction caches are enabled in lstopo by default. User --no-icaches
to disable them.
+ Add -t/--threads to show threads in hwloc-ps.
* Removal of obsolete components
+ Remove the old cpuset interface (hwloc/cpuset.h) which is deprecated and
superseded by the bitmap API (hwloc/bitmap.h) since v1.1.
hwloc_cpuset and nodeset types are still defined, but all hwloc_cpuset_*
compatibility wrappers are now gone.
+ Remove Linux libnuma conversion helpers for the deprecated and
broken nodemask_t interface.
+ Remove support for "Proc" type name, it was superseded by "PU" in v1.0.
+ Remove hwloc-mask symlinks, it was replaced by hwloc-calc in v1.0.
* Misc
+ Fix PCIe 3.0 link speed computation.
+ Non-printable characters are dropped from strings during XML export.
+ Fix importing of escaped characters with the minimalistic XML backend.
+ Assert hwloc_is_thissystem() in several I/O related helpers.
+ Fix some memory leaks in the x86 backend for FreeBSD.
+ Minor fixes to ease native builds on Windows.
+ Limit the number of retries when operating on all threads within a
process on Linux if the list of threads is heavily getting modified.
Version 1.4.2
-------------
* Fix build on Solaris 9 and earlier when fabsf() is not a compiler

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

@ -41,8 +41,8 @@ not support topology information, and hwloc thus uses an x86-only CPUID-based
backend (which could be used for other OSes too).
To check whether hwloc works on a particular machine, just try to build it and
run lstopo. If some things do not look right (e.g. bogus or missing cache
information), see Questions and Bugs below.
run lstopo or lstopo-no-graphics. If some things do not look right (e.g. bogus
or missing cache information), see Questions and Bugs below.
hwloc only reports the number of processors on unsupported operating systems;
no topology information is available.
@ -66,7 +66,7 @@ below. It may also be used to binding applications onto certain cores or memory
nodes. Several utility programs are also provided to ease command-line
manipulation of topology objects, binding of processes, and so on.
Perl bindings are available from Bernd Kallies on CPAN:
Perl bindings are available from Bernd Kallies on CPAN.
Python bindings are available from Guy Streeter:
@ -100,7 +100,7 @@ shell$ make install
The hwloc command-line tool "lstopo" produces human-readable topology maps, as
mentioned above. It can also export maps to the "fig" file format. Support for
PDF, Postscript, and PNG exporting is provided if the "Cairo" development
package can be found when hwloc is configured and build.
package can be found in "lstopo" when hwloc is configured and build.
The hwloc core may also benefit from the following development packages:
@ -157,55 +157,39 @@ line), and only socket #0 is shown for brevity:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topology SYSTEM "hwloc.dtd">
<topology>
<object type="Machine" os_level="-1" os_index="0" cpuset="0x0000ffff"
<object type="Machine" os_index="0" cpuset="0x0000ffff"
complete_cpuset="0x0000ffff" online_cpuset="0x0000ffff"
allowed_cpuset="0x0000ffff"
dmi_board_vendor="Dell Computer Corporation" dmi_board_name="0RD318"
local_memory="16648183808">
<page_type size="4096" count="4064498"/>
<page_type size="2097152" count="0"/>
<object type="Socket" os_level="-1" os_index="0" cpuset="0x00001111"
complete_cpuset="0x00001111" online_cpuset="0x00001111"
allowed_cpuset="0x00001111">
<object type="Cache" os_level="-1" cpuset="0x00001111"
complete_cpuset="0x00001111" online_cpuset="0x00001111"
allowed_cpuset="0x00001111" cache_size="4194304" depth="3"
cache_linesize="64">
<object type="Cache" os_level="-1" cpuset="0x00000101"
complete_cpuset="0x00000101" online_cpuset="0x00000101"
allowed_cpuset="0x00000101" cache_size="1048576" depth="2"
cache_linesize="64">
<object type="Cache" os_level="-1" cpuset="0x00000101"
complete_cpuset="0x00000101" online_cpuset="0x00000101"
allowed_cpuset="0x00000101" cache_size="16384" depth="1"
cache_linesize="64">
<object type="Core" os_level="-1" os_index="0" cpuset="0x00000101"
complete_cpuset="0x00000101" online_cpuset="0x00000101"
allowed_cpuset="0x00000101">
<object type="PU" os_level="-1" os_index="0" cpuset="0x00000001"
<object type="Socket" os_index="0" cpuset="0x00001111" ... >
<object type="Cache" cpuset="0x00001111" ...
cache_size="4194304" depth="3" cache_linesize="64">
<object type="Cache" cpuset="0x00000101" ...
cache_size="1048576" depth="2" cache_linesize="64">
<object type="Cache" cpuset="0x00000101" ...
cache_size="16384" depth="1" cache_linesize="64">
<object type="Core" os_index="0" ... >
<object type="PU" os_index="0" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001"/>
<object type="PU" os_level="-1" os_index="8" cpuset="0x00000100"
<object type="PU" os_index="8" cpuset="0x00000100"
complete_cpuset="0x00000100" online_cpuset="0x00000100"
allowed_cpuset="0x00000100"/>
</object>
</object>
</object>
<object type="Cache" os_level="-1" cpuset="0x00001010"
complete_cpuset="0x00001010" online_cpuset="0x00001010"
allowed_cpuset="0x00001010" cache_size="1048576" depth="2"
cache_linesize="64">
<object type="Cache" os_level="-1" cpuset="0x00001010"
complete_cpuset="0x00001010" online_cpuset="0x00001010"
allowed_cpuset="0x00001010" cache_size="16384" depth="1"
cache_linesize="64">
<object type="Core" os_level="-1" os_index="1" cpuset="0x00001010"
complete_cpuset="0x00001010" online_cpuset="0x00001010"
allowed_cpuset="0x00001010">
<object type="PU" os_level="-1" os_index="4" cpuset="0x00000010"
<object type="Cache" cpuset="0x00001010" ...
cache_size="1048576" depth="2" cache_linesize="64">
<object type="Cache" cpuset="0x00001010"
cache_size="16384" depth="1" cache_linesize="64">
<object type="Core" os_index="1" cpuset="0x00001010" ... >
<object type="PU" os_index="4" cpuset="0x00000010"
complete_cpuset="0x00000010" online_cpuset="0x00000010"
allowed_cpuset="0x00000010"/>
<object type="PU" os_level="-1" os_index="12" cpuset="0x00001000"
<object type="PU" os_index="12" cpuset="0x00001000"
complete_cpuset="0x00001000" online_cpuset="0x00001000"
allowed_cpuset="0x00001000"/>
</object>
@ -244,40 +228,24 @@ added and only PU #0 is shown for brevity:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topology SYSTEM "hwloc.dtd">
<topology>
<object type="Machine" os_level="-1" os_index="0" cpuset="0x000000ff"
<object type="Machine" os_index="0" cpuset="0x000000ff"
complete_cpuset="0x000000ff" online_cpuset="0x000000ff"
allowed_cpuset="0x000000ff" nodeset="0x000000ff"
complete_nodeset="0x000000ff" allowed_nodeset="0x000000ff"
dmi_board_vendor="TYAN Computer Corp" dmi_board_name="S4881 ">
<page_type size="4096" count="0"/>
<page_type size="2097152" count="0"/>
<object type="NUMANode" os_level="-1" os_index="0" cpuset="0x00000003"
complete_cpuset="0x00000003" online_cpuset="0x00000003"
allowed_cpuset="0x00000003" nodeset="0x00000001"
complete_nodeset="0x00000001" allowed_nodeset="0x00000001"
local_memory="7514177536">
<object type="NUMANode" os_index="0" cpuset="0x00000003" ...
nodeset="0x00000001" ... local_memory="7514177536">
<page_type size="4096" count="1834516"/>
<page_type size="2097152" count="0"/>
<object type="Socket" os_level="-1" os_index="0" cpuset="0x00000003"
complete_cpuset="0x00000003" online_cpuset="0x00000003"
allowed_cpuset="0x00000003" nodeset="0x00000001"
complete_nodeset="0x00000001" allowed_nodeset="0x00000001">
<object type="Cache" os_level="-1" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001" nodeset="0x00000001"
complete_nodeset="0x00000001" allowed_nodeset="0x00000001"
<object type="Socket" os_index="0" cpuset="0x00000003" ... >
<object type="Cache" cpuset="0x00000001" ...
cache_size="1048576" depth="2" cache_linesize="64">
<object type="Cache" os_level="-1" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001" nodeset="0x00000001"
complete_nodeset="0x00000001" allowed_nodeset="0x00000001"
<object type="Cache" cpuset="0x00000001" ...
cache_size="65536" depth="1" cache_linesize="64">
<object type="Core" os_level="-1" os_index="0"
cpuset="0x00000001" complete_cpuset="0x00000001"
online_cpuset="0x00000001" allowed_cpuset="0x00000001"
nodeset="0x00000001" complete_nodeset="0x00000001"
allowed_nodeset="0x00000001">
<object type="PU" os_level="-1" os_index="0" cpuset="0x00000001"
<object type="Core" os_index="0" ... >
<object type="PU" os_index="0" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001" nodeset="0x00000001"
complete_nodeset="0x00000001" allowed_nodeset="0x00000001"/>
@ -315,39 +283,27 @@ And the same output in XML (line breaks added, only PU #0 shown):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topology SYSTEM "hwloc.dtd">
<topology>
<object type="Machine" os_level="-1" os_index="0" cpuset="0x000000ff"
<object type="Machine" os_index="0" cpuset="0x000000ff"
complete_cpuset="0x000000ff" online_cpuset="0x000000ff"
allowed_cpuset="0x000000ff" dmi_board_vendor="Dell Inc."
dmi_board_name="0NR282" local_memory="16865292288">
<page_type size="4096" count="4117503"/>
<page_type size="2097152" count="0"/>
<object type="Socket" os_level="-1" os_index="0" cpuset="0x00000055"
complete_cpuset="0x00000055" online_cpuset="0x00000055"
allowed_cpuset="0x00000055">
<object type="Cache" os_level="-1" cpuset="0x00000011"
complete_cpuset="0x00000011" online_cpuset="0x00000011"
allowed_cpuset="0x00000011" cache_size="4194304" depth="2"
cache_linesize="64">
<object type="Cache" os_level="-1" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001" cache_size="32768" depth="1"
cache_linesize="64">
<object type="Core" os_level="-1" os_index="0" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001">
<object type="PU" os_level="-1" os_index="0" cpuset="0x00000001"
<object type="Socket" os_index="0" cpuset="0x00000055" ... >
<object type="Cache" cpuset="0x00000011" ...
cache_size="4194304" depth="2" cache_linesize="64">
<object type="Cache" cpuset="0x00000001" ...
cache_size="32768" depth="1" cache_linesize="64">
<object type="Core" os_index="0" ... >
<object type="PU" os_index="0" cpuset="0x00000001"
complete_cpuset="0x00000001" online_cpuset="0x00000001"
allowed_cpuset="0x00000001"/>
</object>
</object>
<object type="Cache" os_level="-1" cpuset="0x00000010"
complete_cpuset="0x00000010" online_cpuset="0x00000010"
allowed_cpuset="0x00000010" cache_size="32768" depth="1"
cache_linesize="64">
<object type="Core" os_level="-1" os_index="1" cpuset="0x00000010"
complete_cpuset="0x00000010" online_cpuset="0x00000010"
allowed_cpuset="0x00000010">
<object type="PU" os_level="-1" os_index="4" cpuset="0x00000010"
<object type="Cache" cpuset="0x00000010" ...
cache_size="32768" depth="1" cache_linesize="64">
<object type="Core" os_index="1" ... >
<object type="PU" os_index="4" cpuset="0x00000010" ...
complete_cpuset="0x00000010" online_cpuset="0x00000010"
allowed_cpuset="0x00000010"/>
</object>
@ -452,9 +408,9 @@ core of the machine.
/* Example hwloc API program.
*
* Copyright ? 2009-2010 inria. All rights reserved.
* Copyright ? 2009-2011 Universit? Bordeaux 1
* Copyright ? 2009-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2010 inria. All rights reserved.
* Copyright (c) 2009-2011 Universit?eacute; Bordeaux 1
* Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*
* hwloc-hello.c
@ -465,7 +421,7 @@ core of the machine.
#include <stdio.h>
#include <string.h>
static void print_children(hwloc_topology_t topology, hwloc_obj_t obj,
static void print_children(hwloc_topology_t topology, hwloc_obj_t obj,
int depth)
{
char string[128];
@ -514,7 +470,7 @@ int main(void)
*****************************************************************/
for (depth = 0; depth < topodepth; depth++) {
printf("*** Objects at level %d\n", depth);
for (i = 0; i < hwloc_get_nbobjs_by_depth(topology, depth);
for (i = 0; i < hwloc_get_nbobjs_by_depth(topology, depth);
i++) {
hwloc_obj_snprintf(string, sizeof(string), topology,
hwloc_get_obj_by_depth(topology, depth, i),
@ -538,7 +494,7 @@ int main(void)
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN) {
printf("*** The number of sockets is unknown\n");
} else {
printf("*** %u socket(s)\n",
printf("*** %u socket(s)\n",
hwloc_get_nbobjs_by_depth(topology, depth));
}
@ -556,7 +512,7 @@ int main(void)
levels++;
size += obj->attr->cache.size;
}
printf("*** Logical processor 0 has %d caches totaling %luKB\n",
printf("*** Logical processor 0 has %d caches totaling %luKB\n",
levels, size / 1024);
/*****************************************************************
@ -718,5 +674,5 @@ Make sure to have had a look at those too!
-------------------------------------------------------------------------------
Generated on Thu May 10 2012 16:17:03 for Hardware Locality (hwloc) by
doxygen 1.7.6.1
Generated on Wed Oct 17 2012 17:42:10 for Hardware Locality (hwloc) by
doxygen 1.8.1.2

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

@ -6,8 +6,8 @@
# <major>.<minor>.<release>. If release is zero, then it is omitted.
major=1
minor=4
release=2
minor=5
release=1
# greek is used for alpha or beta release tags. If it is non-empty,
# it will be appended to the version number. It does not have to be
@ -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=r4474
repo_rev=r4901
# The date when this release was created
date="May 10, 2012"
date="Oct 17, 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="May 10, 2012"
# 2. Version numbers are described in the Libtool current:revision:age
# format.
libhwloc_so_version=5:2:0
libhwloc_so_version=6:0:1

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

@ -1,8 +1,7 @@
# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
# generated automatically by aclocal 1.12.2 -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 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.
@ -14,20 +13,19 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
[m4_warning([this file was generated for autoconf 2.68.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
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'.])])
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
# Foundation, Inc.
# Copyright (C) 2002-2012 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
# serial 8
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
@ -35,10 +33,10 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
[am__api_version='1.12'
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.2], [],
m4_if([$1], [1.12.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -54,14 +52,12 @@ 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.2])dnl
[AM_AUTOMAKE_VERSION([1.12.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, 2011 Free Software Foundation, Inc.
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -69,9 +65,72 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# serial 1
# AM_PROG_AR([ACT-IF-FAIL])
# -------------------------
# Try to determine the archiver interface, and trigger the ar-lib wrapper
# if it is needed. If the detection of archiver interface fails, run
# ACT-IF-FAIL (default is to abort configure with a proper error message).
AC_DEFUN([AM_PROG_AR],
[AC_BEFORE([$0], [LT_INIT])dnl
AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([ar-lib])dnl
AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
: ${AR=ar}
AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
[am_cv_ar_interface=ar
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
[am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([am_ar_try])
if test "$ac_status" -eq 0; then
am_cv_ar_interface=ar
else
am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([am_ar_try])
if test "$ac_status" -eq 0; then
am_cv_ar_interface=lib
else
am_cv_ar_interface=unknown
fi
fi
rm -f conftest.lib libconftest.a
])
])
case $am_cv_ar_interface in
ar)
;;
lib)
# Microsoft lib, so override with the ar-lib wrapper script.
# FIXME: It is wrong to rewrite AR.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__AR in this case,
# and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
# similar.
AR="$am_aux_dir/ar-lib $AR"
;;
unknown)
m4_default([$1],
[AC_MSG_ERROR([could not determine $AR interface])])
;;
esac
AC_SUBST([AR])dnl
])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2012 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
# 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/../..'.
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
@ -90,7 +149,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@ -116,22 +175,21 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# Free Software Foundation, Inc.
# Copyright (C) 1997-2012 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 9
# serial 10
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
[AC_PREREQ([2.52])dnl
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
@ -150,16 +208,15 @@ 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,
# 2010, 2011 Free Software Foundation, Inc.
# Copyright (C) 1999-2012 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 12
# serial 17
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# 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,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
@ -169,7 +226,7 @@ fi])])
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@ -182,12 +239,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
[$1], [CXX], [depcc="$CXX" am_compiler_list=],
[$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
[$1], [UPC], [depcc="$UPC" am_compiler_list=],
[$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
@ -195,8 +253,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# 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'.
# 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
@ -236,16 +294,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@ -254,8 +312,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
test "$am__universal" = false || continue
;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@ -263,7 +321,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# 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.
am__obj=conftest.${OBJEXT-o}
@ -311,7 +369,7 @@ AM_CONDITIONAL([am__fastdep$1], [
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@ -321,9 +379,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
[AC_ARG_ENABLE([dependency-tracking], [dnl
AS_HELP_STRING(
[--enable-dependency-tracking],
[do not reject slow dependency extractors])
AS_HELP_STRING(
[--disable-dependency-tracking],
[speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@ -338,14 +400,13 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
# Copyright (C) 1999-2012 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 5
# serial 6
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@ -364,7 +425,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
@ -376,21 +437,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
@ -408,7 +467,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
@ -418,14 +477,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
# Copyright (C) 1996-2012 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 16
# serial 19
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
@ -471,31 +529,41 @@ AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
[AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated. For more info, see:
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
@ -506,28 +574,35 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
[_AM_DEPENDENCIES([CC])],
[m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
[_AM_DEPENDENCIES([CXX])],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
[_AM_DEPENDENCIES([OBJC])],
[m4_define([AC_PROG_OBJC],
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
dnl Support for Objective C++ was only introduced in Autoconf 2.65,
dnl but we still cater to Autoconf 2.62.
m4_ifdef([AC_PROG_OBJCXX],
[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
])
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
@ -555,14 +630,13 @@ 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, 2011 Free Software Foundation,
# Inc.
# Copyright (C) 2001-2012 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
# serial 8
# AM_PROG_INSTALL_SH
# ------------------
@ -577,9 +651,9 @@ if test x"${install_sh}" != xset; then
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
AC_SUBST(install_sh)])
AC_SUBST([install_sh])])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -602,13 +676,13 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
# Copyright (C) 2001-2012 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_MAKE_INCLUDE()
# -----------------
@ -627,7 +701,7 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'.
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
@ -652,8 +726,7 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -689,14 +762,13 @@ m4_define([AC_PROG_CC],
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
# Copyright (C) 1997-2012 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 6
# serial 7
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@ -726,49 +798,19 @@ if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
# 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'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 2001-2012 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 5
# serial 6
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@ -779,7 +821,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
# --------------------
# 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)])
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
@ -793,7 +835,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -814,22 +856,18 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# Free Software Foundation, Inc.
# Copyright (C) 1996-2012 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 5
# serial 9
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@ -840,32 +878,40 @@ case `pwd` in
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
# Do `set' in a subshell so we don't clobber the current shell's
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
@ -875,66 +921,117 @@ else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2009 Free Software Foundation, Inc.
# Copyright (C) 2009-2012 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
# serial 3
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# (`yes' being less verbose, `no' or empty being verbose).
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules],
[ --enable-silent-rules less verbose build output (undo: `make V=1')
--disable-silent-rules verbose build output (undo: `make V=0')])
case $enable_silent_rules in
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
[AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
AC_CACHE_CHECK([whether $am_make supports nested variables],
[am_cv_make_support_nested_variables],
[if AS_ECHO([['TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
# Copyright (C) 2001-2012 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
# serial 2
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
# will honor the 'STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -955,18 +1052,18 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2004-2012 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_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
@ -977,10 +1074,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
@ -988,7 +1086,7 @@ AC_MSG_CHECKING([how to create a $1 tar archive])
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
# Solaris sh will not grok spaces in the rhs of '-'.
for _am_tool in $_am_tools
do
case $_am_tool in

270
opal/mca/hwloc/hwloc151/hwloc/config/ar-lib Исполняемый файл
Просмотреть файл

@ -0,0 +1,270 @@
#! /bin/sh
# Wrapper for Microsoft lib.exe
me=ar-lib
scriptversion=2012-03-01.08; # UTC
# Copyright (C) 2010-2012 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# 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>.
# func_error message
func_error ()
{
echo "$me: $1" 1>&2
exit 1
}
file_conv=
# func_file_conv build_file
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts.
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 in
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_at_file at_file operation archive
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
# for each of them.
# When interpreting the content of the @FILE, do NOT use func_file_conv,
# since the user would need to supply preconverted file names to
# binutils ar, at least for MinGW.
func_at_file ()
{
operation=$2
archive=$3
at_file_contents=`cat "$1"`
eval set x "$at_file_contents"
shift
for member
do
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
done
}
case $1 in
'')
func_error "no command. Try '$0 --help' for more information."
;;
-h | --h*)
cat <<EOF
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
Members may be specified in a file named with @FILE.
EOF
exit $?
;;
-v | --v*)
echo "$me, version $scriptversion"
exit $?
;;
esac
if test $# -lt 3; then
func_error "you must specify a program, an action and an archive"
fi
AR=$1
shift
while :
do
if test $# -lt 2; then
func_error "you must specify a program, an action and an archive"
fi
case $1 in
-lib | -LIB \
| -ltcg | -LTCG \
| -machine* | -MACHINE* \
| -subsystem* | -SUBSYSTEM* \
| -verbose | -VERBOSE \
| -wx* | -WX* )
AR="$AR $1"
shift
;;
*)
action=$1
shift
break
;;
esac
done
orig_archive=$1
shift
func_file_conv "$orig_archive"
archive=$file
# strip leading dash in $action
action=${action#-}
delete=
extract=
list=
quick=
replace=
index=
create=
while test -n "$action"
do
case $action in
d*) delete=yes ;;
x*) extract=yes ;;
t*) list=yes ;;
q*) quick=yes ;;
r*) replace=yes ;;
s*) index=yes ;;
S*) ;; # the index is always updated implicitly
c*) create=yes ;;
u*) ;; # TODO: don't ignore the update modifier
v*) ;; # TODO: don't ignore the verbose modifier
*)
func_error "unknown action specified"
;;
esac
action=${action#?}
done
case $delete$extract$list$quick$replace,$index in
yes,* | ,yes)
;;
yesyes*)
func_error "more than one action specified"
;;
*)
func_error "no action specified"
;;
esac
if test -n "$delete"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
for member
do
case $1 in
@*)
func_at_file "${1#@}" -REMOVE "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
;;
esac
done
elif test -n "$extract"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
if test $# -gt 0; then
for member
do
case $1 in
@*)
func_at_file "${1#@}" -EXTRACT "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
;;
esac
done
else
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
fi
elif test -n "$quick$replace"; then
if test ! -f "$orig_archive"; then
if test -z "$create"; then
echo "$me: creating $orig_archive"
fi
orig_archive=
else
orig_archive=$archive
fi
for member
do
case $1 in
@*)
func_file_conv "${1#@}"
set x "$@" "@$file"
;;
*)
func_file_conv "$1"
set x "$@" "$file"
;;
esac
shift
shift
done
if test -n "$orig_archive"; then
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
else
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
fi
elif test -n "$list"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
$AR -NOLOGO -LIST "$archive" || exit $?
fi

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

@ -1,10 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2010-11-15.09; # UTC
scriptversion=2012-03-05.13; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@ -40,7 +39,7 @@ 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
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
@ -79,6 +78,48 @@ func_file_conv ()
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
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
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
@ -94,7 +135,7 @@ func_cl_wrapper ()
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
@ -109,43 +150,34 @@ func_cl_wrapper ()
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-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"
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-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"
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
@ -196,19 +228,19 @@ eat=
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
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
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'.
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
@ -233,8 +265,8 @@ do
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.
# 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)
@ -261,10 +293,10 @@ do
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# 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
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
@ -273,7 +305,7 @@ fi
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
# 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

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

@ -2,9 +2,9 @@
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2011-11-11'
timestamp='2012-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -17,9 +17,7 @@ timestamp='2011-11-11'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# 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
@ -57,8 +55,8 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -145,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@ -863,6 +861,13 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@ -897,16 +902,16 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo hexagon-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
@ -948,7 +953,7 @@ EOF
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
@ -989,7 +994,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -1251,7 +1256,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@ -1320,6 +1325,9 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

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

@ -2,9 +2,9 @@
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2011-11-11'
timestamp='2012-04-18'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,9 +21,7 @@ timestamp='2011-11-11'
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# 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
@ -76,8 +74,8 @@ version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -132,6 +130,10 @@ case $maybe_os in
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@ -223,6 +225,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
@ -247,6 +255,7 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
@ -319,8 +328,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -333,7 +341,10 @@ case $basic_machine in
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
@ -356,6 +367,7 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
@ -719,7 +731,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@ -1532,6 +1543,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
@ -1559,9 +1573,6 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout

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

@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2011-12-04.11; # UTC
scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# Copyright (C) 1999-2012 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
@ -28,7 +27,7 @@ scriptversion=2011-12-04.11; # UTC
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
@ -40,8 +39,8 @@ as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
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.
@ -57,6 +56,12 @@ EOF
;;
esac
# A tabulation character.
tab=' '
# A newline character.
nl='
'
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
@ -102,6 +107,12 @@ if test "$depmode" = msvc7msys; then
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@ -156,15 +167,14 @@ gcc)
## 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.
## 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
tr ' ' "$nl" < "$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.
@ -203,18 +213,15 @@ sgi)
# 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
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
@ -226,10 +233,17 @@ sgi)
rm -f "$tmpdepfile"
;;
xlc)
# 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
;;
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
# 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|/[^/]*$|/|'`
@ -259,12 +273,11 @@ aix)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# 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:'.
# '$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"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -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
@ -275,23 +288,26 @@ aix)
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
# However on
# $CC -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:
# 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 \ :
# and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
# tcc 0.9.26 (FIXME still under development at the moment of writing)
# will emit a similar output, but also prepend the continuation lines
# with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
@ -300,15 +316,21 @@ icc)
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 \'.
# 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"
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
< "$tmpdepfile" > "$depfile"
sed '
s/[ '"$tab"'][ '"$tab"']*/ /g
s/^ *//
s/ *\\*$//
s/^[^:]*: *//
/^$/d
/:$/d
s/$/ :/
' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
@ -344,7 +366,7 @@ hp2)
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
@ -359,9 +381,9 @@ hp2)
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'.
# 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.
# 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=
@ -407,8 +429,7 @@ tru64)
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"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@ -443,11 +464,11 @@ msvc7)
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/ \1 \\/p
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/ /
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
@ -478,7 +499,7 @@ dashmstdout)
shift
fi
# Remove `-o $object'.
# Remove '-o $object'.
IFS=" "
for arg
do
@ -498,15 +519,14 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# 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.
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
tr ' ' "$nl" < "$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"
@ -562,8 +582,7 @@ makedepend)
# 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 ' ' '
' | \
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## 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"
@ -583,7 +602,7 @@ cpp)
shift
fi
# Remove `-o $object'.
# Remove '-o $object'.
IFS=" "
for arg
do
@ -652,8 +671,8 @@ msvisualcpp)
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::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;

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

@ -1,6 +1,6 @@
dnl -*- Autoconf -*-
dnl
dnl Copyright (c) 2009-2010 inria. All rights reserved.
dnl Copyright © 2009-2012 Inria. All rights reserved.
dnl Copyright (c) 2009-2012 Université Bordeaux 1
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
@ -230,7 +230,7 @@ EOF])
#
AC_MSG_CHECKING([which CPU support to include])
case ${target} in
i*86-*-*|x86_64-*-*)
i*86-*-*|x86_64-*-*|amd64-*-*)
case ${ac_cv_sizeof_void_p} in
4)
AC_DEFINE(HWLOC_X86_32_ARCH, 1, [Define to 1 on x86_32])
@ -316,6 +316,10 @@ EOF])
#
# Now detect support
#
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([strings.h])
hwloc_strncasecmp=strncmp
AC_CHECK_FUNCS([strncasecmp], [
@ -507,9 +511,9 @@ EOF])
dnl We can't use AC_TRY_LINK because the failure does not appear until
dnl run/load time and there is currently no precedent for AC_TRY_RUN
dnl use in hwloc. --PHH
dnl For now, we're going with "all gccfss compilers are broken".
dnl Better to be safe and correct; it's not like this is
dnl performance-critical code, after all.
dnl For now, we're going with "all gccfss compilers are broken".
dnl Better to be safe and correct; it's not like this is
dnl performance-critical code, after all.
AC_DEFINE([HWLOC_HAVE_BROKEN_FFS], [1],
[Define to 1 if your `ffs' function is known to be broken.])
fi
@ -570,6 +574,7 @@ EOF])
]])
AC_CHECK_FUNC([sched_setaffinity], [hwloc_have_sched_setaffinity=yes])
AC_CHECK_HEADERS([sys/cpuset.h],,,[[#include <sys/param.h>]])
AC_CHECK_FUNCS([cpuset_setaffinity])
AC_SEARCH_LIBS([pthread_getthrds_np], [pthread],
AC_DEFINE([HWLOC_HAVE_PTHREAD_GETTHRDS_NP], 1, `Define to 1 if you have pthread_getthrds_np')
)
@ -805,6 +810,8 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[
[test "x$hwloc_have_linux_libnuma" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_SCHED_SETAFFINITY],
[test "x$hwloc_have_sched_setaffinity" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_PTHREAD],
[test "x$hwloc_have_pthread" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_LIBIBVERBS],
[test "x$hwloc_have_libibverbs" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_CUDA],
@ -813,7 +820,8 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[
[test "x$hwloc_have_myriexpress" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_CUDART],
[test "x$hwloc_have_cudart" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_CAIRO], [test "x$enable_cairo" != "xno"])
AM_CONDITIONAL([HWLOC_HAVE_LIBXML2], [test "$hwloc_libxml2_happy" = "yes"])
AM_CONDITIONAL([HWLOC_HAVE_CAIRO], [test "$hwloc_cairo_happy" = "yes"])
AM_CONDITIONAL([HWLOC_HAVE_LIBPCI], [test "$hwloc_pci_happy" = "yes"])
AM_CONDITIONAL([HWLOC_HAVE_SET_MEMPOLICY], [test "x$enable_set_mempolicy" != "xno"])
AM_CONDITIONAL([HWLOC_HAVE_MBIND], [test "x$enable_mbind" != "xno"])
@ -839,10 +847,10 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[
AM_CONDITIONAL([HWLOC_HAVE_X86_32], [test "x$hwloc_x86_32" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_X86_64], [test "x$hwloc_x86_64" = "xyes"])
AM_CONDITIONAL([HWLOC_DOXYGEN_BROKEN_SHORT_NAMES], [test "$HWLOC_DOXYGEN_VERSION" = "1.6.2"])
AM_CONDITIONAL([HWLOC_HAVE_CPUID], [test "x$hwloc_have_cpuid" = "xyes"])
AM_CONDITIONAL([HWLOC_BUILD_UTILS], [test "$hwloc_build_utils" = "yes"])
AM_CONDITIONAL([HWLOC_BUILD_TESTS], [test "$hwloc_build_tests" = "yes"])
AM_CONDITIONAL([HWLOC_HAVE_CXX], [test "x$hwloc_have_cxx" = "xyes"])
])
hwloc_did_am_conditionals=yes
])dnl

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

@ -117,6 +117,8 @@ EOF
AS_IF([test "x$DOXYGEN" != "x" -a "x$PDFLATEX" != "x" -a "x$MAKEINDEX" != "x" -a "x$FIG2DEV" != "x" -a "x$GS" != "x" -a "x$EPSTOPDF" != "x"],
[hwloc_generate_doxs=yes], [hwloc_generate_doxs=no])
AC_MSG_RESULT([$hwloc_generate_doxs])
AS_IF([test "x$hwloc_generate_doxs" = xyes -a "x$HWLOC_DOXYGEN_VERSION" = x1.6.2],
[hwloc_generate_doxs="no"; AC_MSG_WARN([doxygen 1.6.2 has broken short name support, disabling])])
# Linux and OS X take different sed arguments.
AC_PROG_SED
@ -199,7 +201,7 @@ EOF
add="$add -Wmissing-prototypes -Wstrict-prototypes"
add="$add -Wcomment -pedantic"
CFLAGS="$CFLAGS $add"
HWLOC_CFLAGS="$HWLOC_CFLAGS $add"
fi
# Generate some files for the docs
@ -222,7 +224,7 @@ EOF
hwloc_build_utils=yes
# Cairo support
hwloc_cairo_happy=
hwloc_cairo_happy=no
if test "x$enable_cairo" != "xno"; then
HWLOC_PKG_CHECK_MODULES([CAIRO], [cairo], [cairo_fill],
[hwloc_cairo_happy=yes],
@ -266,9 +268,12 @@ EOF
AC_CHECK_FUNCS([putwc])
], [], [[#include <wchar.h>]])
AC_CHECK_HEADERS([locale.h], [
HWLOC_XML_LOCALIZED=1
AC_CHECK_HEADERS([locale.h xlocale.h], [
AC_CHECK_FUNCS([setlocale])
AC_CHECK_FUNCS([uselocale], [HWLOC_XML_LOCALIZED=0])
])
AC_SUBST([HWLOC_XML_LOCALIZED])
AC_CHECK_HEADERS([langinfo.h], [
AC_CHECK_FUNCS([nl_langinfo])
])
@ -325,6 +330,8 @@ EOF
hwloc_build_tests=yes
AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
# linux-libnuma.h testing requires libnuma with numa_bitmask_alloc()
AC_CHECK_DECL([numa_bitmask_alloc], [hwloc_have_linux_libnuma=yes], [],
[#include <numa.h>])
@ -379,6 +386,19 @@ EOF
AC_CHECK_PROGS(BUNZIPP, bunzip2, false)
AC_MSG_CHECKING(if CXX works)
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream>
using namespace std;
int foo(void) {
cout << "test" << endl;
return 0;
}
]])], [hwloc_have_cxx=yes], [hwloc_have_cxx=no])
AC_LANG_POP([C++])
AC_MSG_RESULT([$hwloc_have_cxx])
_HWLOC_CHECK_DIFF_U
# Only generate these files if we're making the tests
@ -409,9 +429,6 @@ EOF
# built in standalone mode, only generate them in
# standalone mode.
AC_CONFIG_LINKS(
hwloc_config_prefix[tests/ports/topology.c]:hwloc_config_prefix[src/topology.c]
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]

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

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
# 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
# '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
@ -156,7 +156,7 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@ -202,7 +202,7 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
@ -240,7 +240,7 @@ fi
for src
do
# Protect names problematic for `test' and other utilities.
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
@ -354,7 +354,7 @@ do
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.
# other-writable 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

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

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

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

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

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

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

@ -1,10 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
scriptversion=2012-01-06.18; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Copyright (C) 1996-2012 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
@ -26,7 +25,7 @@ scriptversion=2009-04-28.21; # UTC
# 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"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
@ -34,7 +33,7 @@ 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
# In the cases where this matters, 'missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
@ -65,7 +64,7 @@ case $1 in
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
@ -74,21 +73,20 @@ Options:
--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'
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
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
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]
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.
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 $?
@ -100,8 +98,8 @@ Send bug reports to <bug-automake@gnu.org>."
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
echo 1>&2 "$0: Unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
@ -122,22 +120,13 @@ case $1 in
# 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
# running '$TOOL --version' or '$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
@ -149,27 +138,27 @@ esac
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
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
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
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"
@ -186,9 +175,9 @@ WARNING: \`$1' is $msg. You should only need it if
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.
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/' |
@ -197,10 +186,10 @@ WARNING: \`$1' is $msg. You should only need it if
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
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
You can get '$1' as part of Autoconf from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
@ -220,13 +209,13 @@ WARNING: \`$1' is needed, but is $msg.
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
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."
Bison from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@ -250,13 +239,13 @@ WARNING: \`$1' $msg. You should only need it if
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
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."
Flex from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@ -273,10 +262,10 @@ WARNING: \`$1' is $msg. You should only need it if
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
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."
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"`
@ -291,12 +280,12 @@ WARNING: \`$1' is $msg. You should only need it if
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
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."
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"`
@ -318,49 +307,14 @@ WARNING: \`$1' is $msg. You should only need it if
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.
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,
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."
some other package would contain this missing '$1' program."
exit 1
;;
esac

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

@ -42,6 +42,7 @@ m4_ifdef([LT_PREREQ], [],
LT_PREREQ([2.2.6])
AC_LANG([C])
AC_USE_SYSTEM_EXTENSIONS
# Make configure depend on the VERSION file, since it's used in AC_INIT
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
@ -85,7 +86,7 @@ AC_SUBST([libhwloc_so_version])
# Setup the header file
AH_TOP([/* -*- c -*-
*
* Copyright © 2009 CNRS, inria., Université Bordeaux 1 All rights reserved.
* Copyright © 2009, 2012 CNRS, inria., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -108,8 +109,17 @@ AH_BOTTOM([
CFLAGS_save="$CFLAGS"
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
CFLAGS="$CFLAGS_save"
# This did not exist pre AM 1.11.x (where x is somewhere >0 and <3),
# but it is necessary in AM 1.12.x.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
AS_IF([test -z "$CC_FOR_BUILD"],[
AC_SUBST([CC_FOR_BUILD], [$CC])
])
# Define hwloc's configure arguments
HWLOC_DEFINE_ARGS

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

@ -12,7 +12,6 @@ include_HEADERS = hwloc.h
include_hwlocdir = $(includedir)/hwloc
include_hwloc_HEADERS = \
hwloc/bitmap.h \
hwloc/cpuset.h \
hwloc/helper.h \
hwloc/myriexpress.h \
hwloc/openfabrics-verbs.h \
@ -26,6 +25,7 @@ noinst_HEADERS = \
private/private.h \
private/debug.h \
private/misc.h \
private/xml.h \
private/cpuid.h
if HWLOC_HAVE_LINUX

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

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -62,7 +62,6 @@
*/
#include <hwloc/bitmap.h>
#include <hwloc/cpuset.h>
#ifdef __cplusplus
@ -75,7 +74,7 @@ extern "C" {
*/
/** \brief Indicate at build time which hwloc API version is being used. */
#define HWLOC_API_VERSION 0x00010400
#define HWLOC_API_VERSION 0x00010500
/** \brief Indicate at runtime which hwloc API version was used at build time. */
HWLOC_DECLSPEC unsigned hwloc_get_api_version(void);
@ -189,8 +188,8 @@ typedef enum {
* In the physical meaning, i.e. that you can add
* or remove physically.
*/
HWLOC_OBJ_CACHE, /**< \brief Data cache.
* Can be L1, L2, L3, ...
HWLOC_OBJ_CACHE, /**< \brief Cache.
* Can be L1i, L1d, L2, L3, ...
*/
HWLOC_OBJ_CORE, /**< \brief Core.
* A computation unit (may be shared by several
@ -252,6 +251,14 @@ typedef enum {
*************************************************************** */
} hwloc_obj_type_t;
/** \brief Cache type. */
typedef enum hwloc_obj_cache_type_e {
HWLOC_OBJ_CACHE_UNIFIED, /**< \brief Unified cache. */
HWLOC_OBJ_CACHE_DATA, /**< \brief Data cache. */
HWLOC_OBJ_CACHE_INSTRUCTION /**< \brief Instruction cache.
* Only used when the HWLOC_TOPOLOGY_FLAG_ICACHES topology flag is set. */
} hwloc_obj_cache_type_t;
/** \brief Type of one side (upstream or downstream) of an I/O bridge. */
typedef enum hwloc_obj_bridge_type_e {
HWLOC_OBJ_BRIDGE_HOST, /**< \brief Host-side of a bridge, only possible upstream. */
@ -478,6 +485,7 @@ union hwloc_obj_attr_u {
unsigned linesize; /**< \brief Cache-line size in bytes */
int associativity; /**< \brief Ways of associativity,
* -1 if fully associative, 0 if unknown */
hwloc_obj_cache_type_t type; /**< \brief Cache type */
} cache;
/** \brief Group-specific Object Attributes */
struct hwloc_group_attr_s {
@ -716,12 +724,22 @@ enum hwloc_topology_flags_e {
* and bridges (even those that have no device behind them) using the libpci
* backend.
*/
HWLOC_TOPOLOGY_FLAG_WHOLE_IO = (1<<4)
HWLOC_TOPOLOGY_FLAG_WHOLE_IO = (1<<4),
/** \brief Detect instruction caches.
*
* This flag enables detection of Instruction caches,
* instead of only Data and Unified caches.
*/
HWLOC_TOPOLOGY_FLAG_ICACHES = (1<<5)
};
/** \brief Set OR'ed flags to non-yet-loaded topology.
*
* Set a OR'ed set of ::hwloc_topology_flags_e onto a topology that was not yet loaded.
*
* If this function is called multiple times, the last invokation will erase
* and replace the set of flags that was previously set.
*/
HWLOC_DECLSPEC int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags);
@ -966,6 +984,10 @@ HWLOC_DECLSPEC const struct hwloc_topology_support *hwloc_topology_get_support(h
* This file may be loaded later through hwloc_topology_set_xml().
*
* \return -1 if a failure occured.
*
* \note Only printable characters may be exported to XML string attributes.
* Any other character, especially any non-ASCII character, will be silently
* dropped.
*/
HWLOC_DECLSPEC int hwloc_topology_export_xml(hwloc_topology_t topology, const char *xmlpath);
@ -977,6 +999,10 @@ HWLOC_DECLSPEC int hwloc_topology_export_xml(hwloc_topology_t topology, const ch
* This memory buffer may be loaded later through hwloc_topology_set_xmlbuffer().
*
* \return -1 if a failure occured.
*
* \note Only printable characters may be exported to XML string attributes.
* Any other character, especially any non-ASCII character, will be silently
* dropped.
*/
HWLOC_DECLSPEC int hwloc_topology_export_xmlbuffer(hwloc_topology_t topology, char **xmlbuffer, int *buflen);
@ -993,6 +1019,9 @@ HWLOC_DECLSPEC void hwloc_free_xmlbuffer(hwloc_topology_t topology, char *xmlbuf
*
* \return the newly-created object.
* \return \c NULL if the insertion conflicts with the existing topology tree.
*
* \note If \p name contains some non-printable characters, they will
* be dropped when exporting to XML, see hwloc_topology_export_xml().
*/
HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object_by_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, const char *name);
@ -1007,6 +1036,9 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object_by_cpuset(hwloc_top
* However, the new leaf object will not have any \p cpuset.
*
* \return the newly-created object
*
* \note If \p name contains some non-printable characters, they will
* be dropped when exporting to XML, see hwloc_topology_export_xml().
*/
HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name);
@ -1071,8 +1103,11 @@ HWLOC_DECLSPEC unsigned hwloc_topology_get_depth(hwloc_topology_t __hwloc_restri
* If type is absent but a similar type is acceptable, see also
* hwloc_get_type_or_below_depth() and hwloc_get_type_or_above_depth().
*
* If some objects of the given type exist in different levels, for instance
* L1 and L2 caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE.
* If some objects of the given type exist in different levels,
* for instance L1 and L2 caches, or L1i and L1d caches,
* the function returns HWLOC_TYPE_DEPTH_MULTIPLE.
* See hwloc_get_cache_type_depth() in hwloc/helper.h to better handle this
* case.
*
* If an I/O object type is given, the function returns a virtual value
* because I/O objects are stored in special levels that are not CPU-related.
@ -1183,7 +1218,7 @@ HWLOC_DECLSPEC hwloc_obj_type_t hwloc_obj_type_of_string (const char * string) _
/** \brief Stringify the type of a given topology object into a human-readable form.
*
* It differs from hwloc_obj_type_string() because it prints type attributes such
* as cache depth.
* as cache depth and type.
*
* If \p size is 0, \p string may safely be \c NULL.
*
@ -1264,6 +1299,9 @@ hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name)
* with the same name already exists.
*
* The input strings are copied before being added in the object infos.
*
* \note If \p value contains some non-printable characters, they will
* be dropped when exporting to XML, see hwloc_topology_export_xml().
*/
HWLOC_DECLSPEC void hwloc_obj_add_info(hwloc_obj_t obj, const char *name, const char *value);
@ -1444,6 +1482,12 @@ HWLOC_DECLSPEC int hwloc_get_thread_cpubind(hwloc_topology_t topology, hwloc_thr
* to another at any time according to their binding,
* so this function may return something that is already
* outdated.
*
* \p flags can include either HWLOC_CPUBIND_PROCESS or HWLOC_CPUBIND_THREAD to
* specify whether the query should be for the whole process (union of all CPUs
* on which all threads are running), or only the current thread. If the
* process is single-threaded, flags can be set to zero to let hwloc use
* whichever method is available on the underlying OS.
*/
HWLOC_DECLSPEC int hwloc_get_last_cpu_location(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
@ -1457,11 +1501,9 @@ HWLOC_DECLSPEC int hwloc_get_last_cpu_location(hwloc_topology_t topology, hwloc_
* \note \p hwloc_pid_t is \p pid_t on Unix platforms,
* and \p HANDLE on native Windows platforms.
*
* \note HWLOC_CPUBIND_THREAD can not be used in \p flags.
*
* \note As a special case on Linux, if a tid (thread ID) is supplied
* instead of a pid (process ID), the binding for that specific thread
* is returned.
* instead of a pid (process ID) and HWLOC_CPUBIND_THREAD is passed in flags,
* the binding for that specific thread is returned.
*/
HWLOC_DECLSPEC int hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags);
@ -1471,10 +1513,18 @@ HWLOC_DECLSPEC int hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, h
/** \defgroup hwlocality_membinding Memory binding
*
* \note Not all operating systems support all ways to bind existing
* allocated memory (e.g., migration), future memory allocation,
* explicit memory allocation, etc. Using a binding flag or policy
* that is not supported by the underlying OS will cause hwloc's
* Memory binding can be done three ways:
*
* - explicit memory allocation thanks to hwloc_alloc_membind and friends: the
* binding will have effect on the memory allocated by these functions.
* - implicit memory binding through binding policy: hwloc_set_membind and
* friends only define the current policy of the process, which will be
* applied to the subsequent calls to malloc() and friends.
* - migration of existing memory ranges, thanks to hwloc_set_area_membind()
* and friends, which move already-allocated data.
*
* \note Not all operating systems support all three ways Using a binding flag
* or policy that is not supported by the underlying OS will cause hwloc's
* binding functions to fail and return -1. errno will be set to
* ENOSYS when the system does support the specified action or policy
* (e.g., some systems only allow binding memory on a per-thread

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

@ -0,0 +1,189 @@
/* opal/mca/hwloc/hwloc151/hwloc/include/hwloc/autogen/config.h. Generated from config.h.in by configure. */
/* -*- c -*-
* Copyright © 2009 CNRS
* Copyright © 2009-2010 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* The configuration file */
#ifndef HWLOC_CONFIG_H
#define HWLOC_CONFIG_H
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define __hwloc_restrict __restrict
#else
# if __STDC_VERSION__ >= 199901L
# define __hwloc_restrict restrict
# else
# define __hwloc_restrict
# endif
#endif
/* Note that if we're compiling C++, then just use the "inline"
keyword, since it's part of C++ */
#if defined(c_plusplus) || defined(__cplusplus)
# define __hwloc_inline inline
#elif defined(_MSC_VER) || defined(__HP_cc)
# define __hwloc_inline __inline
#else
# define __hwloc_inline __inline__
#endif
/*
* Note: this is public. We can not assume anything from the compiler used
* by the application and thus the HWLOC_HAVE_* macros below are not
* fetched from the autoconf result here. We only automatically use a few
* 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 (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __HWLOC_HAVE_ATTRIBUTE_UNUSED 0
#endif
#if __HWLOC_HAVE_ATTRIBUTE_UNUSED
# define __hwloc_attribute_unused __attribute__((__unused__))
#else
# define __hwloc_attribute_unused
#endif
#ifdef HWLOC_HAVE_ATTRIBUTE_MALLOC
#define __HWLOC_HAVE_ATTRIBUTE_MALLOC HWLOC_HAVE_ATTRIBUTE_MALLOC
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_MALLOC (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __HWLOC_HAVE_ATTRIBUTE_MALLOC 0
#endif
#if __HWLOC_HAVE_ATTRIBUTE_MALLOC
# define __hwloc_attribute_malloc __attribute__((__malloc__))
#else
# define __hwloc_attribute_malloc
#endif
#ifdef HWLOC_HAVE_ATTRIBUTE_CONST
#define __HWLOC_HAVE_ATTRIBUTE_CONST HWLOC_HAVE_ATTRIBUTE_CONST
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_CONST (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __HWLOC_HAVE_ATTRIBUTE_CONST 0
#endif
#if __HWLOC_HAVE_ATTRIBUTE_CONST
# define __hwloc_attribute_const __attribute__((__const__))
#else
# define __hwloc_attribute_const
#endif
#ifdef HWLOC_HAVE_ATTRIBUTE_PURE
#define __HWLOC_HAVE_ATTRIBUTE_PURE HWLOC_HAVE_ATTRIBUTE_PURE
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_PURE (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __HWLOC_HAVE_ATTRIBUTE_PURE 0
#endif
#if __HWLOC_HAVE_ATTRIBUTE_PURE
# define __hwloc_attribute_pure __attribute__((__pure__))
#else
# define __hwloc_attribute_pure
#endif
#ifdef HWLOC_HAVE_ATTRIBUTE_DEPRECATED
#define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED HWLOC_HAVE_ATTRIBUTE_DEPRECATED
#elif defined(__GNUC__)
# define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED (GXX_ABOVE_3_4 || GCC_ABOVE_3_3)
#else
# define __HWLOC_HAVE_ATTRIBUTE_DEPRECATED 0
#endif
#if __HWLOC_HAVE_ATTRIBUTE_DEPRECATED
# define __hwloc_attribute_deprecated __attribute__((__deprecated__))
#else
# define __hwloc_attribute_deprecated
#endif
#ifdef HWLOC_C_HAVE_VISIBILITY
# if HWLOC_C_HAVE_VISIBILITY
# define HWLOC_DECLSPEC __attribute__((__visibility__("default")))
# else
# define HWLOC_DECLSPEC
# endif
#else
# define HWLOC_DECLSPEC
#endif
/* Defined to 1 on Linux */
#define HWLOC_LINUX_SYS 1
/* Defined to 1 if the CPU_SET macro works */
#define HWLOC_HAVE_CPU_SET 1
/* Defined to 1 if you have the `windows.h' header. */
/* #undef HWLOC_HAVE_WINDOWS_H */
#define hwloc_pid_t pid_t
#define hwloc_thread_t pthread_t
#ifdef HWLOC_HAVE_WINDOWS_H
# include <windows.h>
typedef DWORDLONG hwloc_uint64_t;
#else /* HWLOC_HAVE_WINDOWS_H */
# ifdef hwloc_thread_t
# include <pthread.h>
# endif /* hwloc_thread_t */
/* Defined to 1 if you have the <stdint.h> header file. */
# define HWLOC_HAVE_STDINT_H 1
# include <unistd.h>
# ifdef HWLOC_HAVE_STDINT_H
# include <stdint.h>
# endif
typedef uint64_t hwloc_uint64_t;
#endif /* HWLOC_HAVE_WINDOWS_H */
/* Whether we need to re-define all the hwloc public symbols or not */
#define HWLOC_SYM_TRANSFORM 1
/* The hwloc symbol prefix */
#define HWLOC_SYM_PREFIX opal_hwloc151_
/* The hwloc symbol prefix in all caps */
#define HWLOC_SYM_PREFIX_CAPS OPAL_HWLOC151_
#endif /* HWLOC_CONFIG_H */

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

@ -0,0 +1 @@
timestamp for opal/mca/hwloc/hwloc151/hwloc/include/hwloc/autogen/config.h

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

@ -0,0 +1 @@
timestamp for opal/mca/hwloc/hwloc151/hwloc/include/hwloc/autogen/config.h

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

@ -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-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -281,19 +281,34 @@ do { \
* Combining bitmaps.
*/
/** \brief Or bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
/** \brief Or bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
*
* \p res can be the same as \p bitmap1 or \p bitmap2
*/
HWLOC_DECLSPEC void hwloc_bitmap_or (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
/** \brief And bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
/** \brief And bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
*
* \p res can be the same as \p bitmap1 or \p bitmap2
*/
HWLOC_DECLSPEC void hwloc_bitmap_and (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
/** \brief And bitmap \p bitmap1 and the negation of \p bitmap2 and store the result in bitmap \p res */
/** \brief And bitmap \p bitmap1 and the negation of \p bitmap2 and store the result in bitmap \p res
*
* \p res can be the same as \p bitmap1 or \p bitmap2
*/
HWLOC_DECLSPEC void hwloc_bitmap_andnot (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
/** \brief Xor bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
/** \brief Xor bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
*
* \p res can be the same as \p bitmap1 or \p bitmap2
*/
HWLOC_DECLSPEC void hwloc_bitmap_xor (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
/** \brief Negate bitmap \p bitmap and store the result in bitmap \p res */
/** \brief Negate bitmap \p bitmap and store the result in bitmap \p res
*
* \p res can be the same as \p bitmap
*/
HWLOC_DECLSPEC void hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap);

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

@ -88,6 +88,11 @@ hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domainid, &busid, &deviceid))
return -1;
if (!hwloc_topology_is_thissystem(topology)) {
errno = EINVAL;
return -1;
}
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domainid, busid, deviceid);
sysfile = fopen(path, "r");
if (!sysfile)

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

@ -84,6 +84,11 @@ hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
if (hwloc_cudart_get_device_pci_ids(topology, device, &domain, &bus, &dev))
return -1;
if (!hwloc_topology_is_thissystem(topology)) {
errno = EINVAL;
return -1;
}
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domain, bus, dev);
sysfile = fopen(path, "r");
if (!sysfile)

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -578,6 +578,55 @@ hwloc_get_next_obj_covering_cpuset_by_type(hwloc_topology_t topology, hwloc_cons
* @{
*/
/** \brief Find the depth of cache objects matching cache depth and type.
*
* Return the depth of the topology level that contains cache objects
* whose attributes match \p cachedepth and \p cachetype. This function
* intends to disambiguate the case where hwloc_get_type_depth() returns
* \p HWLOC_TYPE_DEPTH_MULTIPLE.
*
* If no cache level matches, \p HWLOC_TYPE_DEPTH_UNKNOWN is returned.
*
* If \p cachetype is \p HWLOC_OBJ_CACHE_UNIFIED, the depth of the
* unique matching unified cache level is returned.
*
* If \p cachetype is \p HWLOC_OBJ_CACHE_DATA or \p HWLOC_OBJ_CACHE_INSTRUCTION,
* either a matching cache, or a unified cache is returned.
*
* If \p cachetype is \c -1, it is ignored and multiple levels may
* match. The function returns either the depth of a uniquely matching
* level or \p HWLOC_TYPE_DEPTH_MULTIPLE.
*/
static __hwloc_inline int
hwloc_get_cache_type_depth (hwloc_topology_t topology,
unsigned cachelevel, hwloc_obj_cache_type_t cachetype)
{
int depth;
int found = HWLOC_TYPE_DEPTH_UNKNOWN;
for (depth=0; ; depth++) {
hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, depth, 0);
if (!obj)
break;
if (obj->type != HWLOC_OBJ_CACHE || obj->attr->cache.depth != cachelevel)
/* doesn't match, try next depth */
continue;
if (cachetype == (hwloc_obj_cache_type_t) -1) {
if (found != HWLOC_TYPE_DEPTH_UNKNOWN) {
/* second match, return MULTIPLE */
return HWLOC_TYPE_DEPTH_MULTIPLE;
}
/* first match, mark it as found */
found = depth;
continue;
}
if (obj->attr->cache.type == cachetype || obj->attr->cache.type == HWLOC_OBJ_CACHE_UNIFIED)
/* exact match (either unified is alone, or we match instruction or data), return immediately */
return depth;
}
/* went to the bottom, return what we found */
return found;
}
/** \brief Get the first cache covering a cpuset \p set
*
* \return \c NULL if no cache matches.

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

@ -63,7 +63,7 @@ hwloc_cpuset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_cpus
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_covering_cpuset_by_type(topology, cpuset, HWLOC_OBJ_NODE, node)) != NULL) {
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL) {
if (node->os_index >= *maxnode)
continue;
mask[node->os_index/sizeof(*mask)/8] |= 1UL << (node->os_index % (sizeof(*mask)*8));
@ -106,7 +106,7 @@ hwloc_nodeset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_nod
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NODE, node)) != NULL) {
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL) {
if (node->os_index >= *maxnode)
continue;
if (!hwloc_bitmap_isset(nodeset, node->os_index))
@ -224,7 +224,7 @@ hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpu
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_covering_cpuset_by_type(topology, cpuset, HWLOC_OBJ_NODE, node)) != NULL)
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL)
if (node->memory.local_memory)
numa_bitmask_setbit(bitmask, node->os_index);
} else {
@ -257,7 +257,7 @@ hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_no
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NODE, node)) != NULL)
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
if (hwloc_bitmap_isset(nodeset, node->os_index) && node->memory.local_memory)
numa_bitmask_setbit(bitmask, node->os_index);
} else {
@ -328,132 +328,6 @@ 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.
*
* @{
*/
/** \brief Convert hwloc CPU set \p cpuset into libnuma nodemask \p nodemask
*
* This function may be used before calling some old libnuma functions
* that use a nodemask_t as an input parameter.
*/
static __hwloc_inline int
hwloc_cpuset_to_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset,
nodemask_t *nodemask)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
nodemask_zero(nodemask);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_covering_cpuset_by_type(topology, cpuset, HWLOC_OBJ_NODE, node)) != NULL)
nodemask_set(nodemask, node->os_index);
} else {
/* if no numa, libnuma assumes we have a single node */
if (!hwloc_bitmap_iszero(cpuset))
nodemask_set(nodemask, 0);
}
return 0;
}
/** \brief Convert hwloc NUMA node set \p nodeset into libnuma nodemask \p nodemask
*
* This function may be used before calling some old libnuma functions
* that use a nodemask_t as an input parameter.
*/
static __hwloc_inline int
hwloc_nodeset_to_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset,
nodemask_t *nodemask)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
nodemask_zero(nodemask);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
while ((node = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NODE, node)) != NULL)
if (hwloc_bitmap_isset(nodeset, node->os_index))
nodemask_set(nodemask, node->os_index);
} else {
/* if no numa, libnuma assumes we have a single node */
if (!hwloc_bitmap_iszero(nodeset))
nodemask_set(nodemask, 0);
}
return 0;
}
/** \brief Convert libnuma nodemask \p nodemask into hwloc CPU set \p cpuset
*
* This function may be used before calling some old libnuma functions
* that use a nodemask_t as an output parameter.
*/
static __hwloc_inline int
hwloc_cpuset_from_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
const nodemask_t *nodemask)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(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))
hwloc_bitmap_copy(cpuset, hwloc_topology_get_complete_cpuset(topology));
else
hwloc_bitmap_zero(cpuset);
}
return 0;
}
/** \brief Convert libnuma nodemask \p nodemask into hwloc NUMA node set \p nodeset
*
* This function may be used before calling some old libnuma functions
* that use a nodemask_t as an output parameter.
*/
static __hwloc_inline int
hwloc_nodeset_from_linux_libnuma_nodemask(hwloc_topology_t topology, hwloc_nodeset_t nodeset,
const nodemask_t *nodemask)
{
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) {
hwloc_obj_t node = NULL;
hwloc_bitmap_zero(nodeset);
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))
hwloc_bitmap_fill(nodeset);
else
hwloc_bitmap_zero(nodeset);
}
return 0;
}
/** @} */
#endif /* NUMA_VERSION1_COMPATIBILITY */
#ifdef __cplusplus
} /* extern "C" */
#endif

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

@ -45,6 +45,11 @@ hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology,
{
uint32_t in, out;
if (!hwloc_topology_is_thissystem(topology)) {
errno = EINVAL;
return -1;
}
in = id;
if (mx_get_info(NULL, MX_NUMA_NODE, &in, sizeof(in), &out, sizeof(out)) != MX_SUCCESS) {
errno = EINVAL;

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

@ -56,6 +56,11 @@ hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
FILE *sysfile = NULL;
if (!hwloc_topology_is_thissystem(topology)) {
errno = EINVAL;
return -1;
}
sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
ibv_get_device_name(ibdev));
sysfile = fopen(path, "r");
@ -74,6 +79,35 @@ hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
return 0;
}
/** \brief Get the hwloc OS device object corresponding to the OpenFabrics
* device named \p ibname.
*
* For the OpenFabrics device whose name is \p ibname, return the hwloc OS
* device object describing the device. Returns NULL if there is none.
*
* The name \p ibname is usually obtained from ibv_get_device_name().
*
* IO devices detection must be enabled in topology \p topology.
*
* The topology does not necessary have to match the current machine.
* For instance the topology may be an XML import of a remote host.
*
* \note The corresponding PCI device object can be obtained by looking
* at the OS device parent object.
*/
static __hwloc_inline hwloc_obj_t
hwloc_ibv_get_device_osdev_by_name(hwloc_topology_t topology,
const char *ibname)
{
hwloc_obj_t osdev = NULL;
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
if (HWLOC_OBJ_OSDEV_OPENFABRICS == osdev->attr->osdev.type
&& osdev->name && !strcmp(ibname, osdev->name))
return osdev;
}
return NULL;
}
/** @} */

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010-2011 inria. All rights reserved.
* Copyright © 2010-2012 inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -62,6 +62,12 @@ extern "C" {
#define HWLOC_OBJ_TYPE_MAX HWLOC_NAME_CAPS(OBJ_TYPE_MAX)
#define hwloc_obj_type_t HWLOC_NAME(obj_type_t)
#define hwloc_obj_cache_type_e HWLOC_NAME(obj_cache_type_e)
#define hwloc_obj_cache_type_t HWLOC_NAME(obj_cache_type_t)
#define HWLOC_OBJ_CACHE_UNIFIED HWLOC_NAME_CAPS(OBJ_CACHE_UNIFIED)
#define HWLOC_OBJ_CACHE_DATA HWLOC_NAME_CAPS(OBJ_CACHE_DATA)
#define HWLOC_OBJ_CACHE_INSTRUCTION HWLOC_NAME_CAPS(OBJ_CACHE_INSTRUCTION)
#define hwloc_obj_bridge_type_e HWLOC_NAME(obj_bridge_type_e)
#define hwloc_obj_bridge_type_t HWLOC_NAME(obj_bridge_type_t)
#define HWLOC_OBJ_BRIDGE_HOST HWLOC_NAME_CAPS(OBJ_BRIDGE_HOST)
@ -111,6 +117,7 @@ extern "C" {
#define HWLOC_TOPOLOGY_FLAG_IO_DEVICES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_IO_DEVICES)
#define HWLOC_TOPOLOGY_FLAG_IO_BRIDGES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_IO_BRIDGES)
#define HWLOC_TOPOLOGY_FLAG_WHOLE_IO HWLOC_NAME_CAPS(TOPOLOGY_FLAG_WHOLE_IO)
#define HWLOC_TOPOLOGY_FLAG_ICACHES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_ICACHES)
#define hwloc_topology_set_flags HWLOC_NAME(topology_set_flags)
#define hwloc_topology_set_fsroot HWLOC_NAME(topology_set_fsroot)
@ -284,51 +291,6 @@ extern "C" {
#define hwloc_bitmap_compare HWLOC_NAME(bitmap_compare)
#define hwloc_bitmap_weight HWLOC_NAME(bitmap_weight)
/* hwloc/cpuset.h -- deprecated but still available */
#define hwloc_cpuset_alloc HWLOC_NAME(cpuset_alloc)
#define hwloc_cpuset_free HWLOC_NAME(cpuset_free)
#define hwloc_cpuset_dup HWLOC_NAME(cpuset_dup)
#define hwloc_cpuset_copy HWLOC_NAME(cpuset_copy)
#define hwloc_cpuset_snprintf HWLOC_NAME(cpuset_snprintf)
#define hwloc_cpuset_asprintf HWLOC_NAME(cpuset_asprintf)
#define hwloc_cpuset_from_string HWLOC_NAME(cpuset_from_string)
#define hwloc_cpuset_zero HWLOC_NAME(cpuset_zero)
#define hwloc_cpuset_fill HWLOC_NAME(cpuset_fill)
#define hwloc_cpuset_from_ulong HWLOC_NAME(cpuset_from_ulong)
#define hwloc_cpuset_taskset_snprintf HWLOC_NAME(cpuset_taskset_snprintf)
#define hwloc_cpuset_taskset_asprintf HWLOC_NAME(cpuset_taskset_asprintf)
#define hwloc_cpuset_taskset_sscanf HWLOC_NAME(cpuset_taskset_sscanf)
#define hwloc_cpuset_from_ith_ulong HWLOC_NAME(cpuset_from_ith_ulong)
#define hwloc_cpuset_to_ulong HWLOC_NAME(cpuset_to_ulong)
#define hwloc_cpuset_to_ith_ulong HWLOC_NAME(cpuset_to_ith_ulong)
#define hwloc_cpuset_cpu HWLOC_NAME(cpuset_cpu)
#define hwloc_cpuset_all_but_cpu HWLOC_NAME(cpuset_all_but_cpu)
#define hwloc_cpuset_set HWLOC_NAME(cpuset_set)
#define hwloc_cpuset_set_range HWLOC_NAME(cpuset_set_range)
#define hwloc_cpuset_set_ith_ulong HWLOC_NAME(cpuset_set_ith_ulong)
#define hwloc_cpuset_clr HWLOC_NAME(cpuset_clr)
#define hwloc_cpuset_clr_range HWLOC_NAME(cpuset_clr_range)
#define hwloc_cpuset_isset HWLOC_NAME(cpuset_isset)
#define hwloc_cpuset_iszero HWLOC_NAME(cpuset_iszero)
#define hwloc_cpuset_isfull HWLOC_NAME(cpuset_isfull)
#define hwloc_cpuset_isequal HWLOC_NAME(cpuset_isequal)
#define hwloc_cpuset_intersects HWLOC_NAME(cpuset_intersects)
#define hwloc_cpuset_isincluded HWLOC_NAME(cpuset_isincluded)
#define hwloc_cpuset_or HWLOC_NAME(cpuset_or)
#define hwloc_cpuset_and HWLOC_NAME(cpuset_and)
#define hwloc_cpuset_andnot HWLOC_NAME(cpuset_andnot)
#define hwloc_cpuset_xor HWLOC_NAME(cpuset_xor)
#define hwloc_cpuset_not HWLOC_NAME(cpuset_not)
#define hwloc_cpuset_first HWLOC_NAME(cpuset_first)
#define hwloc_cpuset_last HWLOC_NAME(cpuset_last)
#define hwloc_cpuset_next HWLOC_NAME(cpuset_next)
#define hwloc_cpuset_singlify HWLOC_NAME(cpuset_singlify)
#define hwloc_cpuset_compare_first HWLOC_NAME(cpuset_compare_first)
#define hwloc_cpuset_compare HWLOC_NAME(cpuset_compare)
#define hwloc_cpuset_weight HWLOC_NAME(cpuset_weight)
/* hwloc/helper.h */
#define hwloc_get_type_or_below_depth HWLOC_NAME(get_type_or_below_depth)
@ -351,10 +313,12 @@ extern "C" {
#define hwloc_get_obj_inside_cpuset_by_type HWLOC_NAME(get_obj_inside_cpuset_by_type)
#define hwloc_get_nbobjs_inside_cpuset_by_depth HWLOC_NAME(get_nbobjs_inside_cpuset_by_depth)
#define hwloc_get_nbobjs_inside_cpuset_by_type HWLOC_NAME(get_nbobjs_inside_cpuset_by_type)
#define hwloc_get_obj_index_inside_cpuset HWLOC_NAME(get_obj_index_inside_cpuset)
#define hwloc_get_child_covering_cpuset HWLOC_NAME(get_child_covering_cpuset)
#define hwloc_get_obj_covering_cpuset HWLOC_NAME(get_obj_covering_cpuset)
#define hwloc_get_next_obj_covering_cpuset_by_depth HWLOC_NAME(get_next_obj_covering_cpuset_by_depth)
#define hwloc_get_next_obj_covering_cpuset_by_type HWLOC_NAME(get_next_obj_covering_cpuset_by_type)
#define hwloc_get_cache_type_depth HWLOC_NAME(get_cache_type_depth)
#define hwloc_get_cache_covering_cpuset HWLOC_NAME(get_cache_covering_cpuset)
#define hwloc_get_shared_cache_covering_obj HWLOC_NAME(get_shared_cache_covering_obj)
#define hwloc_get_closest_objs HWLOC_NAME(get_closest_objs)
@ -395,10 +359,6 @@ extern "C" {
#define hwloc_nodeset_to_linux_libnuma_bitmask HWLOC_NAME(nodeset_to_linux_libnuma_bitmask)
#define hwloc_cpuset_from_linux_libnuma_bitmask HWLOC_NAME(cpuset_from_linux_libnuma_bitmask)
#define hwloc_nodeset_from_linux_libnuma_bitmask HWLOC_NAME(nodeset_from_linux_libnuma_bitmask)
#define hwloc_cpuset_to_linux_libnuma_nodemask HWLOC_NAME(cpuset_to_linux_libnuma_nodemask)
#define hwloc_nodeset_to_linux_libnuma_nodemask HWLOC_NAME(nodeset_to_linux_libnuma_nodemask)
#define hwloc_cpuset_from_linux_libnuma_nodemask HWLOC_NAME(cpuset_from_linux_libnuma_nodemask)
#define hwloc_nodeset_from_linux_libnuma_nodemask HWLOC_NAME(nodeset_from_linux_libnuma_nodemask)
/* linux.h */
@ -409,6 +369,7 @@ extern "C" {
/* openfabrics-verbs.h */
#define hwloc_ibv_get_device_cpuset HWLOC_NAME(ibv_get_device_cpuset)
#define hwloc_ibv_get_device_osdev_by_name HWLOC_NAME(ibv_get_device_osdev_by_name)
/* myriexpress.h */
@ -446,6 +407,26 @@ extern "C" {
#define hwloc_have_cpuid HWLOC_NAME(have_cpuid)
#define hwloc_cpuid HWLOC_NAME(cpuid)
/* private/xml.h */
#define hwloc__xml_verbose HWLOC_NAME(_xml_verbose)
#define hwloc__xml_import_state_s HWLOC_NAME(_xml_import_state_s)
#define hwloc__xml_import_state_t HWLOC_NAME(_xml_import_state_t)
#define hwloc__xml_export_output_s HWLOC_NAME(_xml_export_output_s)
#define hwloc__xml_export_output_t HWLOC_NAME(_xml_export_output_t)
#define hwloc__xml_export_object HWLOC_NAME(_xml_export_object)
#define hwloc_nolibxml_backend_init HWLOC_NAME(nolibxml_backend_init)
#define hwloc_nolibxml_export_file HWLOC_NAME(nolibxml_export_file)
#define hwloc_nolibxml_export_buffer HWLOC_NAME(nolibxml_export_buffer)
#define hwloc_nolibxml_free_buffer HWLOC_NAME(nolibxml_free_buffer)
#define hwloc_libxml_backend_init HWLOC_NAME(libxml_backend_init)
#define hwloc_libxml_export_file HWLOC_NAME(libxml_export_file)
#define hwloc_libxml_export_buffer HWLOC_NAME(libxml_export_buffer)
#define hwloc_libxml_free_buffer HWLOC_NAME(libxml_free_buffer)
/* private/private.h */
#define hwloc_ignore_type_e HWLOC_NAME(ignore_type_e)
@ -462,6 +443,7 @@ extern "C" {
#define HWLOC_BACKEND_SYNTHETIC HWLOC_NAME_CAPS(BACKEND_SYNTHETIC)
#define HWLOC_BACKEND_LINUXFS HWLOC_NAME_CAPS(BACKEND_LINUXFS)
#define HWLOC_BACKEND_XML HWLOC_NAME_CAPS(BACKEND_XML)
#define HWLOC_BACKEND_CUSTOM HWLOC_NAME_CAPS(BACKEND_CUSTOM)
#define HWLOC_BACKEND_MAX HWLOC_NAME_CAPS(BACKEND_MAX)
#define hwloc_backend_params_u HWLOC_NAME(backend_params_u)
@ -483,6 +465,8 @@ extern "C" {
#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_linuxfs_pci_lookup_osdevices HWLOC_NAME(linuxfs_pci_lookup_osdevices)
#define hwloc_linuxfs_get_pcidev_cpuset HWLOC_NAME(linuxfs_get_pcidev_cpuset)
#define hwloc_backend_xml_init HWLOC_NAME(backend_xml_init)
#define hwloc_look_xml HWLOC_NAME(look_xml)
@ -527,7 +511,6 @@ extern "C" {
#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)
#define hwloc_setup_level HWLOC_NAME(setup_level)
#define hwloc_alloc_heap HWLOC_NAME(alloc_heap)
#define hwloc_alloc_mmap HWLOC_NAME(alloc_mmap)

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

@ -0,0 +1,633 @@
/* opal/mca/hwloc/hwloc151/hwloc/include/private/autogen/config.h. Generated from config.h.in by configure. */
/* include/private/autogen/config.h.in. Generated from configure.ac by autoheader. */
/* -*- c -*-
*
* Copyright © 2009, 2012 CNRS, inria., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef HWLOC_CONFIGURE_H
#define HWLOC_CONFIGURE_H
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
/* #undef HAVE_CACHE_DESCRIPTOR */
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
/* #undef HAVE_CACHE_RELATIONSHIP */
/* Define to 1 if you have the `clz' function. */
/* #undef HAVE_CLZ */
/* Define to 1 if you have the `clzl' function. */
/* #undef HAVE_CLZL */
/* Define to 1 if you have the `cpuset_setaffinity' function. */
/* #undef HAVE_CPUSET_SETAFFINITY */
/* Define to 1 if we have -lcuda */
/* #undef HAVE_CUDA */
/* Define to 1 if we have -lcudart */
/* #undef HAVE_CUDART */
/* Define to 1 if you have the <cuda.h> header file. */
/* #undef HAVE_CUDA_H */
/* Define to 1 if you have the <cuda_runtime_api.h> header file. */
/* #undef HAVE_CUDA_RUNTIME_API_H */
/* Define to 1 if you have the declaration of `CTL_HW', and to 0 if you don't.
*/
#define HAVE_DECL_CTL_HW 0
/* Define to 1 if you have the declaration of `fabsf', and to 0 if you don't.
*/
#define HAVE_DECL_FABSF 1
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
don't. */
#define HAVE_DECL_HW_NCPU 0
/* Define to 1 if you have the declaration of `PCI_LOOKUP_NO_NUMBERS', and to
0 if you don't. */
#define HAVE_DECL_PCI_LOOKUP_NO_NUMBERS 1
/* Define to 1 if you have the declaration of `pthread_getaffinity_np', and to
0 if you don't. */
#define HAVE_DECL_PTHREAD_GETAFFINITY_NP 1
/* Define to 1 if you have the declaration of `pthread_setaffinity_np', and to
0 if you don't. */
#define HAVE_DECL_PTHREAD_SETAFFINITY_NP 1
/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0
if you don't. */
#define HAVE_DECL__SC_LARGE_PAGESIZE 0
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_CONF', and to 0
if you don't. */
#define HAVE_DECL__SC_NPROCESSORS_CONF 1
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_ONLN', and to 0
if you don't. */
#define HAVE_DECL__SC_NPROCESSORS_ONLN 1
/* Define to 1 if you have the declaration of `_SC_NPROC_CONF', and to 0 if
you don't. */
#define HAVE_DECL__SC_NPROC_CONF 0
/* Define to 1 if you have the declaration of `_SC_NPROC_ONLN', and to 0 if
you don't. */
#define HAVE_DECL__SC_NPROC_ONLN 0
/* Define to 1 if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ffs' function. */
#define HAVE_FFS 1
/* Define to 1 if you have the `ffsl' function. */
#define HAVE_FFSL 1
/* Define to 1 if you have the `fls' function. */
/* #undef HAVE_FLS */
/* Define to 1 if you have the `flsl' function. */
/* #undef HAVE_FLSL */
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if the system has the type `GROUP_AFFINITY'. */
/* #undef HAVE_GROUP_AFFINITY */
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
/* #undef HAVE_GROUP_RELATIONSHIP */
/* Define to 1 if you have the `host_info' function. */
/* #undef HAVE_HOST_INFO */
/* Define to 1 if you have the <infiniband/verbs.h> header file. */
#define HAVE_INFINIBAND_VERBS_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if the system has the type `KAFFINITY'. */
/* #undef HAVE_KAFFINITY */
/* Define to 1 if you have the <kstat.h> header file. */
/* #undef HAVE_KSTAT_H */
/* Define to 1 if you have the <langinfo.h> header file. */
/* #undef HAVE_LANGINFO_H */
/* Define to 1 if we have -lgdi32 */
/* #undef HAVE_LIBGDI32 */
/* Define to 1 if we have -libverbs */
/* #undef HAVE_LIBIBVERBS */
/* Define to 1 if we have -lkstat */
/* #undef HAVE_LIBKSTAT */
/* Define to 1 if we have -llgrp */
/* #undef HAVE_LIBLGRP */
/* Define to 1 if you have the `pci' library (-lpci). */
/* #undef HAVE_LIBPCI */
/* Define to 1 if you have the <locale.h> header file. */
/* #undef HAVE_LOCALE_H */
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
/* #undef HAVE_LOGICAL_PROCESSOR_RELATIONSHIP */
/* Define to 1 if you have the <mach/mach_host.h> header file. */
/* #undef HAVE_MACH_MACH_HOST_H */
/* Define to 1 if you have the <mach/mach_init.h> header file. */
/* #undef HAVE_MACH_MACH_INIT_H */
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the `memalign' function. */
#define HAVE_MEMALIGN 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <myriexpress.h> header file. */
/* #undef HAVE_MYRIEXPRESS_H */
/* Define to 1 if you have the `nl_langinfo' function. */
/* #undef HAVE_NL_LANGINFO */
/* Define to 1 if you have the <numaif.h> header file. */
#define HAVE_NUMAIF_H 1
/* Define to 1 if the system has the type `NUMA_NODE_RELATIONSHIP'. */
/* #undef HAVE_NUMA_NODE_RELATIONSHIP */
/* Define to 1 if you have the `openat' function. */
#define HAVE_OPENAT 1
/* 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. */
#define HAVE_POSIX_MEMALIGN 1
/* Define to 1 if the system has the type `PROCESSOR_CACHE_TYPE'. */
/* #undef HAVE_PROCESSOR_CACHE_TYPE */
/* Define to 1 if the system has the type `PROCESSOR_GROUP_INFO'. */
/* #undef HAVE_PROCESSOR_GROUP_INFO */
/* Define to 1 if the system has the type `PROCESSOR_RELATIONSHIP'. */
/* #undef HAVE_PROCESSOR_RELATIONSHIP */
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_BLOCK'. */
/* #undef HAVE_PSAPI_WORKING_SET_EX_BLOCK */
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_INFORMATION'.
*/
/* #undef HAVE_PSAPI_WORKING_SET_EX_INFORMATION */
/* Define to 1 if you have the <pthread_np.h> header file. */
/* #undef HAVE_PTHREAD_NP_H */
/* Define to 1 if the system has the type `pthread_t'. */
#define HAVE_PTHREAD_T 1
/* Define to 1 if you have the `putwc' function. */
/* #undef HAVE_PUTWC */
/* Define to 1 if the system has the type `RelationProcessorPackage'. */
/* #undef HAVE_RELATIONPROCESSORPACKAGE */
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1
/* Define to 1 if you have the `sysctlbyname' function. */
/* #undef HAVE_SYSCTLBYNAME */
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION'. */
/* #undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION */
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX'. */
/* #undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX */
/* Define to 1 if you have the <sys/cpuset.h> header file. */
/* #undef HAVE_SYS_CPUSET_H */
/* Define to 1 if you have the <sys/lgrp_user.h> header file. */
/* #undef HAVE_SYS_LGRP_USER_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `uselocale' function. */
/* #undef HAVE_USELOCALE */
/* Define to 1 if the system has the type `wchar_t'. */
/* #undef HAVE_WCHAR_T */
/* Define to 1 if you have the <X11/keysym.h> header file. */
/* #undef HAVE_X11_KEYSYM_H */
/* Define to 1 if you have the <X11/Xlib.h> header file. */
/* #undef HAVE_X11_XLIB_H */
/* Define to 1 if you have the <X11/Xutil.h> header file. */
/* #undef HAVE_X11_XUTIL_H */
/* Define to 1 if you have the <xlocale.h> header file. */
/* #undef HAVE_XLOCALE_H */
/* Define to 1 on AIX */
/* #undef HWLOC_AIX_SYS */
/* Whether C compiler supports symbol visibility or not */
#define HWLOC_C_HAVE_VISIBILITY 1
/* Define to 1 on Darwin */
/* #undef HWLOC_DARWIN_SYS */
/* Whether we are in debugging mode or not */
/* #undef HWLOC_DEBUG */
/* Define to 1 on *FREEBSD */
/* #undef HWLOC_FREEBSD_SYS */
/* Whether your compiler has __attribute__ or not */
#define HWLOC_HAVE_ATTRIBUTE 1
/* Whether your compiler has __attribute__ aligned or not */
#define HWLOC_HAVE_ATTRIBUTE_ALIGNED 1
/* Whether your compiler has __attribute__ always_inline or not */
#define HWLOC_HAVE_ATTRIBUTE_ALWAYS_INLINE 1
/* Whether your compiler has __attribute__ cold or not */
#define HWLOC_HAVE_ATTRIBUTE_COLD 1
/* Whether your compiler has __attribute__ const or not */
#define HWLOC_HAVE_ATTRIBUTE_CONST 1
/* Whether your compiler has __attribute__ deprecated or not */
#define HWLOC_HAVE_ATTRIBUTE_DEPRECATED 1
/* Whether your compiler has __attribute__ format or not */
#define HWLOC_HAVE_ATTRIBUTE_FORMAT 1
/* Whether your compiler has __attribute__ hot or not */
#define HWLOC_HAVE_ATTRIBUTE_HOT 1
/* Whether your compiler has __attribute__ malloc or not */
#define HWLOC_HAVE_ATTRIBUTE_MALLOC 1
/* Whether your compiler has __attribute__ may_alias or not */
#define HWLOC_HAVE_ATTRIBUTE_MAY_ALIAS 1
/* Whether your compiler has __attribute__ nonnull or not */
#define HWLOC_HAVE_ATTRIBUTE_NONNULL 1
/* Whether your compiler has __attribute__ noreturn or not */
#define HWLOC_HAVE_ATTRIBUTE_NORETURN 1
/* Whether your compiler has __attribute__ no_instrument_function or not */
#define HWLOC_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION 1
/* Whether your compiler has __attribute__ packed or not */
#define HWLOC_HAVE_ATTRIBUTE_PACKED 1
/* Whether your compiler has __attribute__ pure or not */
#define HWLOC_HAVE_ATTRIBUTE_PURE 1
/* Whether your compiler has __attribute__ sentinel or not */
#define HWLOC_HAVE_ATTRIBUTE_SENTINEL 1
/* Whether your compiler has __attribute__ unused or not */
#define HWLOC_HAVE_ATTRIBUTE_UNUSED 1
/* Whether your compiler has __attribute__ warn unused result or not */
#define HWLOC_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT 1
/* Whether your compiler has __attribute__ weak alias or not */
#define HWLOC_HAVE_ATTRIBUTE_WEAK_ALIAS 1
/* Define to 1 if your `ffs' function is known to be broken. */
/* #undef HWLOC_HAVE_BROKEN_FFS */
/* Define to 1 if you have the `cairo' library. */
/* #undef HWLOC_HAVE_CAIRO */
/* Define to 1 if you have the `clz' function. */
/* #undef HWLOC_HAVE_CLZ */
/* Define to 1 if you have the `clzl' function. */
/* #undef HWLOC_HAVE_CLZL */
/* Define to 1 if you have cpuid */
#define HWLOC_HAVE_CPUID 1
/* Define to 1 if the CPU_SET macro works */
#define HWLOC_HAVE_CPU_SET 1
/* Define to 1 if the CPU_SET_S macro works */
#define HWLOC_HAVE_CPU_SET_S 1
/* Define to 1 if function `clz' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_CLZ */
/* Define to 1 if function `clzl' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_CLZL */
/* Define to 1 if function `ffs' is declared by system headers */
#define HWLOC_HAVE_DECL_FFS 1
/* Define to 1 if function `ffsl' is declared by system headers */
#define HWLOC_HAVE_DECL_FFSL 1
/* Define to 1 if function `fls' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_FLS */
/* Define to 1 if function `flsl' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_FLSL */
/* Define to 1 if you have the `ffs' function. */
#define HWLOC_HAVE_FFS 1
/* Define to 1 if you have the `ffsl' function. */
#define HWLOC_HAVE_FFSL 1
/* Define to 1 if you have the `fls' function. */
/* #undef HWLOC_HAVE_FLS */
/* Define to 1 if you have the `flsl' function. */
/* #undef HWLOC_HAVE_FLSL */
/* Define to 1 if you have the `libpci' library. */
#define HWLOC_HAVE_LIBPCI 1
/* Define to 1 if you have a library providing the termcap interface */
/* #undef HWLOC_HAVE_LIBTERMCAP */
/* Define to 1 if you have the `libxml2' library. */
/* #undef HWLOC_HAVE_LIBXML2 */
/* Define to 1 if mbind is available. */
#define HWLOC_HAVE_MBIND 1
/* Define to 1 if migrate_pages is available. */
#define HWLOC_HAVE_MIGRATE_PAGES 1
/* Define to 1 if glibc provides the old prototype (without length) of
sched_setaffinity() */
/* #undef HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
/* Define to 1 if struct pci_dev has a `device_class' field. */
#define HWLOC_HAVE_PCIDEV_DEVICE_CLASS 1
/* Define to 1 if struct pci_dev has a `domain' field. */
#define HWLOC_HAVE_PCIDEV_DOMAIN 1
/* Define to 1 if `libpci' has the `pci_find_cap' function. */
#define HWLOC_HAVE_PCI_FIND_CAP 1
/* `Define to 1 if you have pthread_getthrds_np' */
/* #undef HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
/* Define to 1 if glibc provides a prototype of sched_setaffinity() */
#define HWLOC_HAVE_SCHED_SETAFFINITY 1
/* Define to 1 if set_mempolicy is available. */
#define HWLOC_HAVE_SET_MEMPOLICY 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HWLOC_HAVE_STDINT_H 1
/* Define to 1 if you have the `windows.h' header. */
/* #undef HWLOC_HAVE_WINDOWS_H */
/* Define to 1 if X11 libraries are available. */
/* #undef HWLOC_HAVE_X11 */
/* Define to 1 if the _syscall3 macro works */
/* #undef HWLOC_HAVE__SYSCALL3 */
/* Define to 1 on HP-UX */
/* #undef HWLOC_HPUX_SYS */
/* Define to 1 on Irix */
/* #undef HWLOC_IRIX_SYS */
/* Define to 1 on Linux */
#define HWLOC_LINUX_SYS 1
/* Major version of hwloc */
/* #undef HWLOC_MAJOR_VERSION */
/* Minor version of hwloc */
/* #undef HWLOC_MINOR_VERSION */
/* Define to 1 on OSF */
/* #undef HWLOC_OSF_SYS */
/* Release version of hwloc */
/* #undef HWLOC_RELEASE_VERSION */
/* The size of `unsigned int', as computed by sizeof */
#define HWLOC_SIZEOF_UNSIGNED_INT 4
/* The size of `unsigned long', as computed by sizeof */
#define HWLOC_SIZEOF_UNSIGNED_LONG 8
/* Define to 1 on Solaris */
/* #undef HWLOC_SOLARIS_SYS */
/* The hwloc symbol prefix */
#define HWLOC_SYM_PREFIX opal_hwloc151_
/* The hwloc symbol prefix in all caps */
#define HWLOC_SYM_PREFIX_CAPS OPAL_HWLOC151_
/* Whether we need to re-define all the hwloc public symbols or not */
#define HWLOC_SYM_TRANSFORM 1
/* Define to 1 on unsupported systems */
/* #undef HWLOC_UNSUPPORTED_SYS */
/* Define to 1 if ncurses works, preferred over curses */
/* #undef HWLOC_USE_NCURSES */
/* Define to 1 on WINDOWS */
/* #undef HWLOC_WIN_SYS */
/* Define to 1 on x86_32 */
/* #undef HWLOC_X86_32_ARCH */
/* Define to 1 on x86_64 */
#define HWLOC_X86_64_ARCH 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "http://www.open-mpi.org/community/help/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Open MPI"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Open MPI 1.9a1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "openmpi"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.9a1"
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* The size of `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 8
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
# define _HPUX_SOURCE 1
#endif
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Version number of package */
/* #undef VERSION */
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Are we building for HP-UX? */
#define _HPUX_SOURCE 1
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define this to the process ID type */
#define hwloc_pid_t pid_t
/* Define this to either strncasecmp or strncmp */
#define hwloc_strncasecmp strncasecmp
/* Define this to the thread ID type */
#define hwloc_thread_t pthread_t
#endif /* HWLOC_CONFIGURE_H */

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

@ -2,7 +2,7 @@
/* -*- c -*-
*
* Copyright © 2009 CNRS, inria., Université Bordeaux 1 All rights reserved.
* Copyright © 2009, 2012 CNRS, inria., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -30,6 +30,9 @@
/* Define to 1 if you have the `clzl' function. */
#undef HAVE_CLZL
/* Define to 1 if you have the `cpuset_setaffinity' function. */
#undef HAVE_CPUSET_SETAFFINITY
/* Define to 1 if we have -lcuda */
#undef HAVE_CUDA
@ -86,6 +89,9 @@
you don't. */
#undef HAVE_DECL__SC_NPROC_ONLN
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@ -281,6 +287,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if the system has the type `wchar_t'. */
#undef HAVE_WCHAR_T
@ -293,6 +302,9 @@
/* Define to 1 if you have the <X11/Xutil.h> header file. */
#undef HAVE_X11_XUTIL_H
/* Define to 1 if you have the <xlocale.h> header file. */
#undef HAVE_XLOCALE_H
/* Define to 1 on AIX */
#undef HWLOC_AIX_SYS

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

@ -0,0 +1 @@
timestamp for opal/mca/hwloc/hwloc151/hwloc/include/private/autogen/config.h

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

@ -0,0 +1 @@
timestamp for opal/mca/hwloc/hwloc151/hwloc/include/private/autogen/config.h

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

@ -53,22 +53,30 @@ static __hwloc_inline void hwloc_cpuid(unsigned *eax, unsigned *ebx, unsigned *e
{
#ifdef HWLOC_X86_64_ARCH
unsigned long sav_ebx;
#endif
asm(
#ifdef HWLOC_X86_32_ARCH
"push %%ebx\n\t"
#else
/* Note: can't easily use stack since the compiler assumes we don't touch the redzone */
"mov %%rbx,%2\n\t"
#endif
"cpuid\n\t"
#ifdef HWLOC_X86_32_ARCH
"mov %%ebx,%1\n\t"
"pop %%ebx\n\t"
"xchg %2,%%rbx\n\t"
"movl %k2,%1\n\t"
: "+a" (*eax), "=m" (*ebx), "=&r"(sav_ebx),
"+c" (*ecx), "=&d" (*edx));
#elif defined(HWLOC_X86_32_ARCH)
asm(
/* Note: gcc might want to use ebx for %1 addressing :/ */
"push %%ebx\n\t"
"cpuid\n\t"
"push %%eax\n\t"
"mov %%ebx,%%eax\n\t"
"mov 4(%%esp),%%ebx\n\t"
"mov %%eax,%1\n\t"
"pop %%eax\n\t"
"add $4,%%esp\n\t"
: "+a" (*eax), "=m" (*ebx),
"+c" (*ecx), "=&d" (*edx));
#else
"mov %%ebx,%1\n\t"
"mov %2,%%rbx\n\t"
#error unknown architecture
#endif
: "+a" (*eax), "=r" (*ebx), "=r"(sav_ebx), "+c" (*ecx), "=d" (*edx));
}
#endif /* HWLOC_PRIVATE_CPUID_H */

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

@ -56,6 +56,8 @@ typedef enum hwloc_backend_e {
HWLOC_BACKEND_MAX
} hwloc_backend_t;
struct hwloc__xml_import_state_s;
struct hwloc_topology {
unsigned nb_levels; /* Number of horizontal levels */
unsigned next_group_depth; /* Depth of the next Group object that we may create */
@ -145,10 +147,10 @@ struct hwloc_topology {
#endif /* HWLOC_OSF_SYS */
struct hwloc_backend_params_xml_s {
/* xml backend parameters */
#ifdef HWLOC_HAVE_LIBXML2
void *doc;
#endif /* HWLOC_HAVE_LIBXML2 */
char *buffer; /* only used when not using libxml2 */
int (*look)(struct hwloc_topology *topology, struct hwloc__xml_import_state_s *state);
void (*look_failed)(struct hwloc_topology *topology);
void (*backend_exit)(struct hwloc_topology *topology);
void *data; /* libxml2 doc, or nolibxml buffer */
struct hwloc_xml_imported_distances_s {
hwloc_obj_t root;
struct hwloc_distances_s distances;
@ -181,6 +183,8 @@ 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);
extern void hwloc_linuxfs_pci_lookup_osdevices(struct hwloc_topology *topology, struct hwloc_obj *pcidev);
extern int hwloc_linuxfs_get_pcidev_cpuset(struct hwloc_topology *topology, struct hwloc_obj *pcidev, hwloc_bitmap_t cpuset);
#endif /* HWLOC_LINUX_SYS */
extern int hwloc_backend_xml_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int buflen);
@ -300,39 +304,6 @@ hwloc_alloc_setup_object(hwloc_obj_type_t type, signed idx)
}
extern void hwloc_free_unlinked_object(hwloc_obj_t obj);
#define hwloc_object_cpuset_from_array(l, _value, _array, _max) do { \
struct hwloc_obj *__l = (l); \
unsigned int *__a = (_array); \
int k; \
__l->cpuset = hwloc_bitmap_alloc(); \
for(k=0; k<_max; k++) \
if (__a[k] == _value) \
hwloc_bitmap_set(__l->cpuset, k); \
} while (0)
/* Configures an array of NUM objects of type TYPE with physical IDs OSPHYSIDS
* and for which processors have ID PROC_PHYSIDS, and add them to the topology.
* */
static __hwloc_inline void
hwloc_setup_level(int procid_max, unsigned num, unsigned *osphysids, unsigned *proc_physids, struct hwloc_topology *topology, hwloc_obj_type_t type)
{
struct hwloc_obj *obj;
unsigned j;
hwloc_debug("%d %s\n", num, hwloc_obj_type_string(type));
for (j = 0; j < num; j++)
{
obj = hwloc_alloc_setup_object(type, osphysids[j]);
hwloc_object_cpuset_from_array(obj, j, proc_physids, procid_max);
hwloc_debug_2args_bitmap("%s %d has cpuset %s\n",
hwloc_obj_type_string(type),
j, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
hwloc_debug("%s", "\n");
}
#endif
/* This can be used for the alloc field to get allocated data that can be freed by free() */
@ -370,6 +341,29 @@ 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);
#ifdef HAVE_USELOCALE
#include "locale.h"
#ifdef HAVE_XLOCALE_H
#include "xlocale.h"
#endif
#define hwloc_localeswitch_declare locale_t __old_locale = (locale_t)0, __new_locale
#define hwloc_localeswitch_init() do { \
__new_locale = newlocale(LC_ALL_MASK, "C", (locale_t)0); \
if (__new_locale != (locale_t)0) \
__old_locale = uselocale(__new_locale); \
} while (0)
#define hwloc_localeswitch_fini() do { \
if (__new_locale != (locale_t)0) { \
uselocale(__old_locale); \
freelocale(__new_locale); \
} \
} while(0)
#else /* HAVE_USELOCALE */
#define hwloc_localeswitch_declare int __dummy_nolocale __hwloc_attribute_unused
#define hwloc_localeswitch_init()
#define hwloc_localeswitch_fini()
#endif /* HAVE_USELOCALE */
#if !HAVE_DECL_FABSF
#define fabsf(f) fabs((double)(f))
#endif

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

@ -0,0 +1,58 @@
/*
* Copyright © 2009-2012 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
#ifndef PRIVATE_XML_H
#define PRIVATE_XML_H 1
struct hwloc_topology;
struct hwloc_obj;
#include <sys/types.h>
#ifdef HWLOC_HAVE_LIBXML2
#include <libxml/tree.h>
#endif
extern int hwloc__xml_verbose(void);
typedef struct hwloc__xml_import_state_s {
struct hwloc__xml_import_state_s *parent;
int (*next_attr)(struct hwloc__xml_import_state_s * state, char **namep, char **valuep);
int (*find_child)(struct hwloc__xml_import_state_s * state, struct hwloc__xml_import_state_s * childstate, char **tagp);
int (*close_tag)(struct hwloc__xml_import_state_s * state); /* look for an explicit closing tag </name> */
void (*close_child)(struct hwloc__xml_import_state_s * state);
/* opaque data used to store backend-specific data.
* statically allocated to allow stack-allocation by the common code without knowing actual backend needs.
*/
char data[32];
} * hwloc__xml_import_state_t;
typedef struct hwloc__xml_export_output_s {
void (*new_child)(struct hwloc__xml_export_output_s *output, const char *name);
void (*new_prop)(struct hwloc__xml_export_output_s *output, const char *name, const char *value);
void (*end_props)(struct hwloc__xml_export_output_s *output, unsigned nr_children);
void (*end_child)(struct hwloc__xml_export_output_s *output, const char *name, unsigned nr_children);
/* allocated by the backend (a single output is needed for the entire export) */
void *data;
} * hwloc__xml_export_output_t;
extern void hwloc__xml_export_object (hwloc__xml_export_output_t output, struct hwloc_topology *topology, struct hwloc_obj *obj);
extern int hwloc_nolibxml_backend_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int xmlbuflen);
extern int hwloc_nolibxml_export_file(struct hwloc_topology *topology, const char *filename);
extern int hwloc_nolibxml_export_buffer(struct hwloc_topology *topology, char **xmlbuffer, int *buflen);
extern void hwloc_nolibxml_free_buffer(void *xmlbuffer);
#ifdef HWLOC_HAVE_LIBXML2
extern int hwloc_libxml_backend_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int xmlbuflen);
extern int hwloc_libxml_export_file(struct hwloc_topology *topology, const char *filename);
extern int hwloc_libxml_export_buffer(struct hwloc_topology *topology, char **xmlbuffer, int *buflen);
extern void hwloc_libxml_free_buffer(void *xmlbuffer);
#endif
#endif /* PRIVATE_XML_H */

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

@ -27,13 +27,18 @@ sources = \
distances.c \
topology-synthetic.c \
topology-xml.c \
topology-xml-nolibxml.c \
bind.c \
cpuset.c \
bitmap.c \
misc.c
ldflags =
# Conditionally add to the sources and ldflags
if HWLOC_HAVE_LIBXML2
sources += topology-xml-libxml.c
endif HWLOC_HAVE_LIBXML2
if HWLOC_HAVE_LIBPCI
sources += topology-libpci.c
endif HWLOC_HAVE_LIBPCI
@ -84,9 +89,13 @@ export LC_MESSAGES
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_so_version) .libs/libhwloc.lib
dolib$(EXEEXT): dolib.c
$(CC_FOR_BUILD) $< -o $@
.libs/libhwloc.lib: libhwloc.la dolib$(EXEEXT)
[ ! -r .libs/libhwloc.def ] || ./dolib$(EXEEXT) "$(HWLOC_MS_LIB)" $(HWLOC_MS_LIB_ARCH) .libs/libhwloc.def $(libhwloc_so_version) .libs/libhwloc.lib
all-local: .libs/libhwloc.lib
clean-local:
$(RM) dolib$(EXEEXT)
endif HWLOC_HAVE_MS_LIB
install-exec-hook:

1928
opal/mca/hwloc/hwloc151/hwloc/src/Makefile.in Обычный файл

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

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

@ -16,7 +16,6 @@
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

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

@ -6,14 +6,6 @@
* See COPYING in top-level directory.
*/
/* cpuset.h converts from the old cpuset API to the new bitmap API, we don't want it here */
#ifndef HWLOC_CPUSET_H
/* make sure cpuset.h will not be automatically included here */
#define HWLOC_CPUSET_H 1
#else
#error Do not include cpuset.h in cpuset.c
#endif
#include <private/autogen/config.h>
#include <private/misc.h>
#include <private/private.h>
@ -327,7 +319,7 @@ int hwloc_bitmap_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restric
if (!strncmp("0xf...f", current, 7)) {
current += 7;
if (*current != ',') {
/* special case for infinite/full cpuset */
/* special case for infinite/full bitmap */
hwloc_bitmap_fill(set);
return 0;
}
@ -1167,101 +1159,3 @@ int hwloc_bitmap_weight(const struct hwloc_bitmap_s * set)
weight += hwloc_weight_long(set->ulongs[i]);
return weight;
}
/********************************************************************
* everything below should be dropped when hwloc/cpuset.h is dropped
*/
/* for HWLOC_DECLSPEC */
#include <hwloc/autogen/config.h>
/* forward declarations (public headers do not export this API anymore) */
HWLOC_DECLSPEC struct hwloc_bitmap_s * hwloc_cpuset_alloc(void);
HWLOC_DECLSPEC void hwloc_cpuset_free(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC struct hwloc_bitmap_s * hwloc_cpuset_dup(const struct hwloc_bitmap_s * old);
HWLOC_DECLSPEC void hwloc_cpuset_copy(struct hwloc_bitmap_s * dst, const struct hwloc_bitmap_s * src);
HWLOC_DECLSPEC int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_from_string(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string);
HWLOC_DECLSPEC void hwloc_cpuset_zero(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC void hwloc_cpuset_fill(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC void hwloc_cpuset_from_ulong(struct hwloc_bitmap_s *set, unsigned long mask);
HWLOC_DECLSPEC void hwloc_cpuset_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask);
HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ulong(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_bitmap_s *set, unsigned i);
HWLOC_DECLSPEC void hwloc_cpuset_cpu(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_all_but_cpu(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_set(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu);
HWLOC_DECLSPEC void hwloc_cpuset_set_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask);
HWLOC_DECLSPEC void hwloc_cpuset_clr(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu);
HWLOC_DECLSPEC int hwloc_cpuset_isset(const struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC int hwloc_cpuset_iszero(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_isfull(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_isequal(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC int hwloc_cpuset_intersects(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC int hwloc_cpuset_isincluded(const struct hwloc_bitmap_s *sub_set, const struct hwloc_bitmap_s *super_set);
HWLOC_DECLSPEC void hwloc_cpuset_or(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_and(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_andnot(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_xor(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_not(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_first(const struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_last(const struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_next(const struct hwloc_bitmap_s * set, unsigned prev_cpu);
HWLOC_DECLSPEC void hwloc_cpuset_singlify(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_compare_first(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2);
HWLOC_DECLSPEC int hwloc_cpuset_compare(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2);
HWLOC_DECLSPEC int hwloc_cpuset_weight(const struct hwloc_bitmap_s * set);
/* actual symbols converting from cpuset ABI into bitmap ABI */
struct hwloc_bitmap_s * hwloc_cpuset_alloc(void) { return hwloc_bitmap_alloc(); }
void hwloc_cpuset_free(struct hwloc_bitmap_s * set) { hwloc_bitmap_free(set); }
struct hwloc_bitmap_s * hwloc_cpuset_dup(const struct hwloc_bitmap_s * old) { return hwloc_bitmap_dup(old); }
void hwloc_cpuset_copy(struct hwloc_bitmap_s * dst, const struct hwloc_bitmap_s * src) { hwloc_bitmap_copy(dst, src); }
int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_snprintf(buf, buflen, set); }
int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_asprintf(strp, set); }
int hwloc_cpuset_from_string(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string) { return hwloc_bitmap_sscanf(set, string); }
int hwloc_cpuset_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_taskset_snprintf(buf, buflen, set); }
int hwloc_cpuset_taskset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_taskset_asprintf(strp, set); }
int hwloc_cpuset_taskset_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string) { return hwloc_bitmap_taskset_sscanf(set, string); }
void hwloc_cpuset_zero(struct hwloc_bitmap_s * set) { hwloc_bitmap_zero(set); }
void hwloc_cpuset_fill(struct hwloc_bitmap_s * set) { hwloc_bitmap_fill(set); }
void hwloc_cpuset_from_ulong(struct hwloc_bitmap_s *set, unsigned long mask) { hwloc_bitmap_from_ulong(set, mask); }
void hwloc_cpuset_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask) { hwloc_bitmap_from_ith_ulong(set, i, mask); }
unsigned long hwloc_cpuset_to_ulong(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_to_ulong(set); }
unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_bitmap_s *set, unsigned i) { return hwloc_bitmap_to_ith_ulong(set, i); }
void hwloc_cpuset_cpu(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_only(set, cpu); }
void hwloc_cpuset_all_but_cpu(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_allbut(set, cpu); }
void hwloc_cpuset_set(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_set(set, cpu); }
void hwloc_cpuset_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu) { hwloc_bitmap_set_range(set, begincpu, endcpu); }
void hwloc_cpuset_set_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask) { hwloc_bitmap_set_ith_ulong(set, i, mask); }
void hwloc_cpuset_clr(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_clr(set, cpu); }
void hwloc_cpuset_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu) { hwloc_bitmap_clr_range(set, begincpu, endcpu); }
int hwloc_cpuset_isset(const struct hwloc_bitmap_s * set, unsigned cpu) { return hwloc_bitmap_isset(set, cpu); }
int hwloc_cpuset_iszero(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_iszero(set); }
int hwloc_cpuset_isfull(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_isfull(set); }
int hwloc_cpuset_isequal(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { return hwloc_bitmap_isequal(set1, set2); }
int hwloc_cpuset_intersects(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { return hwloc_bitmap_intersects(set1, set2); }
int hwloc_cpuset_isincluded(const struct hwloc_bitmap_s *sub_set, const struct hwloc_bitmap_s *super_set) { return hwloc_bitmap_isincluded(sub_set, super_set); }
void hwloc_cpuset_or(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_or(res, set1, set2); }
void hwloc_cpuset_and(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_and(res, set1, set2); }
void hwloc_cpuset_andnot(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_andnot(res, set1, set2); }
void hwloc_cpuset_xor(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_xor(res, set1, set2); }
void hwloc_cpuset_not(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set) { hwloc_bitmap_not(res, set); }
int hwloc_cpuset_first(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_first(set); }
int hwloc_cpuset_last(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_last(set); }
int hwloc_cpuset_next(const struct hwloc_bitmap_s * set, unsigned prev_cpu) { return hwloc_bitmap_next(set, prev_cpu); }
void hwloc_cpuset_singlify(struct hwloc_bitmap_s * set) { hwloc_bitmap_singlify(set); }
int hwloc_cpuset_compare_first(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2) { return hwloc_bitmap_compare_first(set1, set2); }
int hwloc_cpuset_compare(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2) { return hwloc_bitmap_compare(set1, set2); }
int hwloc_cpuset_weight(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_weight(set); }
/*
* end of everything to be dropped when hwloc/cpuset.h is dropped
*****************************************************************/

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

@ -255,8 +255,12 @@ void hwloc_distances_set_from_env(struct hwloc_topology *topology)
char *env, envname[64];
snprintf(envname, sizeof(envname), "HWLOC_%s_DISTANCES", hwloc_obj_type_string(type));
env = getenv(envname);
if (env)
if (env) {
hwloc_localeswitch_declare;
hwloc_localeswitch_init();
hwloc_distances__set_from_string(topology, type, env);
hwloc_localeswitch_fini();
}
}
}

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

@ -33,20 +33,11 @@ int main(int argc, char *argv[]) {
if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
exit(EXIT_FAILURE);
#ifndef _WIN32
snprintf(name, sizeof(name), "libhwloc-%d", current - age);
#else
_snprintf(name, sizeof(name), "libhwloc-%d", current - age);
#endif
printf("using soname %s\n", name);
#ifndef _WIN32
snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib);
#else
_snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib);
#endif
if (system(s)) {
fprintf(stderr, "%s failed\n", s);
exit(EXIT_FAILURE);

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

@ -10,6 +10,7 @@
<!ATTLIST object cache_size CDATA "0" >
<!ATTLIST object cache_linesize CDATA "0" >
<!ATTLIST object cache_associativity CDATA "0" >
<!ATTLIST object cache_type CDATA "0" >
<!ATTLIST object huge_page_size_kB CDATA "0" >
<!ATTLIST object huge_page_free CDATA "0" >
<!ATTLIST object depth CDATA "-1" >

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 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.
@ -11,8 +11,12 @@
#include <private/autogen/config.h>
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <stdio.h>
@ -21,8 +25,11 @@
#include <hwloc.h>
#include <private/private.h>
#include <private/misc.h>
#include <private/debug.h>
#include <procinfo.h>
#include <sys/types.h>
#include <sys/rset.h>
#include <sys/processor.h>
#include <sys/thread.h>
@ -30,7 +37,7 @@
#include <sys/systemcfg.h>
static int
hwloc_aix_set_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_const_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
hwloc_aix_set_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, pid_t pid, hwloc_const_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
rsethandle_t rad;
int res;
@ -55,17 +62,26 @@ hwloc_aix_set_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who,
hwloc_bitmap_foreach_end();
res = ra_attachrset(what, who, rad, 0);
if (res < 0 && errno == EPERM) {
/* EPERM may mean that one thread has ben bound with bindprocessor().
* Unbind the entire process (we can't unbind individual threads)
* and try again.
*/
bindprocessor(BINDPROCESS, pid, PROCESSOR_CLASS_ANY);
res = ra_attachrset(what, who, rad, 0);
}
rs_free(rad);
return res;
}
static int
hwloc_aix_get_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
hwloc_aix_get_sth_rset_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused, int *boundp)
{
rsethandle_t rset;
unsigned cpu, maxcpus;
int res = -1;
int bound = 0;
rset = rs_alloc(RS_EMPTY);
@ -77,28 +93,101 @@ hwloc_aix_get_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who,
for (cpu = 0; cpu < maxcpus; cpu++)
if (rs_op(RS_TESTRESOURCE, rset, NULL, R_PROCS, cpu) == 1)
hwloc_bitmap_set(hwloc_set, cpu);
else
bound = 1;
hwloc_bitmap_and(hwloc_set, hwloc_set, hwloc_topology_get_complete_cpuset(topology));
res = 0;
*boundp = bound;
out:
rs_free(rset);
return res;
}
static int
hwloc_aix_get_pid_getthrds_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, pid_t pid, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
#if HWLOC_BITS_PER_LONG == 64
struct thrdentry64 thread_info;
tid64_t next_thread;
#else
struct thrdsinfo thread_info;
tid_t next_thread;
#endif
next_thread = 0;
/* TODO: get multiple at once */
#if HWLOC_BITS_PER_LONG == 64
while (getthrds64 (pid, &thread_info, sizeof (thread_info),
&next_thread, 1) == 1) {
#else
while (getthrds (pid, &thread_info, sizeof (thread_info),
&next_thread, 1) == 1) {
#endif
if (PROCESSOR_CLASS_ANY != thread_info.ti_cpuid)
hwloc_bitmap_set(hwloc_set, thread_info.ti_cpuid);
else
hwloc_bitmap_fill(hwloc_set);
}
/* TODO: what if the thread list changes and we get nothing? */
return 0;
}
static int
hwloc_aix_get_tid_getthrds_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, tid_t tid, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
#if HWLOC_BITS_PER_LONG == 64
struct thrdentry64 thread_info;
tid64_t next_thread;
#else
struct thrdsinfo thread_info;
tid_t next_thread;
#endif
pid_t pid = getpid();
next_thread = 0;
/* TODO: get multiple at once */
#if HWLOC_BITS_PER_LONG == 64
while (getthrds64 (pid, &thread_info, sizeof (thread_info),
&next_thread, 1) == 1) {
#else
while (getthrds (pid, &thread_info, sizeof (thread_info),
&next_thread, 1) == 1) {
#endif
if (thread_info.ti_tid == tid) {
if (PROCESSOR_CLASS_ANY != thread_info.ti_cpuid)
hwloc_bitmap_set(hwloc_set, thread_info.ti_cpuid);
else
hwloc_bitmap_fill(hwloc_set);
break;
}
}
/* TODO: what if the thread goes away in the meantime? */
return 0;
}
static int
hwloc_aix_set_thisproc_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, who.at_pid, hwloc_set, flags);
}
static int
hwloc_aix_get_thisproc_cpubind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, int flags)
{
int ret, bound;
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
ret = hwloc_aix_get_sth_rset_cpubind(topology, R_PROCESS, who, hwloc_set, flags, &bound);
if (!ret && !bound) {
hwloc_bitmap_zero(hwloc_set);
ret = hwloc_aix_get_pid_getthrds_cpubind(topology, who.at_pid, hwloc_set, flags);
}
return ret;
}
#ifdef R_THREAD
@ -107,15 +196,21 @@ hwloc_aix_set_thisthread_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, getpid(), hwloc_set, flags);
}
static int
hwloc_aix_get_thisthread_cpubind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, int flags)
{
int ret, bound;
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
ret = hwloc_aix_get_sth_rset_cpubind(topology, R_THREAD, who, hwloc_set, flags, &bound);
if (!ret && !bound) {
hwloc_bitmap_zero(hwloc_set);
ret = hwloc_aix_get_tid_getthrds_cpubind(topology, who.at_tid, hwloc_set, flags);
}
return ret;
}
#endif /* R_THREAD */
@ -124,15 +219,21 @@ hwloc_aix_set_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_con
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, pid, hwloc_set, flags);
}
static int
hwloc_aix_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t hwloc_set, int flags)
{
int ret, bound;
rsid_t who;
who.at_pid = pid;
return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
ret = hwloc_aix_get_sth_rset_cpubind(topology, R_PROCESS, who, hwloc_set, flags, &bound);
if (!ret && !bound) {
hwloc_bitmap_zero(hwloc_set);
ret = hwloc_aix_get_pid_getthrds_cpubind(topology, who.at_pid, hwloc_set, flags);
}
return ret;
}
#ifdef R_THREAD
@ -146,7 +247,7 @@ hwloc_aix_set_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread,
return -1;
{
rsid_t who = { .at_tid = info.__pi_tid };
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, getpid(), hwloc_set, flags);
}
}
@ -158,14 +259,38 @@ hwloc_aix_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread,
if (pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size))
return -1;
{
int ret, bound;
rsid_t who;
who.at_tid = info.__pi_tid;
return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
ret = hwloc_aix_get_sth_rset_cpubind(topology, R_THREAD, who, hwloc_set, flags, &bound);
if (!ret && !bound) {
hwloc_bitmap_zero(hwloc_set);
ret = hwloc_aix_get_tid_getthrds_cpubind(topology, who.at_tid, hwloc_set, flags);
}
return ret;
}
}
#endif /* HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
#endif /* R_THREAD */
static int
hwloc_aix_get_thisthread_last_cpu_location(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
cpu_t cpu;
if (topology->pid) {
errno = ENOSYS;
return -1;
}
cpu = mycpu();
if (cpu < 0)
return -1;
hwloc_bitmap_only(hwloc_set, cpu);
return 0;
}
#ifdef P_DEFAULT
static int
@ -216,7 +341,7 @@ hwloc_aix_prepare_membind(hwloc_topology_t topology, rsethandle_t *rad, hwloc_co
}
static int
hwloc_aix_set_sth_membind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_const_bitmap_t nodeset, hwloc_membind_policy_t policy, int flags)
hwloc_aix_set_sth_membind(hwloc_topology_t topology, rstype_t what, rsid_t who, pid_t pid, hwloc_const_bitmap_t nodeset, hwloc_membind_policy_t policy, int flags)
{
rsethandle_t rad;
int res;
@ -239,6 +364,14 @@ hwloc_aix_set_sth_membind(hwloc_topology_t topology, rstype_t what, rsid_t who,
return -1;
res = ra_attachrset(what, who, rad, 0);
if (res < 0 && errno == EPERM) {
/* EPERM may mean that one thread has ben bound with bindprocessor().
* Unbind the entire process (we can't unbind individual threads)
* and try again.
*/
bindprocessor(BINDPROCESS, pid, PROCESSOR_CLASS_ANY);
res = ra_attachrset(what, who, rad, 0);
}
rs_free(rad);
return res;
@ -292,7 +425,7 @@ hwloc_aix_set_thisproc_membind(hwloc_topology_t topology, hwloc_const_bitmap_t h
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, who.at_pid, hwloc_set, policy, flags);
}
static int
@ -309,7 +442,7 @@ hwloc_aix_set_thisthread_membind(hwloc_topology_t topology, hwloc_const_bitmap_t
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, getpid(), hwloc_set, policy, flags);
}
static int
@ -326,7 +459,7 @@ hwloc_aix_set_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_con
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, pid, hwloc_set, policy, flags);
}
static int
@ -349,7 +482,7 @@ hwloc_aix_set_thread_membind(hwloc_topology_t topology, hwloc_thread_t pthread,
{
rsid_t who;
who.at_tid = info.__pi_tid;
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, getpid(), hwloc_set, policy, flags);
}
}
@ -399,7 +532,17 @@ hwloc_aix_set_area_membind(hwloc_topology_t topology, const void *addr, size_t l
subrange.su_policy = aix_policy;
ret = ra_attachrset(R_SUBRANGE, rsid, subrange.su_rsid.at_rset, 0);
res = ra_attachrset(R_SUBRANGE, rsid, subrange.su_rsid.at_rset, 0);
if (res < 0 && errno == EPERM) {
/* EPERM may mean that one thread has ben bound with bindprocessor().
* Unbind the entire process (we can't unbind individual threads)
* and try again.
* FIXME: actually check that this EPERM can happen
*/
bindprocessor(BINDPROCESS, getpid(), PROCESSOR_CLASS_ANY);
res = ra_attachrset(R_SUBRANGE, rsid, subrange.su_rsid.at_rset, 0);
}
rs_free(subrange.su_rsid.at_rset);
return ret;
}
@ -481,20 +624,41 @@ look_rset(int sdl, hwloc_obj_type_t type, struct hwloc_topology *topology, int l
obj->attr->cache.associativity = _system_configuration.L2_cache_asc;
obj->attr->cache.linesize = 0; /* TODO: ? */
obj->attr->cache.depth = 2;
obj->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED; /* FIXME? */
break;
case HWLOC_OBJ_GROUP:
obj->attr->group.depth = level;
break;
case HWLOC_OBJ_CORE:
{
hwloc_obj_t obj2 = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, i);
hwloc_obj_t obj2, obj3;
obj2 = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, i);
obj2->cpuset = hwloc_bitmap_dup(obj->cpuset);
obj2->attr->cache.size = _system_configuration.dcache_size;
obj2->attr->cache.associativity = _system_configuration.dcache_asc;
obj2->attr->cache.linesize = _system_configuration.dcache_line;
obj2->attr->cache.depth = 1;
hwloc_debug("Adding an L1 cache for core %d\n", i);
hwloc_insert_object_by_cpuset(topology, obj2);
if (_system_configuration.cache_attrib & (1<<30)) {
/* Unified cache */
obj2->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
hwloc_debug("Adding an L1u cache for core %d\n", i);
hwloc_insert_object_by_cpuset(topology, obj2);
} else {
/* Separate Instruction and Data caches */
obj2->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
hwloc_debug("Adding an L1d cache for core %d\n", i);
hwloc_insert_object_by_cpuset(topology, obj2);
obj3 = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, i);
obj3->cpuset = hwloc_bitmap_dup(obj->cpuset);
obj3->attr->cache.size = _system_configuration.icache_size;
obj3->attr->cache.associativity = _system_configuration.icache_asc;
obj3->attr->cache.linesize = _system_configuration.icache_line;
obj3->attr->cache.depth = 1;
obj3->attr->cache.type = HWLOC_OBJ_CACHE_INSTRUCTION;
hwloc_debug("Adding an L1i cache for core %d\n", i);
hwloc_insert_object_by_cpuset(topology, obj3);
}
break;
}
default:
@ -594,7 +758,8 @@ hwloc_set_aix_hooks(struct hwloc_topology *topology)
topology->set_thisthread_cpubind = hwloc_aix_set_thisthread_cpubind;
topology->get_thisthread_cpubind = hwloc_aix_get_thisthread_cpubind;
#endif /* R_THREAD */
/* TODO: get_last_cpu_location: use mycpu() */
topology->get_thisthread_last_cpu_location = hwloc_aix_get_thisthread_last_cpu_location;
/* TODO: get_last_cpu_location: mycpu() only works for the current thread? */
#ifdef P_DEFAULT
topology->set_proc_membind = hwloc_aix_set_proc_membind;
topology->get_proc_membind = hwloc_aix_get_proc_membind;

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -31,7 +31,7 @@ hwloc_look_darwin(struct hwloc_topology *topology)
unsigned i, j, cpu;
struct hwloc_obj *obj;
size_t size;
int64_t l1cachesize;
int64_t l1dcachesize, l1icachesize;
int64_t cacheways[2];
int64_t l2cachesize;
int64_t cachelinesize;
@ -93,8 +93,11 @@ hwloc_look_darwin(struct hwloc_topology *topology)
}
}
if (hwloc_get_sysctlbyname("hw.l1dcachesize", &l1cachesize))
l1cachesize = 0;
if (hwloc_get_sysctlbyname("hw.l1dcachesize", &l1dcachesize))
l1dcachesize = 0;
if (hwloc_get_sysctlbyname("hw.l1icachesize", &l1icachesize))
l1icachesize = 0;
if (hwloc_get_sysctlbyname("hw.l2cachesize", &l2cachesize))
l2cachesize = 0;
@ -150,7 +153,7 @@ hwloc_look_darwin(struct hwloc_topology *topology)
if (n > 0)
cachesize[0] = memsize;
if (n > 1)
cachesize[1] = l1cachesize;
cachesize[1] = l1dcachesize;
if (n > 2)
cachesize[2] = l2cachesize;
}
@ -179,6 +182,21 @@ hwloc_look_darwin(struct hwloc_topology *topology)
cpu++)
hwloc_bitmap_set(obj->cpuset, cpu);
if (i == 1 && l1icachesize) {
/* FIXME assuming that L1i and L1d are shared the same way. Darwin
* does not yet provide a way to know. */
hwloc_obj_t l1i = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, j);
l1i->cpuset = hwloc_bitmap_dup(obj->cpuset);
hwloc_debug_1arg_bitmap("L1icache %u has cpuset %s\n",
j, l1i->cpuset);
l1i->attr->cache.depth = i;
l1i->attr->cache.size = l1icachesize;
l1i->attr->cache.linesize = cachelinesize;
l1i->attr->cache.associativity = 0;
l1i->attr->cache.type = HWLOC_OBJ_CACHE_INSTRUCTION;
hwloc_insert_object_by_cpuset(topology, l1i);
}
if (i) {
hwloc_debug_2args_bitmap("L%ucache %u has cpuset %s\n",
i, j, obj->cpuset);
@ -189,6 +207,10 @@ hwloc_look_darwin(struct hwloc_topology *topology)
obj->attr->cache.associativity = cacheways[i-1];
else
obj->attr->cache.associativity = 0;
if (i == 1 && l1icachesize)
obj->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
else
obj->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
} else {
hwloc_debug_1arg_bitmap("node %u has cpuset %s\n",
j, obj->cpuset);

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

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2010, 2012 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -19,12 +19,15 @@
#ifdef HAVE_SYS_CPUSET_H
#include <sys/cpuset.h>
#endif
#ifdef HAVE_SYSCTL
#include <sys/sysctl.h>
#endif
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#ifdef HAVE_SYS_CPUSET_H
#if defined(HAVE_SYS_CPUSET_H) && defined(HAVE_CPUSET_SETAFFINITY)
static void
hwloc_freebsd_bsd2hwloc(hwloc_bitmap_t hwloc_cpuset, const cpuset_t *cpuset)
{
@ -161,6 +164,16 @@ hwloc_freebsd_get_thread_cpubind(hwloc_topology_t topology __hwloc_attribute_unu
#endif
#endif
#ifdef HAVE_SYSCTL
static void
hwloc_freebsd_node_meminfo_info(struct hwloc_topology *topology)
{
int mib[2] = { CTL_HW, HW_PHYSMEM };
size_t len = sizeof(topology->levels[0][0]->memory.local_memory);
sysctl(mib, 2, &topology->levels[0][0]->memory.local_memory, &len, NULL, 0);
}
#endif
void
hwloc_look_freebsd(struct hwloc_topology *topology)
{
@ -175,13 +188,16 @@ hwloc_look_freebsd(struct hwloc_topology *topology)
hwloc_setup_pu_level(topology, nbprocs);
#ifdef HAVE_SYSCTL
hwloc_freebsd_node_meminfo_info(topology);
#endif
hwloc_obj_add_info(topology->levels[0][0], "Backend", "FreeBSD");
}
void
hwloc_set_freebsd_hooks(struct hwloc_topology *topology)
{
#ifdef HAVE_SYS_CPUSET_H
#if defined(HAVE_SYS_CPUSET_H) && defined(HAVE_CPUSET_SETAFFINITY)
topology->set_thisproc_cpubind = hwloc_freebsd_set_thisproc_cpubind;
topology->get_thisproc_cpubind = hwloc_freebsd_get_thisproc_cpubind;
topology->set_thisthread_cpubind = hwloc_freebsd_set_thisthread_cpubind;

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

@ -18,7 +18,9 @@
#include <private/autogen/config.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <stdio.h>

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

@ -22,10 +22,6 @@
#include <stdarg.h>
#include <setjmp.h>
#ifdef HWLOC_LINUX_SYS
#include <hwloc/linux.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
#define CONFIG_SPACE_CACHESIZE 256
@ -59,257 +55,6 @@ hwloc_pci_traverse_setbridgedepth_cb(struct hwloc_topology *topology __hwloc_att
pcidev->attr->bridge.depth = depth;
}
#ifdef HWLOC_LINUX_SYS
static hwloc_obj_t
hwloc_linux_add_os_device(struct hwloc_topology *topology, struct hwloc_obj *pcidev, hwloc_obj_osdev_type_t type, const char *name)
{
struct hwloc_obj *obj = hwloc_alloc_setup_object(HWLOC_OBJ_OS_DEVICE, -1);
obj->name = strdup(name);
obj->logical_index = -1;
obj->attr->osdev.type = type;
hwloc_insert_object_by_parent(topology, pcidev, obj);
return obj;
}
typedef void (*hwloc_linux_class_fillinfos_t)(struct hwloc_topology *topology, struct hwloc_obj *osdev, const char *osdevpath);
/* look for objects of the given class below a sysfs directory */
static void
hwloc_linux_class_readdir(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *devicepath,
hwloc_obj_osdev_type_t type, const char *classname,
hwloc_linux_class_fillinfos_t fillinfo)
{
size_t classnamelen = strlen(classname);
char path[256];
DIR *dir;
struct dirent *dirent;
hwloc_obj_t obj;
snprintf(path, sizeof(path), "%s/%s", devicepath, classname);
dir = opendir(path);
if (dir) {
/* modern sysfs: <device>/<class>/<name> */
while ((dirent = readdir(dir)) != NULL) {
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
continue;
obj = hwloc_linux_add_os_device(topology, pcidev, type, dirent->d_name);
if (fillinfo) {
snprintf(path, sizeof(path), "%s/%s/%s", devicepath, classname, dirent->d_name);
fillinfo(topology, obj, path);
}
}
closedir(dir);
} else {
/* deprecated sysfs: <device>/<class>:<name> */
dir = opendir(devicepath);
if (dir) {
while ((dirent = readdir(dir)) != NULL) {
if (strncmp(dirent->d_name, classname, classnamelen) || dirent->d_name[classnamelen] != ':')
continue;
obj = hwloc_linux_add_os_device(topology, pcidev, type, dirent->d_name + classnamelen+1);
if (fillinfo) {
snprintf(path, sizeof(path), "%s/%s", devicepath, dirent->d_name);
fillinfo(topology, obj, path);
}
}
closedir(dir);
}
}
}
/* class objects that are immediately below pci devices */
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");
if (fd) {
char address[128];
if (fgets(address, sizeof(address), fd)) {
char *eol = strchr(address, '\n');
if (eol)
*eol = 0;
hwloc_obj_add_info(obj, "Address", address);
}
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)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_NETWORK, "net", hwloc_linux_net_class_fillinfos);
}
static void
hwloc_linux_lookup_openfabrics_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_OPENFABRICS, "infiniband", NULL);
}
static void
hwloc_linux_lookup_dma_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_DMA, "dma", NULL);
}
static void
hwloc_linux_lookup_drm_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_GPU, "drm", NULL);
/* we could look at the "graphics" class too, but it doesn't help for proprietary drivers either */
/* GPU devices (even with a proprietary driver) seem to have a boot_vga field in their PCI device directory (since 2.6.30),
* so we could create a OS device for each PCI devices with such a field.
* boot_vga is actually created when class >> 8 == VGA (it contains 1 for boot vga device), so it's trivial anyway.
*/
}
/* block class objects are in
* host%d/target%d:%d:%d/%d:%d:%d:%d/
* or
* host%d/port-%d:%d/end_device-%d:%d/target%d:%d:%d/%d:%d:%d:%d/
* or
* ide%d/%d.%d/
* below pci devices */
static void
hwloc_linux_lookup_host_block_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, char *path, size_t pathlen)
{
DIR *hostdir, *portdir, *targetdir;
struct dirent *hostdirent, *portdirent, *targetdirent;
int dummy;
hostdir = opendir(path);
if (!hostdir)
return;
while ((hostdirent = readdir(hostdir)) != NULL) {
if (sscanf(hostdirent->d_name, "port-%d:%d", &dummy, &dummy) == 2)
{
/* found host%d/port-%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
portdir = opendir(path);
if (!portdir)
continue;
while ((portdirent = readdir(portdir)) != NULL) {
if (sscanf(portdirent->d_name, "end_device-%d:%d", &dummy, &dummy) == 2) {
/* found host%d/port-%d:%d/end_device-%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], portdirent->d_name);
pathlen += 1+strlen(portdirent->d_name);
hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen);
pathlen -= 1+strlen(portdirent->d_name);
path[pathlen] = '\0';
}
}
closedir(portdir);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
continue;
} else if (sscanf(hostdirent->d_name, "target%d:%d:%d", &dummy, &dummy, &dummy) == 3) {
/* found host%d/target%d:%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
targetdir = opendir(path);
if (!targetdir)
continue;
while ((targetdirent = readdir(targetdir)) != NULL) {
if (sscanf(targetdirent->d_name, "%d:%d:%d:%d", &dummy, &dummy, &dummy, &dummy) != 4)
continue;
/* found host%d/target%d:%d:%d/%d:%d:%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], targetdirent->d_name);
pathlen += 1+strlen(targetdirent->d_name);
/* lookup block class for real */
hwloc_linux_class_readdir(topology, pcidev, path, HWLOC_OBJ_OSDEV_BLOCK, "block", NULL);
/* restore parent path */
pathlen -= 1+strlen(targetdirent->d_name);
path[pathlen] = '\0';
}
closedir(targetdir);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
}
}
closedir(hostdir);
}
static void
hwloc_linux_lookup_block_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
size_t pathlen;
DIR *devicedir, *hostdir;
struct dirent *devicedirent, *hostdirent;
char path[256];
int dummy;
strcpy(path, pcidevpath);
pathlen = strlen(path);
devicedir = opendir(pcidevpath);
if (!devicedir)
return;
while ((devicedirent = readdir(devicedir)) != NULL) {
if (sscanf(devicedirent->d_name, "ide%d", &dummy) == 1) {
/* found ide%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], devicedirent->d_name);
pathlen += 1+strlen(devicedirent->d_name);
hostdir = opendir(path);
if (!hostdir)
continue;
while ((hostdirent = readdir(hostdir)) != NULL) {
if (sscanf(hostdirent->d_name, "%d.%d", &dummy, &dummy) == 2) {
/* found ide%d/%d.%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
/* lookup block class for real */
hwloc_linux_class_readdir(topology, pcidev, path, HWLOC_OBJ_OSDEV_BLOCK, "block", NULL);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
}
}
} else if (sscanf(devicedirent->d_name, "host%d", &dummy) == 1) {
/* found host%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], devicedirent->d_name);
pathlen += 1+strlen(devicedirent->d_name);
hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen);
/* restore parent path */
pathlen -= 1+strlen(devicedirent->d_name);
path[pathlen] = '\0';
}
}
closedir(devicedir);
}
#endif /* HWLOC_LINUX_SYS */
static void
hwloc_pci_traverse_lookuposdevices_cb(struct hwloc_topology *topology, struct hwloc_obj *pcidev, int depth __hwloc_attribute_unused)
{
@ -317,19 +62,8 @@ hwloc_pci_traverse_lookuposdevices_cb(struct hwloc_topology *topology, struct hw
return;
#ifdef HWLOC_LINUX_SYS
{
char pcidevpath[256];
snprintf(pcidevpath, sizeof(pcidevpath), "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/",
pcidev->attr->pcidev.domain, pcidev->attr->pcidev.bus,
pcidev->attr->pcidev.dev, pcidev->attr->pcidev.func);
hwloc_linux_lookup_net_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_openfabrics_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_dma_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_drm_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_block_class(topology, pcidev, pcidevpath);
}
#endif /* HWLOC_LINUX_SYS */
hwloc_linuxfs_pci_lookup_osdevices(topology, pcidev);
#endif
}
static void
@ -360,7 +94,7 @@ enum hwloc_pci_busid_comparison_e {
HWLOC_PCI_BUSID_SUPERSET
};
static int
static enum hwloc_pci_busid_comparison_e
hwloc_pci_compare_busids(struct hwloc_obj *a, struct hwloc_obj *b)
{
if (a->type == HWLOC_OBJ_BRIDGE)
@ -506,33 +240,21 @@ hwloc_pci_find_hostbridge_parent(struct hwloc_topology *topology, struct hwloc_o
hostbridge->first_child->attr->pcidev.domain, hostbridge->first_child->attr->pcidev.bus);
env = getenv(envname);
if (env) {
/* force the hostbridge cpuset */
hwloc_debug("Overriding localcpus using %s in the environment\n", envname);
hwloc_bitmap_sscanf(cpuset, env);
goto found;
}
/* get the hostbridge cpuset. it's not a PCI device, so we use its first child locality info */
} else {
/* get the hostbridge cpuset. it's not a PCI device, so we use its first child locality info */
#ifdef HWLOC_LINUX_SYS
{
char path[256];
FILE *file;
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/local_cpus",
hostbridge->first_child->attr->pcidev.domain, hostbridge->first_child->attr->pcidev.bus,
hostbridge->first_child->attr->pcidev.dev, hostbridge->first_child->attr->pcidev.func);
file = fopen(path, "r"); /* the libpci backend doesn't use sysfs.fsroot */
if (file) {
err = hwloc_linux_parse_cpumap_file(file, cpuset);
fclose(file);
if (!err && !hwloc_bitmap_iszero(cpuset))
goto found;
}
}
err = hwloc_linuxfs_get_pcidev_cpuset(topology, hostbridge->first_child, cpuset);
#else
err = -1;
#endif
if (err < 0)
/* if we got nothing, assume the hostbridge is attached to the top of hierarchy */
hwloc_bitmap_copy(cpuset, hwloc_topology_get_topology_cpuset(topology));
}
/* if we got nothing, assume the hostbridge is attached to the top of hierarchy */
hwloc_bitmap_copy(cpuset, hwloc_topology_get_topology_cpuset(topology));
found:
hwloc_debug_bitmap("Attaching hostbridge to cpuset %s\n", cpuset);
/* restrict to the existing topology cpuset to avoid errors later */
@ -616,7 +338,8 @@ hwloc_look_libpci(struct hwloc_topology *topology)
pcidev = pciaccess->devices;
while (pcidev) {
char name[128], *resname;
char name[128];
const char *resname;
u8 config_space_cache[CONFIG_SPACE_CACHESIZE];
struct hwloc_obj *obj;
unsigned char headertype;
@ -673,14 +396,16 @@ hwloc_look_libpci(struct hwloc_topology *topology)
if (cap->addr + PCI_EXP_LNKSTA >= CONFIG_SPACE_CACHESIZE) {
fprintf(stderr, "cannot read PCI_EXP_LNKSTA cap at %d (only %d cached)\n", cap->addr + PCI_EXP_LNKSTA, CONFIG_SPACE_CACHESIZE);
} else {
unsigned linksta = * (unsigned*) &config_space_cache[cap->addr + PCI_EXP_LNKSTA];
unsigned speed = linksta & PCI_EXP_LNKSTA_SPEED; /* PCIe generation */
unsigned width = (linksta & PCI_EXP_LNKSTA_WIDTH) >> 4; /* how many lanes */
unsigned linksta, speed, width;
float lanespeed;
memcpy(&linksta, &config_space_cache[cap->addr + PCI_EXP_LNKSTA], 4);
speed = linksta & PCI_EXP_LNKSTA_SPEED; /* PCIe generation */
width = (linksta & PCI_EXP_LNKSTA_WIDTH) >> 4; /* how many lanes */
/* PCIe Gen1 = 2.5GT/s signal-rate per lane with 8/10 encoding = 0.25GB/s data-rate per lane
* PCIe Gen2 = 5 GT/s signal-rate per lane with 8/10 encoding = 0.5 GB/s data-rate per lane
* PCIe Gen3 = 8 GT/s signal-rate per lane with 128/130 encoding = 1 GB/s data-rate per lane
*/
float lanespeed = speed <= 2 ? 2.5 * speed * 0.8 : 8 * 128/130; /* Gbit/s per lane */
lanespeed = speed <= 2 ? 2.5 * speed * 0.8 : 8.0 * 128/130; /* Gbit/s per lane */
obj->attr->pcidev.linkspeed = lanespeed * width / 8; /* GB/s */
}
}

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010 IBM
@ -21,8 +21,12 @@
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sched.h>
@ -475,7 +479,8 @@ hwloc_linux_foreach_proc_tid(hwloc_topology_t topology,
char taskdir_path[128];
DIR *taskdir;
pid_t *tids, *newtids;
unsigned i, nr, newnr, failed, failed_errno;
unsigned i, nr, newnr, failed = 0, failed_errno = 0;
unsigned retrynr = 0;
int err;
if (pid)
@ -517,6 +522,12 @@ hwloc_linux_foreach_proc_tid(hwloc_topology_t topology,
free(tids);
tids = newtids;
nr = newnr;
if (++retrynr > 10) {
/* we tried 10 times, it didn't work, the application is probably creating/destroying many threads, stop trying */
errno = EAGAIN;
err = -1;
goto out_with_tids;
}
goto retry;
}
/* if all threads failed, return the last errno. */
@ -1298,7 +1309,7 @@ hwloc_linux_get_area_membind(hwloc_topology_t topology, const void *addr, size_t
{
unsigned max_os_index;
unsigned long *linuxmask, *globallinuxmask;
int linuxpolicy, globallinuxpolicy;
int linuxpolicy, globallinuxpolicy = 0;
int mixed = 0;
int full = 0;
int first = 1;
@ -1412,6 +1423,7 @@ hwloc_backend_linuxfs_exit(struct hwloc_topology *topology)
free(topology->backend_params.linuxfs.root_path);
topology->backend_params.linuxfs.root_path = NULL;
#endif
topology->is_thissystem = 1;
topology->backend_type = HWLOC_BACKEND_NONE;
}
@ -2318,20 +2330,58 @@ look_powerpc_device_tree_discover_cache(device_tree_cpus_t *cpus,
return ret;
}
static void
try__add_cache_from_device_tree_cpu(struct hwloc_topology *topology,
unsigned int level, hwloc_obj_cache_type_t type,
uint32_t cache_line_size, uint32_t cache_size, uint32_t cache_sets,
hwloc_bitmap_t cpuset)
{
struct hwloc_obj *c = NULL;
if ( (0 == cache_line_size) && (0 == cache_size) )
return;
c = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, -1);
c->attr->cache.depth = level;
c->attr->cache.linesize = cache_line_size;
c->attr->cache.size = cache_size;
c->attr->cache.type = type;
if (cache_sets == 1)
/* likely wrong, make it unknown */
cache_sets = 0;
if (cache_sets)
c->attr->cache.associativity = cache_size / (cache_sets * cache_line_size);
else
c->attr->cache.associativity = 0;
c->cpuset = hwloc_bitmap_dup(cpuset);
hwloc_debug_2args_bitmap("cache (%s) depth %d has cpuset %s\n",
type == HWLOC_OBJ_CACHE_UNIFIED ? "unified" : (type == HWLOC_OBJ_CACHE_DATA ? "data" : "instruction"),
level, c->cpuset);
hwloc_insert_object_by_cpuset(topology, c);
}
static void
try_add_cache_from_device_tree_cpu(struct hwloc_topology *topology,
const char *cpu, unsigned int level, hwloc_bitmap_t cpuset)
{
/* Ignore Instruction caches */
/* d-cache-block-size - ignore */
/* d-cache-line-size - to read, in bytes */
/* d-cache-sets - ignore */
/* d-cache-size - to read, in bytes */
/* d-cache-size - to read, in bytes */
/* i-cache, same for instruction */
/* cache-unified only exist if data and instruction caches are unified */
/* d-tlb-sets - ignore */
/* d-tlb-size - ignore, always 0 on power6 */
/* i-cache-* and i-tlb-* represent instruction cache, ignore */
/* i-tlb-*, same */
uint32_t d_cache_line_size = 0, d_cache_size = 0, d_cache_sets = 0;
struct hwloc_obj *c = NULL;
uint32_t i_cache_line_size = 0, i_cache_size = 0, i_cache_sets = 0;
char unified_path[1024];
struct stat statbuf;
int unified;
snprintf(unified_path, sizeof(unified_path), "%s/cache-unified", cpu);
unified = (hwloc_stat(unified_path, &statbuf, topology->backend_params.linuxfs.root_fd) == 0);
hwloc_read_unit32be(cpu, "d-cache-line-size", &d_cache_line_size,
topology->backend_params.linuxfs.root_fd);
@ -2339,24 +2389,18 @@ try_add_cache_from_device_tree_cpu(struct hwloc_topology *topology,
topology->backend_params.linuxfs.root_fd);
hwloc_read_unit32be(cpu, "d-cache-sets", &d_cache_sets,
topology->backend_params.linuxfs.root_fd);
hwloc_read_unit32be(cpu, "i-cache-line-size", &i_cache_line_size,
topology->backend_params.linuxfs.root_fd);
hwloc_read_unit32be(cpu, "i-cache-size", &i_cache_size,
topology->backend_params.linuxfs.root_fd);
hwloc_read_unit32be(cpu, "i-cache-sets", &i_cache_sets,
topology->backend_params.linuxfs.root_fd);
if ( (0 == d_cache_line_size) && (0 == d_cache_size) )
return;
c = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, -1);
c->attr->cache.depth = level;
c->attr->cache.linesize = d_cache_line_size;
c->attr->cache.size = d_cache_size;
if (d_cache_sets == 1)
/* likely wrong, make it unknown */
d_cache_sets = 0;
if (d_cache_sets)
c->attr->cache.associativity = d_cache_size / (d_cache_sets * d_cache_line_size);
else
c->attr->cache.associativity = 0;
c->cpuset = hwloc_bitmap_dup(cpuset);
hwloc_debug_1arg_bitmap("cache depth %d has cpuset %s\n", level, c->cpuset);
hwloc_insert_object_by_cpuset(topology, c);
if (!unified)
try__add_cache_from_device_tree_cpu(topology, level, HWLOC_OBJ_CACHE_INSTRUCTION,
i_cache_line_size, i_cache_size, i_cache_sets, cpuset);
try__add_cache_from_device_tree_cpu(topology, level, unified ? HWLOC_OBJ_CACHE_UNIFIED : HWLOC_OBJ_CACHE_DATA,
d_cache_line_size, d_cache_size, d_cache_sets, cpuset);
}
/*
@ -2693,6 +2737,7 @@ look_sysfscpu(struct hwloc_topology *topology, const char *path,
unsigned linesize = 0;
unsigned sets = 0, lines_per_tag = 1;
int depth; /* 0 for L1, .... */
hwloc_obj_cache_type_t type = HWLOC_OBJ_CACHE_UNIFIED; /* default */
/* get the cache level depth */
sprintf(mappath, "%s/cpu%d/cache/index%d/level", path, i, j);
@ -2706,13 +2751,19 @@ look_sysfscpu(struct hwloc_topology *topology, const char *path,
} else
continue;
/* ignore Instruction caches */
/* cache type */
sprintf(mappath, "%s/cpu%d/cache/index%d/type", path, i, j);
fd = hwloc_fopen(mappath, "r", topology->backend_params.linuxfs.root_fd);
if (fd) {
if (fgets(str2, sizeof(str2), fd)) {
fclose(fd);
if (!strncmp(str2, "Instruction", 11))
if (!strncmp(str2, "Data", 4))
type = HWLOC_OBJ_CACHE_DATA;
else if (!strncmp(str2, "Unified", 7))
type = HWLOC_OBJ_CACHE_UNIFIED;
else if (!strncmp(str2, "Instruction", 11))
type = HWLOC_OBJ_CACHE_INSTRUCTION;
else
continue;
} else {
fclose(fd);
@ -2777,6 +2828,7 @@ look_sysfscpu(struct hwloc_topology *topology, const char *path,
cache->attr->cache.size = kB << 10;
cache->attr->cache.depth = depth+1;
cache->attr->cache.linesize = linesize;
cache->attr->cache.type = type;
if (!sets)
cache->attr->cache.associativity = 0; /* unknown */
else if (sets == 1)
@ -3347,3 +3399,335 @@ hwloc_set_linuxfs_hooks(struct hwloc_topology *topology)
topology->support.membind->migrate_membind = 1;
#endif
}
/*
* Linux PCI callback
*
* Does not support changing the fsroot
*/
static hwloc_obj_t
hwloc_linux_add_os_device(struct hwloc_topology *topology, struct hwloc_obj *pcidev, hwloc_obj_osdev_type_t type, const char *name)
{
struct hwloc_obj *obj = hwloc_alloc_setup_object(HWLOC_OBJ_OS_DEVICE, -1);
obj->name = strdup(name);
obj->logical_index = -1;
obj->attr->osdev.type = type;
hwloc_insert_object_by_parent(topology, pcidev, obj);
return obj;
}
typedef void (*hwloc_linux_class_fillinfos_t)(struct hwloc_topology *topology, struct hwloc_obj *osdev, const char *osdevpath);
/* look for objects of the given class below a sysfs directory */
static void
hwloc_linux_class_readdir(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *devicepath,
hwloc_obj_osdev_type_t type, const char *classname,
hwloc_linux_class_fillinfos_t fillinfo)
{
size_t classnamelen = strlen(classname);
char path[256];
DIR *dir;
struct dirent *dirent;
hwloc_obj_t obj;
snprintf(path, sizeof(path), "%s/%s", devicepath, classname);
dir = opendir(path);
if (dir) {
/* modern sysfs: <device>/<class>/<name> */
while ((dirent = readdir(dir)) != NULL) {
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
continue;
obj = hwloc_linux_add_os_device(topology, pcidev, type, dirent->d_name);
if (fillinfo) {
snprintf(path, sizeof(path), "%s/%s/%s", devicepath, classname, dirent->d_name);
fillinfo(topology, obj, path);
}
}
closedir(dir);
} else {
/* deprecated sysfs: <device>/<class>:<name> */
dir = opendir(devicepath);
if (dir) {
while ((dirent = readdir(dir)) != NULL) {
if (strncmp(dirent->d_name, classname, classnamelen) || dirent->d_name[classnamelen] != ':')
continue;
obj = hwloc_linux_add_os_device(topology, pcidev, type, dirent->d_name + classnamelen+1);
if (fillinfo) {
snprintf(path, sizeof(path), "%s/%s", devicepath, dirent->d_name);
fillinfo(topology, obj, path);
}
}
closedir(dir);
}
}
}
/* class objects that are immediately below pci devices */
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");
if (fd) {
char address[128];
if (fgets(address, sizeof(address), fd)) {
char *eol = strchr(address, '\n');
if (eol)
*eol = 0;
hwloc_obj_add_info(obj, "Address", address);
}
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)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_NETWORK, "net", hwloc_linux_net_class_fillinfos);
}
static void
hwloc_linux_lookup_openfabrics_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_OPENFABRICS, "infiniband", NULL);
}
static void
hwloc_linux_lookup_dma_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_DMA, "dma", NULL);
}
static void
hwloc_linux_lookup_drm_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
hwloc_linux_class_readdir(topology, pcidev, pcidevpath, HWLOC_OBJ_OSDEV_GPU, "drm", NULL);
/* we could look at the "graphics" class too, but it doesn't help for proprietary drivers either */
/* GPU devices (even with a proprietary driver) seem to have a boot_vga field in their PCI device directory (since 2.6.30),
* so we could create a OS device for each PCI devices with such a field.
* boot_vga is actually created when class >> 8 == VGA (it contains 1 for boot vga device), so it's trivial anyway.
*/
}
/* block class objects are in
* host%d/target%d:%d:%d/%d:%d:%d:%d/
* or
* host%d/port-%d:%d/end_device-%d:%d/target%d:%d:%d/%d:%d:%d:%d/
* or
* ide%d/%d.%d/
* below pci devices */
static void
hwloc_linux_lookup_host_block_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, char *path, size_t pathlen)
{
DIR *hostdir, *portdir, *targetdir;
struct dirent *hostdirent, *portdirent, *targetdirent;
int dummy;
hostdir = opendir(path);
if (!hostdir)
return;
while ((hostdirent = readdir(hostdir)) != NULL) {
if (sscanf(hostdirent->d_name, "port-%d:%d", &dummy, &dummy) == 2)
{
/* found host%d/port-%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
portdir = opendir(path);
if (!portdir)
continue;
while ((portdirent = readdir(portdir)) != NULL) {
if (sscanf(portdirent->d_name, "end_device-%d:%d", &dummy, &dummy) == 2) {
/* found host%d/port-%d:%d/end_device-%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], portdirent->d_name);
pathlen += 1+strlen(portdirent->d_name);
hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen);
/* restore parent path */
pathlen -= 1+strlen(portdirent->d_name);
path[pathlen] = '\0';
}
}
closedir(portdir);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
continue;
} else if (sscanf(hostdirent->d_name, "target%d:%d:%d", &dummy, &dummy, &dummy) == 3) {
/* found host%d/target%d:%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
targetdir = opendir(path);
if (!targetdir)
continue;
while ((targetdirent = readdir(targetdir)) != NULL) {
if (sscanf(targetdirent->d_name, "%d:%d:%d:%d", &dummy, &dummy, &dummy, &dummy) != 4)
continue;
/* found host%d/target%d:%d:%d/%d:%d:%d:%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], targetdirent->d_name);
pathlen += 1+strlen(targetdirent->d_name);
/* lookup block class for real */
hwloc_linux_class_readdir(topology, pcidev, path, HWLOC_OBJ_OSDEV_BLOCK, "block", NULL);
/* restore parent path */
pathlen -= 1+strlen(targetdirent->d_name);
path[pathlen] = '\0';
}
closedir(targetdir);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
}
}
closedir(hostdir);
}
static void
hwloc_linux_lookup_block_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)
{
size_t pathlen;
DIR *devicedir, *hostdir;
struct dirent *devicedirent, *hostdirent;
char path[256];
int dummy;
strcpy(path, pcidevpath);
pathlen = strlen(path);
devicedir = opendir(pcidevpath);
if (!devicedir)
return;
while ((devicedirent = readdir(devicedir)) != NULL) {
if (sscanf(devicedirent->d_name, "ide%d", &dummy) == 1) {
/* found ide%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], devicedirent->d_name);
pathlen += 1+strlen(devicedirent->d_name);
hostdir = opendir(path);
if (!hostdir)
continue;
while ((hostdirent = readdir(hostdir)) != NULL) {
if (sscanf(hostdirent->d_name, "%d.%d", &dummy, &dummy) == 2) {
/* found ide%d/%d.%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
/* lookup block class for real */
hwloc_linux_class_readdir(topology, pcidev, path, HWLOC_OBJ_OSDEV_BLOCK, "block", NULL);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
}
}
/* restore parent path */
pathlen -= 1+strlen(devicedirent->d_name);
path[pathlen] = '\0';
} else if (sscanf(devicedirent->d_name, "host%d", &dummy) == 1) {
/* found host%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], devicedirent->d_name);
pathlen += 1+strlen(devicedirent->d_name);
hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen);
/* restore parent path */
pathlen -= 1+strlen(devicedirent->d_name);
path[pathlen] = '\0';
} else if (sscanf(devicedirent->d_name, "ata%d", &dummy) == 1) {
/* found ata%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], devicedirent->d_name);
pathlen += 1+strlen(devicedirent->d_name);
hostdir = opendir(path);
if (!hostdir)
continue;
while ((hostdirent = readdir(hostdir)) != NULL) {
if (sscanf(hostdirent->d_name, "host%d", &dummy) == 1) {
/* found ata%d/host%d */
path[pathlen] = '/';
strcpy(&path[pathlen+1], hostdirent->d_name);
pathlen += 1+strlen(hostdirent->d_name);
/* lookup block class for real */
hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen);
/* restore parent path */
pathlen -= 1+strlen(hostdirent->d_name);
path[pathlen] = '\0';
}
}
/* restore parent path */
pathlen -= 1+strlen(devicedirent->d_name);
path[pathlen] = '\0';
}
}
closedir(devicedir);
}
void
hwloc_linuxfs_pci_lookup_osdevices(struct hwloc_topology *topology, struct hwloc_obj *pcidev)
{
char pcidevpath[256];
/* this should not be called if the backend isn't the real OS one */
if (topology->backend_params.linuxfs.root_path) {
assert(strlen(topology->backend_params.linuxfs.root_path) == 1);
assert(topology->backend_params.linuxfs.root_path[0] == '/');
}
snprintf(pcidevpath, sizeof(pcidevpath), "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/",
pcidev->attr->pcidev.domain, pcidev->attr->pcidev.bus,
pcidev->attr->pcidev.dev, pcidev->attr->pcidev.func);
hwloc_linux_lookup_net_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_openfabrics_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_dma_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_drm_class(topology, pcidev, pcidevpath);
hwloc_linux_lookup_block_class(topology, pcidev, pcidevpath);
}
int
hwloc_linuxfs_get_pcidev_cpuset(struct hwloc_topology *topology __hwloc_attribute_unused,
struct hwloc_obj *pcidev, hwloc_bitmap_t cpuset)
{
char path[256];
FILE *file;
int err;
/* this should not be called if the backend isn't the real OS one */
if (topology->backend_params.linuxfs.root_path) {
assert(strlen(topology->backend_params.linuxfs.root_path) == 1);
assert(topology->backend_params.linuxfs.root_path[0] == '/');
}
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/local_cpus",
pcidev->attr->pcidev.domain, pcidev->attr->pcidev.bus,
pcidev->attr->pcidev.dev, pcidev->attr->pcidev.func);
file = fopen(path, "r"); /* the libpci backend doesn't use sysfs.fsroot */
if (file) {
err = hwloc_linux_parse_cpumap_file(file, cpuset);
fclose(file);
if (!err && !hwloc_bitmap_iszero(cpuset))
return 0;
}
return -1;
}

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

@ -9,8 +9,12 @@
#include <private/autogen/config.h>
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <stdio.h>

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 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.
* Copyright © 2011 Oracle and/or its affiliates. All rights reserved.
@ -15,8 +15,12 @@
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/processor.h>
#include <sys/procset.h>
@ -438,7 +442,6 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
#ifdef HAVE_LIBKSTAT
#include <kstat.h>
#define HWLOC_NBMAXCPUS 1024 /* FIXME: drop */
static int
hwloc_look_kstat(struct hwloc_topology *topology)
{
@ -451,38 +454,48 @@ hwloc_look_kstat(struct hwloc_topology *topology)
kstat_named_t *stat;
unsigned look_cores = 1, look_chips = 1;
unsigned numsockets = 0;
unsigned proc_physids[HWLOC_NBMAXCPUS];
unsigned proc_osphysids[HWLOC_NBMAXCPUS];
unsigned osphysids[HWLOC_NBMAXCPUS];
unsigned Pproc_max = 0;
unsigned Pproc_alloc = 256;
struct hwloc_solaris_Pproc {
unsigned Lsock, Psock, Lcore, Lproc;
} * Pproc = malloc(Pproc_alloc * sizeof(*Pproc));
unsigned numcores = 0;
unsigned proc_coreids[HWLOC_NBMAXCPUS];
unsigned oscoreids[HWLOC_NBMAXCPUS];
unsigned Lproc_num = 0;
unsigned Lproc_alloc = 256;
struct hwloc_solaris_Lproc {
unsigned Pproc;
} * Lproc = malloc(Lproc_alloc * sizeof(*Lproc));
unsigned core_osphysids[HWLOC_NBMAXCPUS];
unsigned Lcore_num = 0;
unsigned Lcore_alloc = 256;
struct hwloc_solaris_Lcore {
unsigned Pcore, Psock;
} * Lcore = malloc(Lcore_alloc * sizeof(*Lcore));
unsigned numprocs = 0;
unsigned proc_procids[HWLOC_NBMAXCPUS];
unsigned osprocids[HWLOC_NBMAXCPUS];
unsigned Lsock_num = 0;
unsigned Lsock_alloc = 256;
struct hwloc_solaris_Lsock {
unsigned Psock;
} * Lsock = malloc(Lsock_alloc * sizeof(*Lsock));
unsigned physid, coreid, cpuid;
unsigned procid_max = 0;
unsigned sockid, coreid, cpuid;
unsigned i;
for (cpuid = 0; cpuid < HWLOC_NBMAXCPUS; cpuid++)
{
proc_procids[cpuid] = -1;
proc_physids[cpuid] = -1;
proc_osphysids[cpuid] = -1;
proc_coreids[cpuid] = -1;
}
for (i = 0; i < Pproc_alloc; i++) {
Pproc[i].Lproc = -1;
Pproc[i].Lsock = -1;
Pproc[i].Psock = -1;
Pproc[i].Lcore = -1;
}
if (!kc)
{
hwloc_debug("kstat_open failed: %s\n", strerror(errno));
return 0;
}
if (!kc) {
hwloc_debug("kstat_open failed: %s\n", strerror(errno));
free(Pproc);
free(Lproc);
free(Lcore);
free(Lsock);
return 0;
}
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next)
{
@ -490,11 +503,6 @@ hwloc_look_kstat(struct hwloc_topology *topology)
continue;
cpuid = ksp->ks_instance;
if (cpuid > HWLOC_NBMAXCPUS)
{
fprintf(stderr,"CPU id too big: %u\n", cpuid);
continue;
}
if (kstat_read(kc, ksp, NULL) == -1)
{
@ -503,12 +511,28 @@ hwloc_look_kstat(struct hwloc_topology *topology)
}
hwloc_debug("cpu%u\n", cpuid);
proc_procids[cpuid] = numprocs;
osprocids[numprocs] = cpuid;
numprocs++;
if (cpuid >= procid_max)
procid_max = cpuid + 1;
if (cpuid >= Pproc_alloc) {
Pproc_alloc *= 2;
Pproc = realloc(Pproc, Pproc_alloc * sizeof(*Pproc));
for(i = Pproc_alloc/2; i < Pproc_alloc; i++) {
Pproc[i].Lproc = -1;
Pproc[i].Lsock = -1;
Pproc[i].Psock = -1;
Pproc[i].Lcore = -1;
}
}
Pproc[cpuid].Lproc = Lproc_num;
if (Lproc_num >= Lproc_alloc) {
Lproc_alloc *= 2;
Lproc = realloc(Lproc, Lproc_alloc * sizeof(*Lproc));
}
Lproc[Lproc_num].Pproc = cpuid;
Lproc_num++;
if (cpuid >= Pproc_max)
Pproc_max = cpuid + 1;
stat = (kstat_named_t *) kstat_data_lookup(ksp, "state");
if (!stat)
@ -528,7 +552,7 @@ hwloc_look_kstat(struct hwloc_topology *topology)
stat = (kstat_named_t *) kstat_data_lookup(ksp, "chip_id");
if (!stat)
{
if (numsockets)
if (Lsock_num)
fprintf(stderr, "could not read socket id for CPU%u: %s\n", cpuid, strerror(errno));
else
hwloc_debug("could not read socket id for CPU%u: %s\n", cpuid, strerror(errno));
@ -537,17 +561,17 @@ hwloc_look_kstat(struct hwloc_topology *topology)
}
switch (stat->data_type) {
case KSTAT_DATA_INT32:
physid = stat->value.i32;
sockid = stat->value.i32;
break;
case KSTAT_DATA_UINT32:
physid = stat->value.ui32;
sockid = stat->value.ui32;
break;
#ifdef _INT64_TYPE
case KSTAT_DATA_UINT64:
physid = stat->value.ui64;
sockid = stat->value.ui64;
break;
case KSTAT_DATA_INT64:
physid = stat->value.i64;
sockid = stat->value.i64;
break;
#endif
default:
@ -555,14 +579,19 @@ hwloc_look_kstat(struct hwloc_topology *topology)
look_chips = 0;
continue;
}
proc_osphysids[cpuid] = physid;
for (i = 0; i < numsockets; i++)
if (physid == osphysids[i])
Pproc[cpuid].Psock = sockid;
for (i = 0; i < Lsock_num; i++)
if (sockid == Lsock[i].Psock)
break;
proc_physids[cpuid] = i;
hwloc_debug("%u on socket %u (%u)\n", cpuid, i, physid);
if (i == numsockets)
osphysids[numsockets++] = physid;
Pproc[cpuid].Lsock = i;
hwloc_debug("%u on socket %u (%u)\n", cpuid, i, sockid);
if (i == Lsock_num) {
if (Lsock_num == Lsock_alloc) {
Lsock_alloc *= 2;
Lsock = realloc(Lsock, Lsock_alloc * sizeof(*Lsock));
}
Lsock[Lsock_num++].Psock = sockid;
}
} while(0);
if (look_cores) do {
@ -570,7 +599,7 @@ hwloc_look_kstat(struct hwloc_topology *topology)
stat = (kstat_named_t *) kstat_data_lookup(ksp, "core_id");
if (!stat)
{
if (numcores)
if (Lcore_num)
fprintf(stderr, "could not read core id for CPU%u: %s\n", cpuid, strerror(errno));
else
hwloc_debug("could not read core id for CPU%u: %s\n", cpuid, strerror(errno));
@ -597,16 +626,19 @@ hwloc_look_kstat(struct hwloc_topology *topology)
look_cores = 0;
continue;
}
for (i = 0; i < numcores; i++)
if (coreid == oscoreids[i] && proc_osphysids[cpuid] == core_osphysids[i])
for (i = 0; i < Lcore_num; i++)
if (coreid == Lcore[i].Pcore && Pproc[cpuid].Psock == Lcore[i].Psock)
break;
proc_coreids[cpuid] = i;
Pproc[cpuid].Lcore = i;
hwloc_debug("%u on core %u (%u)\n", cpuid, i, coreid);
if (i == numcores)
{
core_osphysids[numcores] = proc_osphysids[cpuid];
oscoreids[numcores++] = coreid;
if (i == Lcore_num) {
if (Lcore_num == Lcore_alloc) {
Lcore_alloc *= 2;
Lcore = realloc(Lcore, Lcore_alloc * sizeof(*Lcore));
}
Lcore[Lcore_num].Psock = Pproc[cpuid].Psock;
Lcore[Lcore_num++].Pcore = coreid;
}
} while(0);
/* Note: there is also clog_id for the Thread ID (not unique) and
@ -616,30 +648,63 @@ hwloc_look_kstat(struct hwloc_topology *topology)
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]);
unsigned j,k;
hwloc_debug("%d Sockets\n", Lsock_num);
for (j = 0; j < Lsock_num; j++) {
obj = hwloc_alloc_setup_object(HWLOC_OBJ_SOCKET, Lsock[j].Psock);
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);
obj->cpuset = hwloc_bitmap_alloc();
for(k=0; k<Pproc_max; k++)
if (Pproc[k].Lsock == j)
hwloc_bitmap_set(obj->cpuset, k);
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);
if (numprocs)
hwloc_setup_level(procid_max, numprocs, osprocids, proc_procids, topology, HWLOC_OBJ_PU);
if (look_cores) {
struct hwloc_obj *obj;
unsigned j,k;
hwloc_debug("%d Cores\n", Lcore_num);
for (j = 0; j < Lcore_num; j++) {
obj = hwloc_alloc_setup_object(HWLOC_OBJ_CORE, Lcore[j].Pcore);
obj->cpuset = hwloc_bitmap_alloc();
for(k=0; k<Pproc_max; k++)
if (Pproc[k].Lcore == j)
hwloc_bitmap_set(obj->cpuset, k);
hwloc_debug_1arg_bitmap("Core %d has cpuset %s\n", j, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
hwloc_debug("%s", "\n");
}
if (Lproc_num) {
struct hwloc_obj *obj;
unsigned j,k;
hwloc_debug("%d PUs\n", Lproc_num);
for (j = 0; j < Lproc_num; j++) {
obj = hwloc_alloc_setup_object(HWLOC_OBJ_PU, Lproc[j].Pproc);
obj->cpuset = hwloc_bitmap_alloc();
for(k=0; k<Pproc_max; k++)
if (Pproc[k].Lproc == j)
hwloc_bitmap_set(obj->cpuset, k);
hwloc_debug_1arg_bitmap("PU %d has cpuset %s\n", j, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
hwloc_debug("%s", "\n");
}
kstat_close(kc);
return numprocs > 0;
free(Pproc);
free(Lproc);
free(Lcore);
free(Lsock);
return Lproc_num > 0;
}
#endif /* LIBKSTAT */

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 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.
@ -59,7 +59,7 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
type = HWLOC_OBJ_CORE;
else if (!hwloc_namecoloncmp(pos, "caches", 2))
type = HWLOC_OBJ_CACHE;
else if (!hwloc_namecoloncmp(pos, "pus", 1) || !hwloc_namecoloncmp(pos, "procs", 1) /* backward compatiblity with 0.9 */)
else if (!hwloc_namecoloncmp(pos, "pus", 1))
type = HWLOC_OBJ_PU;
else if (!hwloc_namecoloncmp(pos, "misc", 2))
type = HWLOC_OBJ_MISC;
@ -219,6 +219,7 @@ void
hwloc_backend_synthetic_exit(struct hwloc_topology *topology)
{
assert(topology->backend_type == HWLOC_BACKEND_SYNTHETIC);
topology->is_thissystem = 1;
free(topology->backend_params.synthetic.string);
topology->backend_type = HWLOC_BACKEND_NONE;
}
@ -317,12 +318,15 @@ hwloc__look_synthetic(struct hwloc_topology *topology,
case HWLOC_OBJ_CACHE:
obj->attr->cache.depth = topology->backend_params.synthetic.depth[level];
obj->attr->cache.linesize = 64;
if (obj->attr->cache.depth == 1)
/* 32Kb in L1 */
if (obj->attr->cache.depth == 1) {
/* 32Kb in L1d */
obj->attr->cache.size = 32*1024;
else
/* *4 at each level, starting from 1MB for L2 */
obj->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
} else {
/* *4 at each level, starting from 1MB for L2, unified */
obj->attr->cache.size = 256*1024 << (2*obj->attr->cache.depth);
obj->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
}
break;
case HWLOC_OBJ_CORE:
break;

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -172,6 +172,18 @@ typedef struct _PSAPI_WORKING_SET_EX_INFORMATION {
} PSAPI_WORKING_SET_EX_INFORMATION;
#endif
static void hwloc_bitmap_set_ith_ULONG_PTR(hwloc_bitmap_t set, unsigned i, ULONG_PTR mask)
{
/* ULONG_PTR is 64/32bits depending on the arch
* while unsigned long is always 32bits */
#if SIZEOF_VOID_P == 8
hwloc_bitmap_set_ith_ulong(set, 2*i, mask & 0xffffffff);
hwloc_bitmap_set_ith_ulong(set, 2*i+1, mask >> 32);
#else
hwloc_bitmap_set_ith_ulong(set, i, mask);
#endif
}
/* TODO: SetThreadIdealProcessor */
static int
@ -502,10 +514,11 @@ hwloc_look_windows(struct hwloc_topology *topology)
for (i = 0; i < length / sizeof(*procInfo); i++) {
/* Ignore non-data caches */
if (procInfo[i].Relationship == RelationCache
&& procInfo[i].Cache.Type != CacheUnified
&& procInfo[i].Cache.Type != CacheData)
/* Ignore unknown caches */
if (procInfo->Relationship == RelationCache
&& procInfo->Cache.Type != CacheUnified
&& procInfo->Cache.Type != CacheData
&& procInfo->Cache.Type != CacheInstruction)
continue;
id = -1;
@ -532,14 +545,8 @@ 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);
/* 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
/* ProcessorMask is a ULONG_PTR */
hwloc_bitmap_set_ith_ULONG_PTR(obj->cpuset, 0, procInfo[i].ProcessorMask);
hwloc_debug_2args_bitmap("%s#%u bitmap %s\n", hwloc_obj_type_string(type), id, obj->cpuset);
switch (type) {
@ -567,6 +574,20 @@ hwloc_look_windows(struct hwloc_topology *topology)
obj->attr->cache.associativity = procInfo[i].Cache.Associativity == CACHE_FULLY_ASSOCIATIVE ? -1 : procInfo[i].Cache.Associativity ;
obj->attr->cache.linesize = procInfo[i].Cache.LineSize;
obj->attr->cache.depth = procInfo[i].Cache.Level;
switch (procInfo->Cache.Type) {
case CacheUnified:
obj->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
break;
case CacheData:
obj->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
break;
case CacheInstruction:
obj->attr->cache.type = HWLOC_OBJ_CACHE_INSTRUCTION;
break;
default:
hwloc_free_unlinked_object(obj);
continue;
}
break;
case HWLOC_OBJ_GROUP:
obj->attr->group.depth = procInfo[i].Relationship == RelationGroup;
@ -604,10 +625,11 @@ hwloc_look_windows(struct hwloc_topology *topology)
unsigned num, i;
GROUP_AFFINITY *GroupMask;
/* Ignore non-data caches */
/* Ignore unknown caches */
if (procInfo->Relationship == RelationCache
&& procInfo->Cache.Type != CacheUnified
&& procInfo->Cache.Type != CacheData)
&& procInfo->Cache.Type != CacheData
&& procInfo->Cache.Type != CacheInstruction)
continue;
id = -1;
@ -642,14 +664,8 @@ 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);
/* 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
/* KAFFINITY is ULONG_PTR */
hwloc_bitmap_set_ith_ULONG_PTR(obj->cpuset, id, mask);
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);
}
@ -664,14 +680,8 @@ 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);
/* 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
/* GROUP_AFFINITY.Mask is KAFFINITY, which is ULONG_PTR */
hwloc_bitmap_set_ith_ULONG_PTR(obj->cpuset, GroupMask[i].Group, GroupMask[i].Mask);
}
hwloc_debug("%s#%u bitmap %s\n", hwloc_obj_type_string(type), id, obj->cpuset);
@ -700,6 +710,20 @@ hwloc_look_windows(struct hwloc_topology *topology)
obj->attr->cache.associativity = procInfo->Cache.Associativity == CACHE_FULLY_ASSOCIATIVE ? -1 : procInfo->Cache.Associativity ;
obj->attr->cache.linesize = procInfo->Cache.LineSize;
obj->attr->cache.depth = procInfo->Cache.Level;
switch (procInfo->Cache.Type) {
case CacheUnified:
obj->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
break;
case CacheData:
obj->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
break;
case CacheInstruction:
obj->attr->cache.type = HWLOC_OBJ_CACHE_INSTRUCTION;
break;
default:
hwloc_free_unlinked_object(obj);
continue;
}
break;
default:
break;

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

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2011 inria. All rights reserved.
* Copyright © 2010-2012 inria. All rights reserved.
* Copyright © 2010-2012 Université Bordeaux 1
* Copyright © 2010-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -23,6 +23,8 @@
#if defined(HWLOC_HAVE_CPUID)
#include <private/cpuid.h>
#define has_topoext(features) ((features)[6] & (1 << 22))
struct cacheinfo {
unsigned type;
unsigned level;
@ -42,6 +44,8 @@ struct procinfo {
unsigned max_nbcores;
unsigned max_nbthreads;
unsigned socketid;
unsigned nodeid;
unsigned unitid;
unsigned logprocid;
unsigned threadid;
unsigned coreid;
@ -102,7 +106,7 @@ static void fill_amd_cache(struct procinfo *infos, unsigned level, unsigned cpui
/* Fetch information from the processor itself thanks to cpuid and store it in
* infos for summarize to analyze them globally */
static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned highest_ext_cpuid, enum cpuid_type cpuid_type)
static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned highest_ext_cpuid, unsigned *features, enum cpuid_type cpuid_type)
{
unsigned eax, ebx, ecx = 0, edx;
unsigned cachenum;
@ -119,6 +123,8 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
infos->max_log_proc = 1;
hwloc_debug("APIC ID 0x%02x max_log_proc %u\n", infos->apicid, infos->max_log_proc);
infos->socketid = infos->apicid / infos->max_log_proc;
infos->nodeid = (unsigned) -1;
infos->unitid = (unsigned) -1;
infos->logprocid = infos->apicid % infos->max_log_proc;
infos->coreid = (unsigned) -1;
infos->threadid = (unsigned) -1;
@ -147,19 +153,83 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
infos->numcaches = 0;
infos->cache = NULL;
/* Intel doesn't actually provide 0x80000005 information */
if (cpuid_type != intel && highest_ext_cpuid >= 0x80000005) {
eax = 0x80000005;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
fill_amd_cache(infos, 1, ecx);
}
/* AMD topology extension */
if (cpuid_type != intel && has_topoext(features)) {
unsigned apic_id, node_id, nodes_per_proc, unit_id, cores_per_unit;
/* Intel doesn't actually provide 0x80000006 information */
if (cpuid_type != intel && highest_ext_cpuid >= 0x80000006) {
eax = 0x80000006;
eax = 0x8000001e;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
fill_amd_cache(infos, 2, ecx);
fill_amd_cache(infos, 3, edx);
infos->apicid = apic_id = eax;
infos->nodeid = node_id = ecx & 0xff;
nodes_per_proc = ((ecx >> 8) & 7) + 1;
if (nodes_per_proc > 2) {
hwloc_debug("warning: undefined value %d, assuming it means %d\n", nodes_per_proc, nodes_per_proc);
}
infos->unitid = unit_id = ebx & 0xff;
cores_per_unit = ((ebx >> 8) & 3) + 1;
hwloc_debug("x2APIC %08x, %d nodes, node %d, %d cores in unit %d\n", apic_id, nodes_per_proc, node_id, cores_per_unit, unit_id);
for (cachenum = 0; ; cachenum++) {
unsigned type;
eax = 0x8000001d;
ecx = cachenum;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
type = eax & 0x1f;
if (type == 0)
break;
infos->numcaches++;
}
cache = infos->cache = malloc(infos->numcaches * sizeof(*infos->cache));
for (cachenum = 0; ; cachenum++) {
unsigned linesize, linepart, ways, sets;
unsigned type;
eax = 0x8000001d;
ecx = cachenum;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
type = eax & 0x1f;
if (type == 0)
break;
cache->type = type;
cache->level = (eax >> 5) & 0x7;
/* Note: actually number of cores */
cache->nbthreads_sharing = ((eax >> 14) & 0xfff) + 1;
cache->linesize = linesize = (ebx & 0xfff) + 1;
cache->linepart = linepart = ((ebx >> 12) & 0x3ff) + 1;
ways = ((ebx >> 22) & 0x3ff) + 1;
if (eax & (1 << 9))
/* Fully associative */
cache->ways = -1;
else
cache->ways = ways;
cache->sets = sets = ecx + 1;
cache->size = linesize * linepart * ways * sets;
hwloc_debug("cache %u type %u L%u t%u c%u linesize %u linepart %u ways %u sets %u, size %uKB\n", cachenum, cache->type, cache->level, cache->nbthreads_sharing, infos->max_nbcores, linesize, linepart, ways, sets, cache->size >> 10);
cache++;
}
} else {
/* Intel doesn't actually provide 0x80000005 information */
if (cpuid_type != intel && highest_ext_cpuid >= 0x80000005) {
eax = 0x80000005;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
fill_amd_cache(infos, 1, ecx);
}
/* Intel doesn't actually provide 0x80000006 information */
if (cpuid_type != intel && highest_ext_cpuid >= 0x80000006) {
eax = 0x80000006;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
fill_amd_cache(infos, 2, ecx);
fill_amd_cache(infos, 3, edx);
}
}
/* AMD doesn't actually provide 0x04 information */
@ -176,9 +246,6 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
if (type == 0)
break;
if (type == 2)
/* Instruction cache */
continue;
infos->numcaches++;
}
@ -195,12 +262,8 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
if (type == 0)
break;
if (type == 2)
/* Instruction cache */
continue;
cache->type = type;
cache->level = (eax >> 5) & 0x7;
cache->nbthreads_sharing = ((eax >> 14) & 0xfff) + 1;
infos->max_nbcores = ((eax >> 26) & 0x3f) + 1;
@ -279,7 +342,7 @@ static void look_proc(struct procinfo *infos, unsigned highest_cpuid, unsigned h
static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigned nbprocs)
{
hwloc_bitmap_t complete_cpuset = hwloc_bitmap_alloc();
unsigned i, j, l, level;
unsigned i, j, l, level, type;
int one = -1;
for (i = 0; i < nbprocs; i++)
@ -288,14 +351,16 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
one = i;
}
if (one == -1)
if (one == -1) {
hwloc_bitmap_free(complete_cpuset);
return;
}
/* Look for sockets */
{
hwloc_bitmap_t sockets_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t socket_cpuset;
hwloc_obj_t sock;
hwloc_obj_t socket;
while ((i = hwloc_bitmap_first(sockets_cpuset)) != (unsigned) -1) {
unsigned socketid = infos[i].socketid;
@ -307,15 +372,87 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
hwloc_bitmap_clr(sockets_cpuset, j);
}
}
sock = hwloc_alloc_setup_object(HWLOC_OBJ_SOCKET, socketid);
sock->cpuset = socket_cpuset;
socket = hwloc_alloc_setup_object(HWLOC_OBJ_SOCKET, socketid);
socket->cpuset = socket_cpuset;
hwloc_debug_1arg_bitmap("os socket %u has cpuset %s\n",
socketid, socket_cpuset);
hwloc_insert_object_by_cpuset(topology, sock);
hwloc_insert_object_by_cpuset(topology, socket);
}
hwloc_bitmap_free(sockets_cpuset);
}
/* Look for Numa nodes inside sockets */
{
hwloc_bitmap_t nodes_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t node_cpuset;
hwloc_obj_t node;
while ((i = hwloc_bitmap_first(nodes_cpuset)) != (unsigned) -1) {
unsigned socketid = infos[i].socketid;
unsigned nodeid = infos[i].nodeid;
if (nodeid == (unsigned)-1) {
hwloc_bitmap_clr(nodes_cpuset, i);
continue;
}
node_cpuset = hwloc_bitmap_alloc();
for (j = i; j < nbprocs; j++) {
if (infos[j].nodeid == (unsigned) -1) {
hwloc_bitmap_clr(nodes_cpuset, j);
continue;
}
if (infos[j].socketid == socketid && infos[j].nodeid == nodeid) {
hwloc_bitmap_set(node_cpuset, j);
hwloc_bitmap_clr(nodes_cpuset, j);
}
}
node = hwloc_alloc_setup_object(HWLOC_OBJ_NODE, nodeid);
node->cpuset = node_cpuset;
hwloc_debug_1arg_bitmap("os node %u has cpuset %s\n",
nodeid, node_cpuset);
hwloc_insert_object_by_cpuset(topology, node);
}
hwloc_bitmap_free(nodes_cpuset);
}
/* Look for Compute units inside sockets */
{
hwloc_bitmap_t units_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t unit_cpuset;
hwloc_obj_t unit;
while ((i = hwloc_bitmap_first(units_cpuset)) != (unsigned) -1) {
unsigned socketid = infos[i].socketid;
unsigned unitid = infos[i].unitid;
if (unitid == (unsigned)-1) {
hwloc_bitmap_clr(units_cpuset, i);
continue;
}
unit_cpuset = hwloc_bitmap_alloc();
for (j = i; j < nbprocs; j++) {
if (infos[j].unitid == (unsigned) -1) {
hwloc_bitmap_clr(units_cpuset, j);
continue;
}
if (infos[j].socketid == socketid && infos[j].unitid == unitid) {
hwloc_bitmap_set(unit_cpuset, j);
hwloc_bitmap_clr(units_cpuset, j);
}
}
unit = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, unitid);
unit->cpuset = unit_cpuset;
hwloc_debug_1arg_bitmap("os unit %u has cpuset %s\n",
unitid, unit_cpuset);
hwloc_insert_object_by_cpuset(topology, unit);
}
hwloc_bitmap_free(units_cpuset);
}
/* Look for unknown objects */
if (infos[one].otherids) {
for (level = infos[one].levels-1; level <= infos[one].levels-1; level--) {
@ -390,58 +527,73 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
if (infos[i].cache[j].level > level)
level = infos[i].cache[j].level;
/* Look for known types */
while (level > 0) {
/* Look for caches at level level */
{
hwloc_bitmap_t caches_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t cache_cpuset;
hwloc_obj_t cache;
for (type = 1; type <= 3; type++) {
/* Look for caches of that type at level level */
{
hwloc_bitmap_t caches_cpuset = hwloc_bitmap_dup(complete_cpuset);
hwloc_bitmap_t cache_cpuset;
hwloc_obj_t cache;
while ((i = hwloc_bitmap_first(caches_cpuset)) != (unsigned) -1) {
unsigned socketid = infos[i].socketid;
while ((i = hwloc_bitmap_first(caches_cpuset)) != (unsigned) -1) {
unsigned socketid = infos[i].socketid;
for (l = 0; l < infos[i].numcaches; l++) {
if (infos[i].cache[l].level == level)
break;
}
if (l == infos[i].numcaches) {
/* no cache Llevel in i, odd */
hwloc_bitmap_clr(caches_cpuset, i);
continue;
}
for (l = 0; l < infos[i].numcaches; l++) {
if (infos[i].cache[l].level == level && infos[i].cache[l].type == type)
break;
}
if (l == infos[i].numcaches) {
/* no cache Llevel of that type in i */
hwloc_bitmap_clr(caches_cpuset, i);
continue;
}
{
unsigned cacheid = infos[i].apicid / infos[i].cache[l].nbthreads_sharing;
/* Found a matching cache, now look for others sharing it */
{
unsigned cacheid = infos[i].apicid / infos[i].cache[l].nbthreads_sharing;
cache_cpuset = hwloc_bitmap_alloc();
for (j = i; j < nbprocs; j++) {
unsigned l2;
for (l2 = 0; l2 < infos[j].numcaches; l2++) {
if (infos[j].cache[l2].level == level)
break;
}
if (l2 == infos[j].numcaches) {
/* no cache Llevel in j, odd */
hwloc_bitmap_clr(caches_cpuset, j);
continue;
}
if (infos[j].socketid == socketid && infos[j].apicid / infos[j].cache[l2].nbthreads_sharing == cacheid) {
hwloc_bitmap_set(cache_cpuset, j);
hwloc_bitmap_clr(caches_cpuset, j);
}
}
cache = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, cacheid);
cache->attr->cache.depth = level;
cache->attr->cache.size = infos[i].cache[l].size;
cache->attr->cache.linesize = infos[i].cache[l].linesize;
cache->attr->cache.associativity = infos[i].cache[l].ways;
cache->cpuset = cache_cpuset;
hwloc_debug_2args_bitmap("os L%u cache %u has cpuset %s\n",
level, cacheid, cache_cpuset);
hwloc_insert_object_by_cpuset(topology, cache);
}
cache_cpuset = hwloc_bitmap_alloc();
for (j = i; j < nbprocs; j++) {
unsigned l2;
for (l2 = 0; l2 < infos[j].numcaches; l2++) {
if (infos[j].cache[l2].level == level && infos[j].cache[l2].type == type)
break;
}
if (l2 == infos[j].numcaches) {
/* no cache Llevel of that type in j */
hwloc_bitmap_clr(caches_cpuset, j);
continue;
}
if (infos[j].socketid == socketid && infos[j].apicid / infos[j].cache[l2].nbthreads_sharing == cacheid) {
hwloc_bitmap_set(cache_cpuset, j);
hwloc_bitmap_clr(caches_cpuset, j);
}
}
cache = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, cacheid);
cache->attr->cache.depth = level;
cache->attr->cache.size = infos[i].cache[l].size;
cache->attr->cache.linesize = infos[i].cache[l].linesize;
cache->attr->cache.associativity = infos[i].cache[l].ways;
switch (infos[i].cache[l].type) {
case 1:
cache->attr->cache.type = HWLOC_OBJ_CACHE_DATA;
break;
case 2:
cache->attr->cache.type = HWLOC_OBJ_CACHE_INSTRUCTION;
break;
case 3:
cache->attr->cache.type = HWLOC_OBJ_CACHE_UNIFIED;
break;
}
cache->cpuset = cache_cpuset;
hwloc_debug_2args_bitmap("os L%u cache %u has cpuset %s\n",
level, cacheid, cache_cpuset);
hwloc_insert_object_by_cpuset(topology, cache);
}
}
hwloc_bitmap_free(caches_cpuset);
}
hwloc_bitmap_free(caches_cpuset);
}
level--;
}
@ -451,6 +603,8 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigne
if (infos[i].otherids)
free(infos[i].otherids);
}
hwloc_bitmap_free(complete_cpuset);
}
#define INTEL_EBX ('G' | ('e'<<8) | ('n'<<16) | ('u'<<24))
@ -471,6 +625,8 @@ void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs __hwloc_at
unsigned i;
unsigned highest_cpuid;
unsigned highest_ext_cpuid;
/* This stores cpuid features with the same indexing as Linux */
unsigned features[10] = { 0 };
struct procinfo *infos = NULL;
enum cpuid_type cpuid_type = unknown;
@ -495,12 +651,30 @@ void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs __hwloc_at
goto free;
}
eax = 0x01;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
features[0] = edx;
features[4] = ecx;
eax = 0x80000000;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
highest_ext_cpuid = eax;
hwloc_debug("highest extended cpuid %x\n", highest_ext_cpuid);
if (highest_cpuid >= 0x7) {
eax = 0x7;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
features[9] = ebx;
}
if (cpuid_type != intel && highest_ext_cpuid >= 0x80000001) {
eax = 0x80000001;
hwloc_cpuid(&eax, &ebx, &ecx, &edx);
features[1] = edx;
features[6] = ecx;
}
orig_cpuset = hwloc_bitmap_alloc();
if (topology->get_thisthread_cpubind && topology->set_thisthread_cpubind) {
@ -510,7 +684,7 @@ void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs __hwloc_at
hwloc_bitmap_only(cpuset, i);
if (topology->set_thisthread_cpubind(topology, cpuset, HWLOC_CPUBIND_STRICT))
continue;
look_proc(&infos[i], highest_cpuid, highest_ext_cpuid, cpuid_type);
look_proc(&infos[i], highest_cpuid, highest_ext_cpuid, features, cpuid_type);
}
hwloc_bitmap_free(cpuset);
topology->set_thisthread_cpubind(topology, orig_cpuset, 0);
@ -526,7 +700,7 @@ void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs __hwloc_at
hwloc_bitmap_only(cpuset, i);
if (topology->set_thisproc_cpubind(topology, cpuset, HWLOC_CPUBIND_STRICT))
continue;
look_proc(&infos[i], highest_cpuid, highest_ext_cpuid, cpuid_type);
look_proc(&infos[i], highest_cpuid, highest_ext_cpuid, features, cpuid_type);
}
hwloc_bitmap_free(cpuset);
topology->set_thisproc_cpubind(topology, orig_cpuset, 0);
@ -535,6 +709,7 @@ void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs __hwloc_at
goto free;
}
}
hwloc_bitmap_free(orig_cpuset);
#endif
hwloc_obj_add_info(topology->levels[0][0], "Backend", "x86");

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

@ -0,0 +1,307 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#include <hwloc.h>
#include <private/xml.h>
#include <private/private.h>
#include <private/misc.h>
#include <private/debug.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
/*******************
* Common routines *
*******************/
static void hwloc_libxml2_error_callback(void * ctx __hwloc_attribute_unused, const char * msg __hwloc_attribute_unused, ...) { /* do nothing */ }
static void
hwloc_libxml2_disable_stderrwarnings(void)
{
static int first = 1;
if (first) {
xmlSetGenericErrorFunc(NULL, hwloc__xml_verbose() ? xmlGenericError : hwloc_libxml2_error_callback);
first = 0;
}
}
/*******************
* Import routines *
*******************/
typedef struct hwloc__libxml_import_state_data_s {
xmlNode *node; /* current libxml node, always valid */
xmlNode *child; /* last processed child, or NULL if none yet */
xmlAttr *attr; /* last processed attribute, or NULL if none yet */
} * hwloc__libxml_import_state_data_t;
static int
hwloc__libxml_import_next_attr(hwloc__xml_import_state_t state, char **namep, char **valuep)
{
hwloc__libxml_import_state_data_t lstate = (void*) state->data;
xmlAttr *attr;
if (lstate->attr)
attr = lstate->attr->next;
else
attr = lstate->node->properties;
for (; attr; attr = attr->next)
if (attr->type == XML_ATTRIBUTE_NODE) {
/* use the first valid attribute content */
xmlNode *subnode;
for (subnode = attr->children; subnode; subnode = subnode->next) {
if (subnode->type == XML_TEXT_NODE) {
if (subnode->content && subnode->content[0] != '\0' && subnode->content[0] != '\n') {
*namep = (char *) attr->name;
*valuep = (char *) subnode->content;
lstate->attr = attr;
return 0;
}
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring unexpected xml attr node type %u\n", subnode->type);
}
}
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring unexpected xml attr type %u\n", attr->type);
}
return -1;
}
static int
hwloc__libxml_import_find_child(hwloc__xml_import_state_t state,
hwloc__xml_import_state_t childstate,
char **tagp)
{
hwloc__libxml_import_state_data_t lstate = (void*) state->data;
hwloc__libxml_import_state_data_t lchildstate = (void*) childstate->data;
xmlNode *child;
childstate->parent = state;
childstate->next_attr = state->next_attr;
childstate->find_child = state->find_child;
childstate->close_tag = state->close_tag;
childstate->close_child = state->close_child;
if (!lstate->child)
return 0;
child = lstate->child->next;
for (; child; child = child->next)
if (child->type == XML_ELEMENT_NODE) {
lstate->child = lchildstate->node = child;
lchildstate->child = child->children;
lchildstate->attr = NULL;
*tagp = (char*) child->name;
return 1;
} else if (child->type == XML_TEXT_NODE) {
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 if (child->type != XML_COMMENT_NODE) {
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring unexpected xml node type %u\n", child->type);
}
return 0;
}
static int
hwloc__libxml_import_close_tag(hwloc__xml_import_state_t state __hwloc_attribute_unused)
{
return 0;
}
static void
hwloc__libxml_import_close_child(hwloc__xml_import_state_t state __hwloc_attribute_unused)
{
/* nothing to do */
}
static int
hwloc_libxml_look(struct hwloc_topology *topology,
struct hwloc__xml_import_state_s *state)
{
hwloc__libxml_import_state_data_t lstate = (void*) state->data;
xmlNode* root_node;
xmlDtd *dtd;
assert(sizeof(*lstate) <= sizeof(state->data));
dtd = xmlGetIntSubset((xmlDoc*) topology->backend_params.xml.data);
if (!dtd) {
if (hwloc__xml_verbose())
fprintf(stderr, "Loading XML topology without DTD\n");
} else if (strcmp((char *) dtd->SystemID, "hwloc.dtd")) {
if (hwloc__xml_verbose())
fprintf(stderr, "Loading XML topology with wrong DTD SystemID (%s instead of %s)\n",
(char *) dtd->SystemID, "hwloc.dtd");
}
root_node = xmlDocGetRootElement((xmlDoc*) topology->backend_params.xml.data);
if (strcmp((const char *) root_node->name, "topology") && strcmp((const char *) root_node->name, "root")) {
/* root node should be in "topology" class (or "root" if importing from < 1.0) */
if (hwloc__xml_verbose())
fprintf(stderr, "ignoring object of class `%s' not at the top the xml hierarchy\n", (const char *) root_node->name);
goto failed;
}
state->next_attr = hwloc__libxml_import_next_attr;
state->find_child = hwloc__libxml_import_find_child;
state->close_tag = hwloc__libxml_import_close_tag;
state->close_child = hwloc__libxml_import_close_child;
state->parent = NULL;
lstate->node = root_node;
lstate->child = root_node->children;
lstate->attr = NULL;
return 0; /* success */
failed:
return -1; /* failed */
}
/********************
* Backend routines *
********************/
static void
hwloc_libxml_backend_exit(struct hwloc_topology *topology)
{
xmlFreeDoc((xmlDoc*)topology->backend_params.xml.data);
}
int
hwloc_libxml_backend_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int xmlbuflen)
{
xmlDoc *doc = NULL;
LIBXML_TEST_VERSION;
hwloc_libxml2_disable_stderrwarnings();
errno = 0; /* set to 0 so that we know if libxml2 changed it */
if (xmlpath)
doc = xmlReadFile(xmlpath, NULL, 0);
else if (xmlbuffer)
doc = xmlReadMemory(xmlbuffer, xmlbuflen, "", NULL, 0);
if (!doc) {
if (!errno)
/* libxml2 read the file fine, but it got an error during parsing */
errno = EINVAL;
return -1;
}
topology->backend_params.xml.look = hwloc_libxml_look;
topology->backend_params.xml.look_failed = NULL;
topology->backend_params.xml.backend_exit = hwloc_libxml_backend_exit;
topology->backend_params.xml.data = doc;
return 0;
}
/*******************
* Export routines *
*******************/
typedef struct hwloc__libxml_export_output_data_s {
xmlNodePtr current_node; /* current node to output */
} * hwloc__libxml_export_output_data_t;
static void
hwloc__libxml_export_new_child(hwloc__xml_export_output_t output, const char *name)
{
hwloc__libxml_export_output_data_t ldata = output->data;
ldata->current_node = xmlNewChild(ldata->current_node, NULL, BAD_CAST name, NULL);
}
static void
hwloc__libxml_export_new_prop(hwloc__xml_export_output_t output, const char *name, const char *value)
{
hwloc__libxml_export_output_data_t ldata = output->data;
xmlNewProp(ldata->current_node, BAD_CAST name, BAD_CAST value);
}
static void
hwloc__libxml_export_end_props(hwloc__xml_export_output_t output __hwloc_attribute_unused, unsigned nr_children __hwloc_attribute_unused)
{
/* nothing to do */
}
static void
hwloc__libxml_export_end_child(hwloc__xml_export_output_t output, const char *name __hwloc_attribute_unused, unsigned nr_children __hwloc_attribute_unused)
{
hwloc__libxml_export_output_data_t ldata = output->data;
ldata->current_node = ldata->current_node->parent;
}
static xmlDocPtr
hwloc__libxml2_prepare_export(hwloc_topology_t topology)
{
struct hwloc__xml_export_output_s output;
struct hwloc__libxml_export_output_data_s data;
xmlDocPtr doc = NULL; /* document pointer */
xmlNodePtr root_node = NULL; /* root pointer */
LIBXML_TEST_VERSION;
hwloc_libxml2_disable_stderrwarnings();
/* Creates a new document, a node and set it as a root node. */
doc = xmlNewDoc(BAD_CAST "1.0");
root_node = xmlNewNode(NULL, BAD_CAST "topology");
xmlDocSetRootElement(doc, root_node);
/* Creates a DTD declaration. Isn't mandatory. */
(void) xmlCreateIntSubset(doc, BAD_CAST "topology", NULL, BAD_CAST "hwloc.dtd");
output.new_child = hwloc__libxml_export_new_child;
output.end_child = hwloc__libxml_export_end_child;
output.new_prop = hwloc__libxml_export_new_prop;
output.end_props = hwloc__libxml_export_end_props;
output.data = &data;
data.current_node = root_node;
hwloc__xml_export_object (&output, topology, hwloc_get_root_obj(topology));
return doc;
}
int
hwloc_libxml_export_file(hwloc_topology_t topology, const char *filename)
{
xmlDocPtr doc;
int ret;
errno = 0; /* set to 0 so that we know if libxml2 changed it */
doc = hwloc__libxml2_prepare_export(topology);
ret = xmlSaveFormatFileEnc(filename, doc, "UTF-8", 1);
xmlFreeDoc(doc);
if (ret < 0) {
if (!errno)
/* libxml2 likely got an error before doing I/O */
errno = EINVAL;
return ret;
}
return 0;
}
int
hwloc_libxml_export_buffer(hwloc_topology_t topology, char **xmlbuffer, int *buflen)
{
xmlDocPtr doc = hwloc__libxml2_prepare_export(topology);
xmlDocDumpFormatMemoryEnc(doc, (xmlChar **)xmlbuffer, buflen, "UTF-8", 1);
xmlFreeDoc(doc);
return 0;
}
void
hwloc_libxml_free_buffer(void *xmlbuffer)
{
xmlFree(BAD_CAST xmlbuffer);
}

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

@ -0,0 +1,487 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#include <hwloc.h>
#include <private/private.h>
#include <private/xml.h>
#include <private/misc.h>
#include <private/debug.h>
#include <string.h>
#include <assert.h>
/*******************
* Import routines *
*******************/
typedef struct hwloc__nolibxml_import_state_data_s {
char *tagbuffer; /* buffer containing the next tag */
char *attrbuffer; /* buffer containing the next attribute of the current node */
char *tagname; /* tag name of the current node */
int closed; /* set if the current node is auto-closing */
} * hwloc__nolibxml_import_state_data_t;
static char *
hwloc__nolibxml_import_ignore_spaces(char *buffer)
{
return buffer + strspn(buffer, " \t\n");
}
static int
hwloc__nolibxml_import_next_attr(hwloc__xml_import_state_t state, char **namep, char **valuep)
{
hwloc__nolibxml_import_state_data_t nstate = (void*) state->data;
int namelen;
size_t len, escaped;
char *buffer, *value, *end;
/* find the beginning of an attribute */
buffer = hwloc__nolibxml_import_ignore_spaces(nstate->attrbuffer);
namelen = strspn(buffer, "abcdefghijklmnopqrstuvwxyz_");
if (buffer[namelen] != '=' || buffer[namelen+1] != '\"')
return -1;
buffer[namelen] = '\0';
*namep = buffer;
/* find the beginning of its value, and unescape it */
*valuep = value = buffer+namelen+2;
len = 0; escaped = 0;
while (value[len+escaped] != '\"') {
if (value[len+escaped] == '&') {
if (!strncmp(&value[1+len+escaped], "#10;", 4)) {
escaped += 4;
value[len] = '\n';
} else if (!strncmp(&value[1+len+escaped], "#13;", 4)) {
escaped += 4;
value[len] = '\r';
} else if (!strncmp(&value[1+len+escaped], "#9;", 3)) {
escaped += 3;
value[len] = '\t';
} else if (!strncmp(&value[1+len+escaped], "quot;", 5)) {
escaped += 5;
value[len] = '\"';
} else if (!strncmp(&value[1+len+escaped], "lt;", 3)) {
escaped += 3;
value[len] = '<';
} else if (!strncmp(&value[1+len+escaped], "gt;", 3)) {
escaped += 3;
value[len] = '>';
} else if (!strncmp(&value[1+len+escaped], "amp;", 4)) {
escaped += 4;
value[len] = '&';
} else {
return -1;
}
} else {
value[len] = value[len+escaped];
}
len++;
if (value[len+escaped] == '\0')
return -1;
}
value[len] = '\0';
/* find next attribute */
end = &value[len+escaped+1]; /* skip the ending " */
nstate->attrbuffer = hwloc__nolibxml_import_ignore_spaces(end);
return 0;
}
static int
hwloc__nolibxml_import_find_child(hwloc__xml_import_state_t state,
hwloc__xml_import_state_t childstate,
char **tagp)
{
hwloc__nolibxml_import_state_data_t nstate = (void*) state->data;
hwloc__nolibxml_import_state_data_t nchildstate = (void*) childstate->data;
char *buffer = nstate->tagbuffer;
char *end;
int namelen;
childstate->parent = state;
childstate->next_attr = state->next_attr;
childstate->find_child = state->find_child;
childstate->close_tag = state->close_tag;
childstate->close_child = state->close_child;
/* auto-closed tags have no children */
if (nstate->closed)
return 0;
/* find the beginning of the tag */
buffer = hwloc__nolibxml_import_ignore_spaces(buffer);
if (buffer[0] != '<')
return -1;
buffer++;
/* if closing tag, return nothing and do not advance */
if (buffer[0] == '/')
return 0;
/* normal tag */
*tagp = nchildstate->tagname = buffer;
/* find the end, mark it and return it */
end = strchr(buffer, '>');
if (!end)
return -1;
end[0] = '\0';
nchildstate->tagbuffer = end+1;
/* handle auto-closing tags */
if (end[-1] == '/') {
nchildstate->closed = 1;
end[-1] = '\0';
} else
nchildstate->closed = 0;
/* find attributes */
namelen = strspn(buffer, "abcdefghijklmnopqrstuvwxyz_");
/* cannot be without attributes */
assert(buffer[namelen] != '\0');
if (buffer[namelen] != ' ')
return -1;
/* found a space, likely starting attributes */
buffer[namelen] = '\0';
nchildstate->attrbuffer = buffer+namelen+1;
return 1;
}
static int
hwloc__nolibxml_import_close_tag(hwloc__xml_import_state_t state)
{
hwloc__nolibxml_import_state_data_t nstate = (void*) state->data;
char *buffer = nstate->tagbuffer;
char *end;
/* auto-closed tags need nothing */
if (nstate->closed)
return 0;
/* find the beginning of the tag */
buffer = hwloc__nolibxml_import_ignore_spaces(buffer);
if (buffer[0] != '<')
return -1;
buffer++;
/* find the end, mark it and return it to the parent */
end = strchr(buffer, '>');
if (!end)
return -1;
end[0] = '\0';
nstate->tagbuffer = end+1;
/* if closing tag, return nothing */
if (buffer[0] != '/' || strcmp(buffer+1, nstate->tagname) )
return -1;
return 0;
}
static void
hwloc__nolibxml_import_close_child(hwloc__xml_import_state_t state)
{
hwloc__nolibxml_import_state_data_t nstate = (void*) state->data;
hwloc__nolibxml_import_state_data_t nparent = (void*) state->parent->data;
nparent->tagbuffer = nstate->tagbuffer;
}
static int
hwloc_nolibxml_look(struct hwloc_topology *topology,
struct hwloc__xml_import_state_s *state)
{
hwloc__nolibxml_import_state_data_t nstate = (void*) state->data;
char *buffer = topology->backend_params.xml.data;
assert(sizeof(*nstate) <= sizeof(state->data));
/* skip headers */
while (!strncmp(buffer, "<?xml ", 6) || !strncmp(buffer, "<!DOCTYPE ", 10)) {
buffer = strchr(buffer, '\n');
if (!buffer)
goto failed;
buffer++;
}
/* find topology tag */
if (strncmp(buffer, "<topology>", 10))
goto failed;
state->next_attr = hwloc__nolibxml_import_next_attr;
state->find_child = hwloc__nolibxml_import_find_child;
state->close_tag = hwloc__nolibxml_import_close_tag;
state->close_child = hwloc__nolibxml_import_close_child;
state->parent = NULL;
nstate->closed = 0;
nstate->tagbuffer = buffer+10;
nstate->tagname = (char *) "topology";
nstate->attrbuffer = NULL;
return 0; /* success */
failed:
return -1; /* failed */
}
static void
hwloc_nolibxml_look_failed(struct hwloc_topology *topology __hwloc_attribute_unused)
{
/* not only when verbose */
fprintf(stderr, "Failed to parse XML input with the minimalistic parser. If it was not\n"
"generated by hwloc, try enabling full XML support with libxml2.\n");
}
/********************
* Backend routines *
********************/
static void
hwloc_nolibxml_backend_exit(struct hwloc_topology *topology)
{
free(topology->backend_params.xml.data);
}
int
hwloc_nolibxml_backend_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int xmlbuflen)
{
if (xmlbuffer) {
topology->backend_params.xml.data = malloc(xmlbuflen);
memcpy(topology->backend_params.xml.data, xmlbuffer, xmlbuflen);
} else {
FILE * file;
size_t buflen = 4096, offset, readlen;
char *buffer = malloc(buflen+1);
size_t ret;
if (!strcmp(xmlpath, "-"))
xmlpath = "/dev/stdin";
file = fopen(xmlpath, "r");
if (!file)
return -1;
offset = 0; readlen = buflen;
while (1) {
ret = fread(buffer+offset, 1, readlen, file);
offset += ret;
buffer[offset] = 0;
if (ret != readlen)
break;
buflen *= 2;
buffer = realloc(buffer, buflen+1);
readlen = buflen/2;
}
fclose(file);
topology->backend_params.xml.data = buffer;
/* buflen = offset+1; */
}
topology->backend_params.xml.look = hwloc_nolibxml_look;
topology->backend_params.xml.look_failed = hwloc_nolibxml_look_failed;
topology->backend_params.xml.backend_exit = hwloc_nolibxml_backend_exit;
return 0;
}
/*******************
* Export routines *
*******************/
typedef struct hwloc__nolibxml_export_output_data_s {
struct hwloc__xml_export_output_s generic;
char *buffer; /* (moving) buffer where to write */
size_t written; /* how many bytes were written (or would have be written if not truncated) */
size_t remaining; /* how many bytes are still available in the buffer */
unsigned indent; /* indentation level for the next line */
} * hwloc__nolibxml_export_output_data_t;
static void
hwloc__nolibxml_export_update_buffer(hwloc__nolibxml_export_output_data_t ndata, int res)
{
if (res >= 0) {
ndata->written += res;
if (res >= (int) ndata->remaining)
res = ndata->remaining>0 ? ndata->remaining-1 : 0;
ndata->buffer += res;
ndata->remaining -= res;
}
}
static char *
hwloc__nolibxml_export_escape_string(const char *src)
{
int fulllen, sublen;
char *escaped, *dst;
fulllen = strlen(src);
sublen = strcspn(src, "\n\r\t\"<>&");
if (sublen == fulllen)
return NULL; /* nothing to escape */
escaped = malloc(fulllen*6+1); /* escaped chars are replaced by at most 6 char */
dst = escaped;
memcpy(dst, src, sublen);
src += sublen;
dst += sublen;
while (*src) {
int replen;
switch (*src) {
case '\n': strcpy(dst, "&#10;"); replen=5; break;
case '\r': strcpy(dst, "&#13;"); replen=5; break;
case '\t': strcpy(dst, "&#9;"); replen=4; break;
case '\"': strcpy(dst, "&quot;"); replen=6; break;
case '<': strcpy(dst, "&lt;"); replen=4; break;
case '>': strcpy(dst, "&gt;"); replen=4; break;
case '&': strcpy(dst, "&amp;"); replen=5; break;
default: replen=0; break;
}
dst+=replen; src++;
sublen = strcspn(src, "\n\r\t\"<>&");
memcpy(dst, src, sublen);
src += sublen;
dst += sublen;
}
*dst = 0;
return escaped;
}
static void
hwloc__nolibxml_export_new_child(hwloc__xml_export_output_t output, const char *name)
{
hwloc__nolibxml_export_output_data_t ndata = output->data;
int res = hwloc_snprintf(ndata->buffer, ndata->remaining, "%*s<%s", ndata->indent, "", name);
hwloc__nolibxml_export_update_buffer(ndata, res);
ndata->indent += 2;
}
static void
hwloc__nolibxml_export_new_prop(hwloc__xml_export_output_t output, const char *name, const char *value)
{
hwloc__nolibxml_export_output_data_t ndata = output->data;
char *escaped = hwloc__nolibxml_export_escape_string(value);
int res = hwloc_snprintf(ndata->buffer, ndata->remaining, " %s=\"%s\"", name, escaped ? (const char *) escaped : value);
hwloc__nolibxml_export_update_buffer(ndata, res);
free(escaped);
}
static void
hwloc__nolibxml_export_end_props(hwloc__xml_export_output_t output, unsigned nr_children)
{
hwloc__nolibxml_export_output_data_t ndata = output->data;
int res = hwloc_snprintf(ndata->buffer, ndata->remaining, nr_children ? ">\n" : "/>\n");
hwloc__nolibxml_export_update_buffer(ndata, res);
}
static void
hwloc__nolibxml_export_end_child(hwloc__xml_export_output_t output, const char *name, unsigned nr_children)
{
hwloc__nolibxml_export_output_data_t ndata = output->data;
int res;
ndata->indent -= 2;
if (nr_children) {
res = hwloc_snprintf(ndata->buffer, ndata->remaining, "%*s</%s>\n", ndata->indent, "", name);
hwloc__nolibxml_export_update_buffer(ndata, res);
}
}
static size_t
hwloc___nolibxml_prepare_export(hwloc_topology_t topology, char *xmlbuffer, int buflen)
{
struct hwloc__xml_export_output_s output;
struct hwloc__nolibxml_export_output_data_s ndata;
int res;
output.new_child = hwloc__nolibxml_export_new_child;
output.end_child = hwloc__nolibxml_export_end_child;
output.new_prop = hwloc__nolibxml_export_new_prop;
output.end_props = hwloc__nolibxml_export_end_props;
output.data = &ndata;
ndata.indent = 0;
ndata.written = 0;
ndata.buffer = xmlbuffer;
ndata.remaining = buflen;
res = hwloc_snprintf(ndata.buffer, ndata.remaining,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE topology SYSTEM \"hwloc.dtd\">\n");
hwloc__nolibxml_export_update_buffer(&ndata, res);
hwloc__nolibxml_export_new_child(&output, "topology");
hwloc__nolibxml_export_end_props(&output, 1);
hwloc__xml_export_object (&output, topology, hwloc_get_root_obj(topology));
hwloc__nolibxml_export_end_child(&output, "topology", 1);
return ndata.written+1;
}
int
hwloc_nolibxml_export_buffer(hwloc_topology_t topology, char **bufferp, int *buflenp)
{
char *buffer;
size_t bufferlen, res;
bufferlen = 16384; /* random guess for large enough default */
buffer = malloc(bufferlen);
res = hwloc___nolibxml_prepare_export(topology, buffer, bufferlen);
if (res > bufferlen) {
buffer = realloc(buffer, res);
hwloc___nolibxml_prepare_export(topology, buffer, res);
}
*bufferp = buffer;
*buflenp = res;
return 0;
}
int
hwloc_nolibxml_export_file(hwloc_topology_t topology, const char *filename)
{
FILE *file;
char *buffer;
int bufferlen;
int ret;
ret = hwloc_nolibxml_export_buffer(topology, &buffer, &bufferlen);
if (ret < 0)
return -1;
if (!strcmp(filename, "-")) {
file = stdout;
} else {
file = fopen(filename, "w");
if (!file) {
free(buffer);
return -1;
}
}
fwrite(buffer, bufferlen-1 /* don't write the ending \0 */, 1, file);
free(buffer);
if (file != stdout)
fclose(file);
return 0;
}
void
hwloc_nolibxml_free_buffer(void *xmlbuffer)
{
free(xmlbuffer);
}

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

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 inria. All rights reserved.
* Copyright © 2009-2012 inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -465,6 +465,12 @@ hwloc_type_cmp(hwloc_obj_t obj1, hwloc_obj_t obj2)
return HWLOC_TYPE_DEEPER;
else if (obj1->attr->cache.depth > obj2->attr->cache.depth)
return HWLOC_TYPE_HIGHER;
else if (obj1->attr->cache.type > obj2->attr->cache.type)
/* consider icache deeper than dcache and dcache deeper than unified */
return HWLOC_TYPE_DEEPER;
else if (obj1->attr->cache.type < obj2->attr->cache.type)
/* consider icache deeper than dcache and dcache deeper than unified */
return HWLOC_TYPE_HIGHER;
}
/* Group objects have the same types but can have different depths. */
@ -562,6 +568,30 @@ hwloc_obj_cmp(hwloc_obj_t obj1, hwloc_obj_t obj2)
}
}
/* format must contain a single %s where to print obj infos */
static void
hwloc___insert_object_by_cpuset_report_error(hwloc_report_error_t report_error, const char *fmt, hwloc_obj_t obj, int line)
{
char typestr[64];
char objstr[512];
char msg[640];
char *cpusetstr;
hwloc_obj_type_snprintf(typestr, sizeof(typestr), obj, 0);
hwloc_bitmap_asprintf(&cpusetstr, obj->cpuset);
if (obj->os_index != (unsigned) -1)
snprintf(objstr, sizeof(objstr), "%s P#%u cpuset %s",
typestr, obj->os_index, cpusetstr);
else
snprintf(objstr, sizeof(objstr), "%s cpuset %s",
typestr, cpusetstr);
free(cpusetstr);
snprintf(msg, sizeof(msg), fmt,
objstr);
report_error(msg, line);
}
/*
* How to insert objects into the topology.
*
@ -676,7 +706,7 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
case HWLOC_OBJ_INCLUDED:
if (container) {
if (report_error)
report_error("object included in several different objects!", __LINE__);
hwloc___insert_object_by_cpuset_report_error(report_error, "object (%s) included in several different objects!", obj, __LINE__);
/* We can't handle that. */
return -1;
}
@ -685,7 +715,7 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
break;
case HWLOC_OBJ_INTERSECTS:
if (report_error)
report_error("object intersection without inclusion!", __LINE__);
hwloc___insert_object_by_cpuset_report_error(report_error, "object (%s) intersection without inclusion!", obj, __LINE__);
/* We can't handle that. */
return -1;
case HWLOC_OBJ_CONTAINS:
@ -1315,25 +1345,52 @@ unlink_and_free_single_object(hwloc_obj_t *pparent)
child->next_sibling = parent->next_sibling;
} else
*pparent = parent->next_sibling;
/* Remove ignored object */
hwloc_free_unlinked_object(parent);
}
/* Remove all ignored objects. */
static void
static int
remove_ignored(hwloc_topology_t topology, hwloc_obj_t *pparent)
{
hwloc_obj_t parent = *pparent, child, *pchild;
int dropped_children = 0;
int dropped = 0;
for_each_child_safe(child, parent, pchild)
remove_ignored(topology, pchild);
dropped_children += remove_ignored(topology, pchild);
if (parent != topology->levels[0][0] &&
topology->ignored_types[parent->type] == HWLOC_IGNORE_TYPE_ALWAYS) {
if ((parent != topology->levels[0][0] &&
topology->ignored_types[parent->type] == HWLOC_IGNORE_TYPE_ALWAYS)
|| (parent->type == HWLOC_OBJ_CACHE && parent->attr->cache.type == HWLOC_OBJ_CACHE_INSTRUCTION
&& !(topology->flags & HWLOC_TOPOLOGY_FLAG_ICACHES))) {
hwloc_debug("%s", "\nDropping ignored object ");
print_object(topology, 0, parent);
unlink_and_free_single_object(pparent);
dropped = 1;
} else if (dropped_children) {
/* we keep this object but its children changed, reorder them by cpuset */
/* move the children list on the side */
hwloc_obj_t *prev, children = parent->first_child;
parent->first_child = NULL;
while (children) {
/* dequeue child */
child = children;
children = child->next_sibling;
/* find where to enqueue it */
prev = &parent->first_child;
while (*prev
&& (!child->cpuset || !(*prev)->cpuset
|| hwloc_bitmap_compare_first(child->cpuset, (*prev)->cpuset) > 0))
prev = &((*prev)->next_sibling);
/* enqueue */
child->next_sibling = *prev;
*prev = child;
}
}
return dropped;
}
/* Remove an object and its children from its parent and free them.
@ -2080,7 +2137,7 @@ static void hwloc_topology_setup_defaults(struct hwloc_topology *topology);
static int
hwloc_discover(struct hwloc_topology *topology)
{
int gotsomeio = 1;
int gotsomeio = 0;
if (topology->backend_type == HWLOC_BACKEND_SYNTHETIC) {
alloc_cpusets(topology->levels[0][0]);
@ -2335,9 +2392,6 @@ hwloc_discover(struct hwloc_topology *topology)
* hooks.
*/
if (topology->flags & HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM)
topology->is_thissystem = 1;
if (topology->is_thissystem) {
# ifdef HWLOC_LINUX_SYS
hwloc_set_linuxfs_hooks(topology);
@ -2451,6 +2505,9 @@ hwloc_topology_setup_defaults(struct hwloc_topology *topology)
topology->set_thread_cpubind = NULL;
topology->get_thread_cpubind = NULL;
#endif
topology->get_thisproc_last_cpu_location = NULL;
topology->get_proc_last_cpu_location = NULL;
topology->get_thisthread_last_cpu_location = NULL;
topology->set_thisproc_membind = NULL;
topology->get_thisproc_membind = NULL;
topology->set_thisthread_membind = NULL;
@ -2571,6 +2628,7 @@ hwloc_backend_custom_exit(struct hwloc_topology *topology)
{
assert(topology->backend_type == HWLOC_BACKEND_CUSTOM);
topology->is_thissystem = 1;
hwloc_topology_clear(topology);
hwloc_topology_setup_defaults(topology);
@ -2721,7 +2779,7 @@ 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
&& !hwloc_obj_type_is_io(type))
&& !hwloc_obj_type_is_io((hwloc_obj_type_t) type))
topology->ignored_types[type] = HWLOC_IGNORE_TYPE_KEEP_STRUCTURE;
return 0;
}
@ -2781,6 +2839,15 @@ hwloc_topology_load (struct hwloc_topology *topology)
topology->is_loaded = 0;
}
/* Apply is_thissystem topology flag before we enforce envvar backends.
* If the application changed the backend with set_foo(),
* it may use set_flags() update the is_thissystem flag here.
* If it changes the backend with environment variables below,
* it may use HWLOC_THISSYSTEM envvar below as well.
*/
if (topology->flags & HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM)
topology->is_thissystem = 1;
/* enforce backend anyway if a FORCE variable was given */
#ifdef HWLOC_LINUX_SYS
{
@ -2813,11 +2880,6 @@ hwloc_topology_load (struct hwloc_topology *topology)
hwloc_backend_xml_init(topology, xmlpath_env, NULL, 0);
}
/* always apply non-FORCE THISSYSTEM since it was explicitly designed to override setups from other backends */
local_env = getenv("HWLOC_THISSYSTEM");
if (local_env)
topology->is_thissystem = atoi(local_env);
/* 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
@ -2826,6 +2888,10 @@ hwloc_topology_load (struct hwloc_topology *topology)
#endif
}
local_env = getenv("HWLOC_THISSYSTEM");
if (local_env)
topology->is_thissystem = atoi(local_env);
/* 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
*/
@ -2836,11 +2902,6 @@ hwloc_topology_load (struct hwloc_topology *topology)
if (err < 0)
return err;
/* enforce THISSYSTEM if given in a FORCE variable */
local_env = getenv("HWLOC_FORCE_THISSYSTEM");
if (local_env)
topology->is_thissystem = atoi(local_env);
#ifndef HWLOC_DEBUG
if (getenv("HWLOC_DEBUG_CHECK"))
#endif

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 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.
@ -203,7 +203,7 @@ hwloc_obj_type_of_string (const char * string)
if (!strcasecmp(string, "Socket")) return HWLOC_OBJ_SOCKET;
if (!strcasecmp(string, "Cache")) return HWLOC_OBJ_CACHE;
if (!strcasecmp(string, "Core")) return HWLOC_OBJ_CORE;
if (!strcasecmp(string, "PU") || !strcasecmp(string, "proc") /* backward compatiliby with 0.9 */) return HWLOC_OBJ_PU;
if (!strcasecmp(string, "PU")) return HWLOC_OBJ_PU;
if (!strcasecmp(string, "Bridge")) return HWLOC_OBJ_BRIDGE;
if (!strcasecmp(string, "PCIDev")) return HWLOC_OBJ_PCI_DEVICE;
if (!strcasecmp(string, "OSDev")) return HWLOC_OBJ_OS_DEVICE;
@ -373,6 +373,16 @@ hwloc_pci_class_string(unsigned short class_id)
#define hwloc_memory_size_printf_unit(_size, _verbose) \
((_size) < (10ULL<<20) || _verbose ? "KB" : (_size) < (10ULL<<30) ? "MB" : "GB")
static const char* hwloc_obj_cache_type_letter(hwloc_obj_cache_type_t type)
{
switch (type) {
case HWLOC_OBJ_CACHE_UNIFIED: return "";
case HWLOC_OBJ_CACHE_DATA: return "d";
case HWLOC_OBJ_CACHE_INSTRUCTION: return "i";
default: return "unknown";
}
}
int
hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t obj, int verbose)
{
@ -387,7 +397,9 @@ hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t
case HWLOC_OBJ_PU:
return hwloc_snprintf(string, size, "%s", hwloc_obj_type_string(type));
case HWLOC_OBJ_CACHE:
return hwloc_snprintf(string, size, "L%u%s", obj->attr->cache.depth, verbose ? hwloc_obj_type_string(type): "");
return hwloc_snprintf(string, size, "L%u%s%s", obj->attr->cache.depth,
hwloc_obj_cache_type_letter(obj->attr->cache.type),
verbose ? hwloc_obj_type_string(type): "");
case HWLOC_OBJ_GROUP:
/* TODO: more pretty presentation? */
return hwloc_snprintf(string, size, "%s%u", hwloc_obj_type_string(type), obj->attr->group.depth);

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
@ -12,8 +12,8 @@
* this header represents the public interface to this static component.
*/
#ifndef MCA_OPAL_HWLOC_HWLOC142_H
#define MCA_OPAL_HWLOC_HWLOC142_H
#ifndef MCA_OPAL_HWLOC_HWLOC151_H
#define MCA_OPAL_HWLOC_HWLOC151_H
BEGIN_C_DECLS
@ -41,4 +41,4 @@ BEGIN_C_DECLS
END_C_DECLS
#endif /* MCA_OPAL_HWLOC_HWLOC142_H */
#endif /* MCA_OPAL_HWLOC_HWLOC151_H */

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
@ -18,20 +18,20 @@
#include "opal/constants.h"
#include "opal/mca/hwloc/hwloc.h"
#include "hwloc142.h"
#include "hwloc151.h"
/*
* Public string showing the sysinfo ompi_linux component version number
*/
const char *opal_hwloc_hwloc142_component_version_string =
"OPAL hwloc142 hwloc MCA component version " OPAL_VERSION;
const char *opal_hwloc_hwloc151_component_version_string =
"OPAL hwloc151 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_hwloc142_component = {
const opal_hwloc_component_t mca_hwloc_hwloc151_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_hwloc142_component = {
OPAL_HWLOC_BASE_VERSION_2_0_0,
/* Component name and version */
"hwloc142",
"hwloc151",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,