1
1
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2017-03-31 13:32:42 +09:00
родитель 7e57075f0d
Коммит 81062b7cd2
96 изменённых файлов: 1722 добавлений и 1177 удалений

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

@ -3,6 +3,8 @@
# Copyright (c) 2014-2015 Intel, Inc. All right reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -28,16 +30,16 @@ EXTRA_DIST = \
SUBDIRS = hwloc
# Headers and sources
headers = hwloc1113.h
sources = hwloc1113_component.c
headers = hwloc1116.h
sources = hwloc1116_component.c
# We only ever build this component statically
noinst_LTLIBRARIES = libmca_hwloc_hwloc1113.la
libmca_hwloc_hwloc1113_la_SOURCES = $(headers) $(sources)
nodist_libmca_hwloc_hwloc1113_la_SOURCES = $(nodist_headers)
libmca_hwloc_hwloc1113_la_LDFLAGS = -module -avoid-version $(opal_hwloc_hwloc1113_LDFLAGS)
libmca_hwloc_hwloc1113_la_LIBADD = $(opal_hwloc_hwloc1113_LIBS)
libmca_hwloc_hwloc1113_la_DEPENDENCIES = \
noinst_LTLIBRARIES = libmca_hwloc_hwloc1116.la
libmca_hwloc_hwloc1116_la_SOURCES = $(headers) $(sources)
nodist_libmca_hwloc_hwloc1116_la_SOURCES = $(nodist_headers)
libmca_hwloc_hwloc1116_la_LDFLAGS = -module -avoid-version $(opal_hwloc_hwloc1116_LDFLAGS)
libmca_hwloc_hwloc1116_la_LIBADD = $(opal_hwloc_hwloc1116_LIBS)
libmca_hwloc_hwloc1116_la_DEPENDENCIES = \
$(HWLOC_top_builddir)/src/libhwloc_embedded.la
# Since the rest of the code base includes the underlying hwloc.h, we

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

@ -17,41 +17,41 @@
#
# Priority
#
AC_DEFUN([MCA_opal_hwloc_hwloc1113_PRIORITY], [90])
AC_DEFUN([MCA_opal_hwloc_hwloc1116_PRIORITY], [90])
#
# Force this component to compile in static-only mode
#
AC_DEFUN([MCA_opal_hwloc_hwloc1113_COMPILE_MODE], [
AC_DEFUN([MCA_opal_hwloc_hwloc1116_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/hwloc1113/hwloc/config/hwloc.m4)
m4_include(opal/mca/hwloc/hwloc1113/hwloc/config/hwloc_pkg.m4)
m4_include(opal/mca/hwloc/hwloc1113/hwloc/config/hwloc_check_attributes.m4)
m4_include(opal/mca/hwloc/hwloc1113/hwloc/config/hwloc_check_visibility.m4)
m4_include(opal/mca/hwloc/hwloc1113/hwloc/config/hwloc_check_vendor.m4)
m4_include(opal/mca/hwloc/hwloc1113/hwloc/config/hwloc_components.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc_pkg.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc_check_attributes.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc_check_visibility.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc_check_vendor.m4)
m4_include(opal/mca/hwloc/hwloc1116/hwloc/config/hwloc_components.m4)
# MCA_hwloc_hwloc1113_POST_CONFIG()
# MCA_hwloc_hwloc1116_POST_CONFIG()
# ---------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc1113_POST_CONFIG],[
OPAL_VAR_SCOPE_PUSH([opal_hwloc_hwloc1113_basedir])
AC_DEFUN([MCA_opal_hwloc_hwloc1116_POST_CONFIG],[
OPAL_VAR_SCOPE_PUSH([opal_hwloc_hwloc1116_basedir])
# If we won, then do all the rest of the setup
AS_IF([test "$1" = "1" && test "$opal_hwloc_hwloc1113_support" = "yes"],
AS_IF([test "$1" = "1" && test "$opal_hwloc_hwloc1116_support" = "yes"],
[
# Set this variable so that the framework m4 knows what
# file to include in opal/mca/hwloc/hwloc-internal.h
opal_hwloc_hwloc1113_basedir=opal/mca/hwloc/hwloc1113
opal_hwloc_base_include="$opal_hwloc_hwloc1113_basedir/hwloc1113.h"
opal_hwloc_hwloc1116_basedir=opal/mca/hwloc/hwloc1116
opal_hwloc_base_include="$opal_hwloc_hwloc1116_basedir/hwloc1116.h"
# Add some stuff to CPPFLAGS so that the rest of the source
# tree can be built
file=$opal_hwloc_hwloc1113_basedir/hwloc
file=$opal_hwloc_hwloc1116_basedir/hwloc
CPPFLAGS="-I$OPAL_TOP_SRCDIR/$file/include $CPPFLAGS"
AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"],
[CPPFLAGS="-I$OPAL_TOP_BUILDDIR/$file/include $CPPFLAGS"])
@ -64,39 +64,39 @@ AC_DEFUN([MCA_opal_hwloc_hwloc1113_POST_CONFIG],[
])dnl
# MCA_hwloc_hwloc1113_CONFIG([action-if-found], [action-if-not-found])
# MCA_hwloc_hwloc1116_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([MCA_opal_hwloc_hwloc1113_CONFIG],[
AC_DEFUN([MCA_opal_hwloc_hwloc1116_CONFIG],[
# Hwloc needs to know if we have Verbs support
AC_REQUIRE([OPAL_CHECK_VERBS_DIR])
AC_CONFIG_FILES([opal/mca/hwloc/hwloc1113/Makefile])
AC_CONFIG_FILES([opal/mca/hwloc/hwloc1116/Makefile])
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc1113_save_CPPFLAGS opal_hwloc_hwloc1113_save_LDFLAGS opal_hwloc_hwloc1113_save_LIBS opal_hwloc_hwloc1113_save_cairo opal_hwloc_hwloc1113_save_xml opal_hwloc_hwloc1113_basedir opal_hwloc_hwloc1113_file opal_hwloc_hwloc1113_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external])
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc1116_save_CPPFLAGS opal_hwloc_hwloc1116_save_LDFLAGS opal_hwloc_hwloc1116_save_LIBS opal_hwloc_hwloc1116_save_cairo opal_hwloc_hwloc1116_save_xml opal_hwloc_hwloc1116_basedir opal_hwloc_hwloc1116_file opal_hwloc_hwloc1116_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external])
# default to this component not providing support
opal_hwloc_hwloc1113_basedir=opal/mca/hwloc/hwloc1113
opal_hwloc_hwloc1113_support=no
opal_hwloc_hwloc1116_basedir=opal/mca/hwloc/hwloc1116
opal_hwloc_hwloc1116_support=no
AS_IF([test "$with_hwloc" = "internal" || test -z "$with_hwloc" || test "$with_hwloc" = "yes"],
[opal_hwloc_external="no"],
[opal_hwloc_external="yes"])
opal_hwloc_hwloc1113_save_CPPFLAGS=$CPPFLAGS
opal_hwloc_hwloc1113_save_LDFLAGS=$LDFLAGS
opal_hwloc_hwloc1113_save_LIBS=$LIBS
opal_hwloc_hwloc1116_save_CPPFLAGS=$CPPFLAGS
opal_hwloc_hwloc1116_save_LDFLAGS=$LDFLAGS
opal_hwloc_hwloc1116_save_LIBS=$LIBS
# Run the hwloc configuration - if no external hwloc, then set the prefixi
# to minimize the chance that someone will use the internal symbols
AS_IF([test "$opal_hwloc_external" = "no"],
[HWLOC_SET_SYMBOL_PREFIX([opal_hwloc1113_])])
[HWLOC_SET_SYMBOL_PREFIX([opal_hwloc1116_])])
# save XML or graphical options
opal_hwloc_hwloc1113_save_cairo=$enable_cairo
opal_hwloc_hwloc1113_save_xml=$enable_xml
opal_hwloc_hwloc1113_save_static=$enable_static
opal_hwloc_hwloc1113_save_shared=$enable_shared
opal_hwloc_hwloc1113_save_plugins=$enable_plugins
opal_hwloc_hwloc1116_save_cairo=$enable_cairo
opal_hwloc_hwloc1116_save_xml=$enable_xml
opal_hwloc_hwloc1116_save_static=$enable_static
opal_hwloc_hwloc1116_save_shared=$enable_shared
opal_hwloc_hwloc1116_save_plugins=$enable_plugins
# never enable hwloc's graphical option
enable_cairo=no
@ -113,19 +113,19 @@ AC_DEFUN([MCA_opal_hwloc_hwloc1113_CONFIG],[
# hwloc checks for compiler visibility, and its needs to do
# this without "picky" flags.
opal_hwloc_hwloc1113_save_cflags=$CFLAGS
opal_hwloc_hwloc1116_save_cflags=$CFLAGS
CFLAGS=$OPAL_CFLAGS_BEFORE_PICKY
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc1113/hwloc],
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc1116/hwloc],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([yes])
HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc1113_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc1113_basedir/hwloc/VERSION`"
HWLOC_VERSION="internal v`$srcdir/$opal_hwloc_hwloc1116_basedir/hwloc/config/hwloc_get_version.sh $srcdir/$opal_hwloc_hwloc1116_basedir/hwloc/VERSION`"
# Build flags for our Makefile.am
opal_hwloc_hwloc1113_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)'
opal_hwloc_hwloc1113_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_hwloc_hwloc1113_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)'
opal_hwloc_hwloc1113_support=yes
opal_hwloc_hwloc1116_LDFLAGS='$(HWLOC_EMBEDDED_LDFLAGS)'
opal_hwloc_hwloc1116_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_hwloc_hwloc1116_basedir"'/hwloc/src/libhwloc_embedded.la $(HWLOC_EMBEDDED_LIBS)'
opal_hwloc_hwloc1116_support=yes
AC_DEFINE_UNQUOTED([HWLOC_HWLOC1113_HWLOC_VERSION],
AC_DEFINE_UNQUOTED([HWLOC_HWLOC1116_HWLOC_VERSION],
["$HWLOC_VERSION"],
[Version of hwloc])
@ -138,35 +138,35 @@ AC_DEFUN([MCA_opal_hwloc_hwloc1113_CONFIG],[
],
[AC_MSG_CHECKING([whether hwloc configure succeeded])
AC_MSG_RESULT([no])
opal_hwloc_hwloc1113_support=no])
CFLAGS=$opal_hwloc_hwloc1113_save_cflags
opal_hwloc_hwloc1116_support=no])
CFLAGS=$opal_hwloc_hwloc1116_save_cflags
# Restore some env variables, if necessary
AS_IF([test -n "$opal_hwloc_hwloc1113_save_cairo"],
[enable_cairo=$opal_hwloc_hwloc1113_save_cairo])
AS_IF([test -n "$opal_hwloc_hwloc1113_save_xml"],
[enable_xml=$opal_hwloc_hwloc1113_save_xml])
AS_IF([test -n "$opal_hwloc_hwloc1113_save_static"],
[enable_static=$opal_hwloc_hwloc1113_save_static])
AS_IF([test -n "$opal_hwloc_hwloc1113_save_shared"],
[enable_shared=$opal_hwloc_hwloc1113_save_shared])
AS_IF([test -n "$opal_hwloc_hwloc1113_save_plugins"],
[enable_plugins=$opal_hwloc_hwloc1113_save_shared])
AS_IF([test -n "$opal_hwloc_hwloc1116_save_cairo"],
[enable_cairo=$opal_hwloc_hwloc1116_save_cairo])
AS_IF([test -n "$opal_hwloc_hwloc1116_save_xml"],
[enable_xml=$opal_hwloc_hwloc1116_save_xml])
AS_IF([test -n "$opal_hwloc_hwloc1116_save_static"],
[enable_static=$opal_hwloc_hwloc1116_save_static])
AS_IF([test -n "$opal_hwloc_hwloc1116_save_shared"],
[enable_shared=$opal_hwloc_hwloc1116_save_shared])
AS_IF([test -n "$opal_hwloc_hwloc1116_save_plugins"],
[enable_plugins=$opal_hwloc_hwloc1116_save_shared])
CPPFLAGS=$opal_hwloc_hwloc1113_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc1113_save_LDFLAGS
LIBS=$opal_hwloc_hwloc1113_save_LIBS
CPPFLAGS=$opal_hwloc_hwloc1116_save_CPPFLAGS
LDFLAGS=$opal_hwloc_hwloc1116_save_LDFLAGS
LIBS=$opal_hwloc_hwloc1116_save_LIBS
AC_SUBST([opal_hwloc_hwloc1113_CFLAGS])
AC_SUBST([opal_hwloc_hwloc1113_CPPFLAGS])
AC_SUBST([opal_hwloc_hwloc1113_LDFLAGS])
AC_SUBST([opal_hwloc_hwloc1113_LIBS])
AC_SUBST([opal_hwloc_hwloc1116_CFLAGS])
AC_SUBST([opal_hwloc_hwloc1116_CPPFLAGS])
AC_SUBST([opal_hwloc_hwloc1116_LDFLAGS])
AC_SUBST([opal_hwloc_hwloc1116_LIBS])
# Finally, add some flags to the wrapper compiler so that our
# headers can be found.
hwloc_hwloc1113_WRAPPER_EXTRA_LDFLAGS="$HWLOC_EMBEDDED_LDFLAGS"
hwloc_hwloc1113_WRAPPER_EXTRA_LIBS="$HWLOC_EMBEDDED_LIBS"
hwloc_hwloc1113_WRAPPER_EXTRA_CPPFLAGS='-I${pkgincludedir}/'"$opal_hwloc_hwloc1113_basedir/hwloc/include"
hwloc_hwloc1116_WRAPPER_EXTRA_LDFLAGS="$HWLOC_EMBEDDED_LDFLAGS"
hwloc_hwloc1116_WRAPPER_EXTRA_LIBS="$HWLOC_EMBEDDED_LIBS"
hwloc_hwloc1116_WRAPPER_EXTRA_CPPFLAGS='-I${pkgincludedir}/'"$opal_hwloc_hwloc1116_basedir/hwloc/include"
# If we are not building the internal hwloc, then indicate that
# this component should not be built. NOTE: we still did all the
@ -176,12 +176,12 @@ AC_DEFUN([MCA_opal_hwloc_hwloc1113_CONFIG],[
# distclean" infrastructure to work properly).
AS_IF([test "$opal_hwloc_external" = "yes"],
[AC_MSG_WARN([using an external hwloc; disqualifying this component])
opal_hwloc_hwloc1113_support=no],
opal_hwloc_hwloc1116_support=no],
[AC_DEFINE([HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC], [1])
AC_DEFINE([HAVE_HWLOC_TOPOLOGY_DUP], [1])])
# Done!
AS_IF([test "$opal_hwloc_hwloc1113_support" = "yes"],
AS_IF([test "$opal_hwloc_hwloc1116_support" = "yes"],
[$1],
[$2])

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

@ -9,7 +9,7 @@ ACLOCAL_AMFLAGS = -I ./config
SUBDIRS = src include
if HWLOC_BUILD_STANDALONE
SUBDIRS += tests utils contrib/systemd
SUBDIRS += utils tests contrib/systemd
# We need doc/ if HWLOC_BUILD_DOXYGEN, or during make install if HWLOC_INSTALL_DOXYGEN.
# There's no INSTALL_SUBDIRS, so always enter doc/ and check HWLOC_BUILD/INSTALL_DOXYGEN there
SUBDIRS += doc

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

@ -1,5 +1,5 @@
Copyright © 2009 CNRS
Copyright © 2009-2016 Inria. All rights reserved.
Copyright © 2009-2017 Inria. All rights reserved.
Copyright © 2009-2013 Université Bordeaux
Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
@ -17,10 +17,51 @@ bug fixes (and other actions) for each version of hwloc since version
in v0.9.1).
Version 1.11.6
--------------
* Make the Linux discovery about twice faster, especially on the CPU side,
by trying to avoid sysfs file accesses as much as possible.
* Add support for AMD Family 17h processors (Zen) SMT cores in the Linux
and x86 backends.
* Add the HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES flag (and the
HWLOC_THISSYSTEM_ALLOWED_RESOURCES environment variable) for reading the
set of allowed resources from the local operating system even if the
topology was loaded from XML or synthetic.
* Fix hwloc_bitmap_set/clr_range() for infinite ranges that do not
overlap currently defined ranges in the bitmap.
* Don't reset the lstopo zoom scale when moving the X11 window.
* lstopo now has --flags for manually setting topology flags.
* hwloc_get_depth_type() returns HWLOC_TYPE_DEPTH_UNKNOWN for Misc objects.
Version 1.11.5
--------------
* Add support for Knights Mill Xeon Phi, thanks to Piotr Luc for the patch.
* Reenable distance gathering on Solaris, disabled by mistake since v1.0.
Thanks to TU Wien for the help.
* Fix hwloc_get_*obj*_inside_cpuset() functions to ignore objects with
empty CPU sets, for instance, CPU-less NUMA nodes such as KNL MCDRAM.
Thanks to Nicolas Denoyelle for the report.
* Fix XML import of multiple distance matrices.
* Add a FAQ entry about "hwloc is only a structural model, it ignores
performance models, memory bandwidth, etc.?"
Version 1.11.4
--------------
* Add MemoryMode and ClusterMode attributes in the Machine object on KNL.
Add doc/examples/get-knl-modes.c for an example of retrieving them.
Thanks to Grzegorz Andrejczuk.
* Fix Linux build with -m32 with respect to libudev.
Thanks to Paul Hargrove for reporting the issue.
* Fix build with Visual Studio 2015, thanks to Eloi Gaudry for reporting
the issue and providing the patch.
* Don't forget to display OS device children in the graphical lstopo.
* Fix a memory leak on Solaris, thanks to Bryon Gloden for the patch.
* Properly handle realloc() failures, thanks to Bryon Gloden for reporting
the issue.
* Fix lstopo crash in ascii/fig/windows outputs when some objects have a
lstopoStyle info attribute.
Version 1.11.3

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

@ -13,20 +13,11 @@ hwloc primarily aims at helping high-performance computing (HPC) applications,
but is also applicable to any project seeking to exploit code and/or data
locality on modern computing platforms.
Note that the hwloc project represents the merger of the libtopology project
from inria and the Portable Linux Processor Affinity (PLPA) sub-project from
Open MPI. Both of these prior projects are now deprecated. The first hwloc
release was essentially a "re-branding" of the libtopology code base, but with
both a few genuinely new features and a few PLPA-like features added in. Prior
releases of hwloc included documentation about switching from PLPA to hwloc;
this documentation has been dropped on the assumption that everyone who was
using PLPA has already switched to hwloc.
hwloc supports the following operating systems:
* Linux (including old kernels not having sysfs topology information, with
knowledge of cpusets, offline CPUs, ScaleMP vSMP and Kerrighed support) on
all supported hardware, including Intel Xeon Phi (KNL and KNC, either
knowledge of cpusets, ScaleMP vSMP and Kerrighed support, etc.) on all
supported hardware, including Intel Xeon Phi (KNL and KNC, either
standalone or as a coprocessor) and NumaScale NumaConnect.
* Solaris
* AIX
@ -55,14 +46,15 @@ no topology information is available.
For development and debugging purposes, hwloc also offers the ability to work
on "fake" topologies:
* Symmetrical tree of resources generated from a list of level arities
* Remote machine simulation through the gathering of Linux sysfs topology
files
* Symmetrical tree of resources generated from a list of level arities, see
Synthetic topologies.
* Remote machine simulation through the gathering of topology as XML files,
see Importing and exporting topologies from/to XML files.
hwloc can display the topology in a human-readable format, either in graphical
mode (X11), or by exporting in one of several different formats, including:
plain text, PDF, PNG, and FIG (see CLI Examples below). Note that some of the
export formats require additional support libraries.
plain text, PDF, PNG, and FIG (see Command-line Examples below). Note that some
of the export formats require additional support libraries.
hwloc offers a programming interface for manipulating topologies and objects.
It also brings a powerful CPU bitmap API that is used to describe topology

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

@ -9,7 +9,7 @@
major=1
minor=11
release=3
release=6
# 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
@ -22,7 +22,7 @@ greek=
# The date when this release was created
date="Apr 26, 2016"
date="Feb 23, 2017"
# If snapshot=1, then use the value from snapshot_version as the
# entire hwloc version (i.e., ignore major, minor, release, and
@ -41,6 +41,6 @@ snapshot_version=${major}.${minor}.${release}${greek}-git
# 2. Version numbers are described in the Libtool current:revision:age
# format.
libhwloc_so_version=12:0:7
libhwloc_so_version=12:3:7
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj

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

@ -1,7 +1,7 @@
dnl -*- Autoconf -*-
dnl
dnl Copyright © 2009-2016 Inria. All rights reserved.
dnl Copyright © 2009-2012, 2015-2016 Université Bordeaux
dnl Copyright © 2009-2012, 2015-2017 Université Bordeaux
dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
@ -9,7 +9,7 @@ dnl Copyright © 2004-2012 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright © 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright © 2006-2016 Cisco Systems, Inc. All rights reserved.
dnl Copyright © 2006-2017 Cisco Systems, Inc. All rights reserved.
dnl Copyright © 2012 Blue Brain Project, BBP/EPFL. All rights reserved.
dnl Copyright © 2012 Oracle and/or its affiliates. All rights reserved.
dnl See COPYING in top-level directory.
@ -263,7 +263,8 @@ EOF])
AC_MSG_WARN([***********************************************************])
AC_MSG_WARN([*** hwloc does not support this system.])
AC_MSG_WARN([*** hwloc will *attempt* to build (but it may not work).])
AC_MSG_WARN([*** hwloc run-time results may be reduced to showing just one processor.])
AC_MSG_WARN([*** hwloc run-time results may be reduced to showing just one processor,])
AC_MSG_WARN([*** and binding will likely not be supported.])
AC_MSG_WARN([*** You have been warned.])
AC_MSG_WARN([*** Pausing to give you time to read this message...])
AC_MSG_WARN([***********************************************************])
@ -412,9 +413,11 @@ EOF])
])
AC_CHECK_HEADERS([sys/lgrp_user.h], [
AC_CHECK_LIB([lgrp], [lgrp_latency_cookie],
AC_CHECK_LIB([lgrp], [lgrp_init],
[HWLOC_LIBS="-llgrp $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBLGRP], 1, [Define to 1 if we have -llgrp])])
AC_DEFINE([HAVE_LIBLGRP], 1, [Define to 1 if we have -llgrp])
AC_CHECK_DECLS([lgrp_latency_cookie],,,[[#include <sys/lgrp_user.h>]])
])
])
AC_CHECK_HEADERS([kstat.h], [
AC_CHECK_LIB([kstat], [main],
@ -663,7 +666,8 @@ EOF])
AC_DEFINE([HWLOC_HAVE_CLZL], [1], [Define to 1 if you have the `clzl' function.])
])
AC_CHECK_FUNCS([openat], [hwloc_have_openat=yes])
AS_IF([test "$hwloc_c_vendor" != "android"], [AC_CHECK_FUNCS([openat], [hwloc_have_openat=yes])])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_FUNCS([getpagesize memalign posix_memalign])
@ -762,6 +766,10 @@ EOF])
hwloc_pci_happy=yes
HWLOC_PKG_CHECK_MODULES([PCIACCESS], [pciaccess], [pci_slot_match_iterator_create], [pciaccess.h], [:], [hwloc_pci_happy=no])
# Only add the REQUIRES if we got pciaccess through pkg-config.
# Otherwise we don't know if pciaccess.pc is installed
AS_IF([test "$hwloc_pci_happy" = "yes"], [HWLOC_PCIACCESS_REQUIRES=pciaccess])
# Just for giggles, if we didn't find a pciaccess pkg-config,
# just try looking for its header file and library.
AS_IF([test "$hwloc_pci_happy" != "yes"],
@ -773,8 +781,7 @@ EOF])
])
AS_IF([test "$hwloc_pci_happy" = "yes"],
[HWLOC_PCIACCESS_REQUIRES=pciaccess
hwloc_pci_lib=pciaccess
[hwloc_pci_lib=pciaccess
hwloc_components="$hwloc_components pci"
hwloc_pci_component_maybeplugin=1])
fi
@ -948,6 +955,8 @@ EOF])
AC_DEFINE([HWLOC_HAVE_GL], [1], [Define to 1 if you have the GL module components.])
HWLOC_GL_LIBS="-lXNVCtrl -lXext -lX11"
AC_SUBST(HWLOC_GL_LIBS)
# FIXME we actually don't know if xext.pc and x11.pc are installed
# since we didn't look for Xext and X11 using pkg-config
HWLOC_GL_REQUIRES="xext x11"
hwloc_have_gl=yes
hwloc_components="$hwloc_components gl"
@ -1306,8 +1315,8 @@ AC_DEFUN([_HWLOC_CHECK_DECL], [
AC_MSG_CHECKING([whether function $1 has a complete prototype])
AC_REQUIRE([AC_PROG_CC])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT([$4])]
[$1(1,2,3,4,5,6,7,8,9,10);],
[AC_INCLUDES_DEFAULT([$4])],
[$1(1,2,3,4,5,6,7,8,9,10);]
)],
[AC_MSG_RESULT([no])
$3],

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

@ -86,8 +86,13 @@ AC_DEFUN([_HWLOC_CHECK_COMPILER_VENDOR], [
hwloc_check_compiler_vendor_result="unknown"
# GNU is probably the most common, so check that one as soon as
# possible. Intel pretends to be GNU, so need to check Intel
# before checking for GNU.
# possible. Intel and Android pretend to be GNU, so need to
# check Intel and Android before checking for GNU.
# Android
AS_IF([test "$hwloc_check_compiler_vendor_result" = "unknown"],
[HWLOC_IFDEF_IFELSE([__ANDROID__],
[hwloc_check_compiler_vendor_result="android"])])
# Intel
AS_IF([test "$hwloc_check_compiler_vendor_result" = "unknown"],

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

@ -1,6 +1,6 @@
dnl -*- Autoconf -*-
dnl
dnl Copyright © 2009-2016 Inria. All rights reserved.
dnl Copyright © 2010-2017 Inria. All rights reserved.
dnl Copyright © 2009, 2011 Université Bordeaux
dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
@ -314,11 +314,13 @@ EOF
LIBS="$hwloc_old_LIBS"
unset hwloc_old_LIBS
AC_PATH_TOOL(RMPATH, rm)
_HWLOC_CHECK_DIFF_U
_HWLOC_CHECK_DIFF_W
AC_CHECK_HEADERS([time.h], [
AC_CHECK_FUNCS([clock_gettime])
])
# Only generate this if we're building the utilities
AC_CONFIG_FILES(
hwloc_config_prefix[utils/Makefile]
@ -341,8 +343,10 @@ EOF
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], [],
AC_CHECK_LIB([numa], [numa_available], [
AC_CHECK_DECL([numa_bitmask_alloc], [hwloc_have_linux_libnuma=yes], [],
[#include <numa.h>])
])
AC_CHECK_HEADERS([infiniband/verbs.h], [
AC_CHECK_LIB([ibverbs], [ibv_open_device],
@ -383,10 +387,12 @@ int foo(void) {
AC_CONFIG_FILES(
hwloc_config_prefix[tests/Makefile]
hwloc_config_prefix[tests/linux/Makefile]
hwloc_config_prefix[tests/linux/allowed/Makefile]
hwloc_config_prefix[tests/linux/gather/Makefile]
hwloc_config_prefix[tests/xml/Makefile]
hwloc_config_prefix[tests/ports/Makefile]
hwloc_config_prefix[tests/rename/Makefile]
hwloc_config_prefix[tests/linux/allowed/test-topology.sh]
hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh]
hwloc_config_prefix[tests/linux/test-topology.sh]
hwloc_config_prefix[tests/xml/test-topology.sh]
@ -406,7 +412,7 @@ int foo(void) {
hwloc_config_prefix[utils/lstopo/test-hwloc-ls.sh]
hwloc_config_prefix[contrib/systemd/Makefile])
AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc/hwloc-assembler-remote ]hwloc_config_prefix[utils/hwloc/hwloc-compress-dir ]hwloc_config_prefix[utils/hwloc/hwloc-gather-topology ]hwloc_config_prefix[utils/hwloc/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-calc.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-compress-dir.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-diffpatch.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-distances.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-info.sh ]hwloc_config_prefix[utils/hwloc/test-fake-plugin.sh ]hwloc_config_prefix[utils/lstopo/test-hwloc-ls.sh])
AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/allowed/test-topology.sh ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc/hwloc-assembler-remote ]hwloc_config_prefix[utils/hwloc/hwloc-compress-dir ]hwloc_config_prefix[utils/hwloc/hwloc-gather-topology ]hwloc_config_prefix[utils/hwloc/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-calc.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-compress-dir.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-diffpatch.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-distances.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/hwloc/test-hwloc-info.sh ]hwloc_config_prefix[utils/hwloc/test-fake-plugin.sh ]hwloc_config_prefix[utils/lstopo/test-hwloc-ls.sh])
# These links are only needed in standalone mode. It would
# be nice to m4 foreach this somehow, but whenever I tried

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2017 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -410,7 +410,7 @@ struct hwloc_obj {
*/
hwloc_cpuset_t complete_cpuset; /**< \brief The complete CPU set of logical processors of this object,
*
* This includes not only the same as the cpuset field, but also the CPUs for
* This includes not only the same as the cpuset field, but also some CPUs for
* which topology information is unknown or incomplete, and the CPUs that are
* ignored when the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM flag is not set.
* Thus no corresponding PU object may be found in the topology, because the
@ -457,7 +457,7 @@ struct hwloc_obj {
*/
hwloc_nodeset_t complete_nodeset; /**< \brief The complete NUMA node set of this object,
*
* This includes not only the same as the nodeset field, but also the NUMA
* This includes not only the same as the nodeset field, but also some NUMA
* nodes for which topology information is unknown or incomplete, and the nodes
* that are ignored when the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM flag is not set.
* Thus no corresponding NUMA node object may be found in the topology, because the
@ -631,6 +631,9 @@ HWLOC_DECLSPEC int hwloc_topology_init (hwloc_topology_t *topologyp);
*
* \note This function may be called only once per topology.
*
* \note The binding of the current thread or process may temporarily change
* during this call but it will be restored before it returns.
*
* \sa hwlocality_configuration
*/
HWLOC_DECLSPEC int hwloc_topology_load(hwloc_topology_t topology);
@ -737,6 +740,10 @@ enum hwloc_topology_flags_e {
* When this flag is not set, PUs that are disallowed are not added to the topology.
* Parent objects (package, core, cache, etc.) are added only if some of their children are allowed.
* NUMA nodes are always added but their available memory is set to 0 when disallowed.
*
* If the current topology is exported to XML and reimported later, this flag
* should be set again in the reimported topology so that disallowed resources
* are reimported as well.
* \hideinitializer
*/
HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM = (1UL<<0),
@ -799,7 +806,28 @@ enum hwloc_topology_flags_e {
* instead of only Data and Unified caches.
* \hideinitializer
*/
HWLOC_TOPOLOGY_FLAG_ICACHES = (1UL<<5)
HWLOC_TOPOLOGY_FLAG_ICACHES = (1UL<<5),
/** \brief Get the set of allowed resources from the local operating system even if the topology was loaded from XML or synthetic description.
*
* If the topology was loaded from XML or from a synthetic string,
* restrict it by applying the current process restrictions such as
* Linux Cgroup/Cpuset.
*
* This is useful when the topology is not loaded directly from
* the local machine (e.g. for performance reason) and it comes
* with all resources, while the running process is restricted
* to only parts of the machine.
*
* This flag is ignored unless ::HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM is
* also set since the loaded topology must match the underlying machine
* where restrictions will be gathered from.
*
* Setting the environment variable HWLOC_THISSYSTEM_ALLOWED_RESOURCES
* would result in the same behavior.
* \hideinitializer
*/
HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES = (1UL<<6)
};
/** \brief Set OR'ed flags to non-yet-loaded topology.
@ -1136,6 +1164,9 @@ HWLOC_DECLSPEC void * hwloc_topology_get_userdata(hwloc_topology_t topology);
/** \brief Get the depth of the hierarchical tree of objects.
*
* This is the depth of ::HWLOC_OBJ_PU objects plus one.
*
* \note I/O and Misc objects are ignored when computing the depth
* of the tree (they are placed on special levels, or none).
*/
HWLOC_DECLSPEC unsigned hwloc_topology_get_depth(hwloc_topology_t __hwloc_restrict topology) __hwloc_attribute_pure;
@ -1160,6 +1191,8 @@ HWLOC_DECLSPEC unsigned hwloc_topology_get_depth(hwloc_topology_t __hwloc_restri
* hwloc_get_obj_by_depth() but it should not be considered as an actual
* depth by the application. In particular, it should not be compared with
* any other object depth or with the entire topology depth.
*
* If ::HWLOC_OBJ_MISC is given, the function returns ::HWLOC_TYPE_DEPTH_UNKNOWN.
*/
HWLOC_DECLSPEC int hwloc_get_type_depth (hwloc_topology_t topology, hwloc_obj_type_t type);

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2015 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -34,7 +34,8 @@ extern "C" {
*
* \note CPU sets and nodesets are described in \ref hwlocality_object_sets.
*
* A bitmap may be of infinite size.
* A bitmap may be of infinite size (all bits are set after some point).
* A bitmap may even be full if all bits are set.
*
* \note Several examples of using the bitmap API are available under the
* doc/examples/ directory in the source tree.
@ -111,7 +112,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * __hwl
*
* Lists are comma-separated indexes or ranges.
* Ranges are dash separated indexes.
* The last range may not have a ending indexes if the bitmap is infinite.
* The last range may not have an ending indexes if the bitmap is infinitely set.
*
* Up to \p buflen characters may be written in buffer \p buf.
*
@ -226,12 +227,15 @@ HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id)
/** \brief Test whether bitmap \p bitmap is empty */
HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
/** \brief Test whether bitmap \p bitmap is completely full */
/** \brief Test whether bitmap \p bitmap is completely full
*
* \note A full bitmap is always infinitely set.
*/
HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
/** \brief Compute the first index (least significant bit) in bitmap \p bitmap
*
* \return -1 if no index is set.
* \return -1 if no index is set in \p bitmap.
*/
HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
@ -239,13 +243,13 @@ HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attri
*
* If \p prev is -1, the first index is returned.
*
* \return -1 if no index with higher index is bitmap.
* \return -1 if no index with higher index is set in \p bitmap.
*/
HWLOC_DECLSPEC int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
/** \brief Compute the last index (most significant bit) in bitmap \p bitmap
*
* \return -1 if no index is bitmap, or if the index bitmap is infinite.
* \return -1 if no index is set in \p bitmap, or if \p bitmap is infinitely set.
*/
HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
@ -253,6 +257,8 @@ HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attrib
* indexes that are in the bitmap).
*
* \return the number of indexes that are in the bitmap.
*
* \return -1 if \p bitmap is infinitely set.
*/
HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
@ -267,7 +273,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attr
* indexes set in the bitmap. To be specific: each iteration will return a
* value for \p index such that hwloc_bitmap_isset(bitmap, index) is true.
*
* The assert prevents the loop from being infinite if the bitmap is infinite.
* The assert prevents the loop from being infinite if the bitmap is infinitely set.
*
* \hideinitializer
*/
@ -332,7 +338,10 @@ HWLOC_DECLSPEC void hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t b
/** \brief Test whether bitmaps \p bitmap1 and \p bitmap2 intersects */
HWLOC_DECLSPEC int hwloc_bitmap_intersects (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
/** \brief Test whether bitmap \p sub_bitmap is part of bitmap \p super_bitmap */
/** \brief Test whether bitmap \p sub_bitmap is part of bitmap \p super_bitmap.
*
* \note The empty bitmap is considered included in any other bitmap.
*/
HWLOC_DECLSPEC int hwloc_bitmap_isincluded (hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) __hwloc_attribute_pure;
/** \brief Test whether bitmap \p bitmap1 is equal to bitmap \p bitmap2 */

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

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2015 Inria. All rights reserved.
* Copyright © 2010-2016 Inria. All rights reserved.
* Copyright © 2010-2011 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -112,8 +112,8 @@ hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2015 Inria. All rights reserved.
* Copyright © 2010-2016 Inria. All rights reserved.
* Copyright © 2010-2011 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -109,8 +109,8 @@ hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2014 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -81,6 +81,9 @@ HWLOC_DECLSPEC int hwloc_get_largest_objs_inside_cpuset (hwloc_topology_t topolo
* included in \p set. The next invokation should pass the previous
* return value in \p prev so as to obtain the next object in \p set.
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
*/
@ -91,7 +94,7 @@ hwloc_get_next_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_cons
hwloc_obj_t next = hwloc_get_next_obj_by_depth(topology, depth, prev);
if (!next || !next->cpuset)
return NULL;
while (next && !hwloc_bitmap_isincluded(next->cpuset, set))
while (next && (hwloc_bitmap_iszero(next->cpuset) || !hwloc_bitmap_isincluded(next->cpuset, set)))
next = next->next_cousin;
return next;
}
@ -102,6 +105,9 @@ hwloc_get_next_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_cons
* and let the caller fallback to
* hwloc_get_next_obj_inside_cpuset_by_depth().
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
@ -116,6 +122,9 @@ hwloc_get_next_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const
}
/** \brief Return the (logically) \p idx -th object at depth \p depth included in CPU set \p set.
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
@ -132,7 +141,7 @@ hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpu
if (!obj || !obj->cpuset)
return NULL;
while (obj) {
if (hwloc_bitmap_isincluded(obj->cpuset, set)) {
if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set)) {
if (count == idx)
return obj;
count++;
@ -148,6 +157,9 @@ hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpu
* and let the caller fallback to
* hwloc_get_obj_inside_cpuset_by_depth().
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
@ -165,6 +177,9 @@ hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpus
}
/** \brief Return the number of objects at depth \p depth included in CPU set \p set.
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects at the given depth do
* not have CPU sets or if the topology is made of different machines.
@ -181,7 +196,7 @@ hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_
if (!obj || !obj->cpuset)
return 0;
while (obj) {
if (hwloc_bitmap_isincluded(obj->cpuset, set))
if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set))
count++;
obj = obj->next_cousin;
}
@ -194,6 +209,9 @@ hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_
* returned. If there are several levels with objects of that type
* inside CPU set \p set, -1 is returned.
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*
* \note This function cannot work if objects of the given type do
* not have CPU sets or if the topology is made of different machines.
*/
@ -219,6 +237,9 @@ hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_c
* If \p set covers the entire topology, this is the logical index of \p obj.
* Otherwise, this is similar to a logical index within the part of the topology
* defined by CPU set \p set.
*
* \note Objects with empty CPU sets are ignored
* (otherwise they would be considered included in any given set).
*/
static __hwloc_inline int
hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
@ -232,7 +253,7 @@ hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_u
return -1;
/* count how many objects are inside the cpuset on the way from us to the beginning of the level */
while ((obj = obj->prev_cousin) != NULL)
if (hwloc_bitmap_isincluded(obj->cpuset, set))
if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set))
idx++;
return idx;
}

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

@ -1,5 +1,5 @@
/*
* Copyright © 2013 Inria. All rights reserved.
* Copyright © 2013-2016 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -87,8 +87,8 @@ hwloc_intel_mic_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_un
return -1;
}
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -1,5 +1,5 @@
/*
* Copyright © 2012-2013 Inria. All rights reserved.
* Copyright © 2012-2016 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -80,8 +80,8 @@ hwloc_nvml_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -1,5 +1,5 @@
/*
* Copyright © 2012-2013 Inria. All rights reserved.
* Copyright © 2012-2016 Inria. All rights reserved.
* Copyright © 2013 Université Bordeaux. All right reserved.
* See COPYING in top-level directory.
*/
@ -93,8 +93,8 @@ hwloc_opencl_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -80,8 +80,8 @@ hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
if (hwloc_bitmap_iszero(set))
if (hwloc_linux_parse_cpumap_file(sysfile, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
fclose(sysfile);

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010-2016 Inria. All rights reserved.
* Copyright © 2010-2017 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -120,6 +120,7 @@ extern "C" {
#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_FLAG_THISSYSTEM_ALLOWED_RESOURCES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES)
#define hwloc_topology_set_flags HWLOC_NAME(topology_set_flags)
#define hwloc_topology_set_fsroot HWLOC_NAME(topology_set_fsroot)

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

@ -24,6 +24,9 @@
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
#undef HAVE_CACHE_RELATIONSHIP
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the `clz' function. */
#undef HAVE_CLZ
@ -79,6 +82,10 @@
don't. */
#undef HAVE_DECL_HW_NCPU
/* Define to 1 if you have the declaration of `lgrp_latency_cookie', and to 0
if you don't. */
#undef HAVE_DECL_LGRP_LATENCY_COOKIE
/* Define to 1 if you have the declaration of
`nvmlDeviceGetMaxPcieLinkGeneration', and to 0 if you don't. */
#undef HAVE_DECL_NVMLDEVICEGETMAXPCIELINKGENERATION
@ -91,8 +98,7 @@
0 if you don't. */
#undef HAVE_DECL_PTHREAD_SETAFFINITY_NP
/* Define to 1 if you have the declaration of `RUNNING_ON_VALGRIND', and to 0
if you don't. */
/* Embedded mode; just assume we do not have Valgrind support */
#undef HAVE_DECL_RUNNING_ON_VALGRIND
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
@ -353,6 +359,9 @@
/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
@ -518,6 +527,9 @@
/* Define to 1 if you have a library providing the termcap interface */
#undef HWLOC_HAVE_LIBTERMCAP
/* Define to 1 if you have libudev. */
#undef HWLOC_HAVE_LIBUDEV
/* Define to 1 if you have the `libxml2' library. */
#undef HWLOC_HAVE_LIBXML2

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2017 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
*
@ -101,6 +101,8 @@ struct hwloc_topology {
* see hwloc_alloc_or_fail which is convenient for that. */
void *(*alloc_membind)(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*free_membind)(hwloc_topology_t topology, void *addr, size_t len);
int (*get_allowed_resources)(hwloc_topology_t topology);
} binding_hooks;
struct hwloc_topology_support support;

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

@ -1,5 +1,5 @@
/*
* Copyright © 2009-2013 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -39,7 +39,7 @@ struct hwloc_xml_backend_data_s {
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);
int (*get_content)(struct hwloc__xml_import_state_s * state, char **beginp, size_t expected_length);
int (*get_content)(struct hwloc__xml_import_state_s * state, char **beginp, size_t expected_length); /* return 0 on empty content (and sets beginp to empty string), 1 on actual content, -1 on error or unexpected content length */
void (*close_content)(struct hwloc__xml_import_state_s * state);
char * msgprefix;
void *data; /* libxml2 doc, or nolibxml buffer */

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

@ -771,31 +771,45 @@ void hwloc_bitmap_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, int
HWLOC__BITMAP_CHECK(set);
if (_endcpu == -1) {
set->infinite = 1;
/* keep endcpu == -1 since this unsigned is actually larger than anything else */
}
if (set->infinite) {
/* truncate the range according to the infinite part of the bitmap */
if (endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
if (begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
}
if (endcpu < begincpu)
return;
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
if (set->infinite && begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
/* setting only in the already-set infinite part, nothing to do */
return;
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_FULL;
if (beginset == endset) {
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
if (_endcpu == -1) {
/* infinite range */
/* make sure we can play with the ulong that contains begincpu */
hwloc_bitmap_realloc_by_cpu_index(set, begincpu);
/* update the ulong that contains begincpu */
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] |= HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
/* set ulongs after begincpu if any already allocated */
for(i=beginset+1; i<set->ulongs_count; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_FULL;
/* mark the infinity as set */
set->infinite = 1;
} else {
/* finite range */
/* ignore the part of the range that overlaps with the already-set infinite part */
if (set->infinite && endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
/* make sure we can play with the ulongs that contain begincpu and endcpu */
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
/* update first and last ulongs */
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
if (beginset == endset) {
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] |= HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
}
/* set ulongs in the middle of the range */
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_FULL;
}
}
@ -829,31 +843,46 @@ void hwloc_bitmap_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, int
HWLOC__BITMAP_CHECK(set);
if (_endcpu == -1) {
set->infinite = 0;
/* keep endcpu == -1 since this unsigned is actually larger than anything else */
}
if (!set->infinite) {
/* truncate the range according to the infinitely-unset part of the bitmap */
if (endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
if (begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
}
if (endcpu < begincpu)
return;
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
if (beginset == endset) {
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
if (!set->infinite && begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
/* clearing only in the already-unset infinite part, nothing to do */
return;
if (_endcpu == -1) {
/* infinite range */
/* make sure we can play with the ulong that contains begincpu */
hwloc_bitmap_realloc_by_cpu_index(set, begincpu);
/* update the ulong that contains begincpu */
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] &= ~HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
/* clear ulong after begincpu if any already allocated */
for(i=beginset+1; i<set->ulongs_count; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
/* mark the infinity as unset */
set->infinite = 0;
} else {
/* finite range */
/* ignore the part of the range that overlaps with the already-unset infinite part */
if (!set->infinite && endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
/* make sure we can play with the ulongs that contain begincpu and endcpu */
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
/* update first and last ulongs */
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
if (beginset == endset) {
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] &= ~HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
}
/* clear ulongs in the middle of the range */
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
}
}

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

@ -478,13 +478,14 @@ hwloc_distances__finalize_logical(struct hwloc_topology *topology,
unsigned nbobjs,
hwloc_obj_t *objs, float *osmatrix)
{
struct hwloc_distances_s ** tmpdistances;
unsigned i, j, li, lj, minl;
float min = FLT_MAX, max = FLT_MIN;
hwloc_obj_t root;
hwloc_obj_t root, obj;
float *matrix;
hwloc_cpuset_t cpuset, complete_cpuset;
hwloc_nodeset_t nodeset, complete_nodeset;
unsigned relative_depth;
unsigned depth;
int idx;
/* find the root */
@ -550,13 +551,25 @@ hwloc_distances__finalize_logical(struct hwloc_topology *topology,
hwloc_bitmap_free(complete_cpuset);
hwloc_bitmap_free(nodeset);
hwloc_bitmap_free(complete_nodeset);
if (root->depth >= objs[0]->depth) {
depth = objs[0]->depth; /* this assume that we have distances between objects of the same level */
if (root->depth >= depth) {
/* strange topology led us to find invalid relative depth, ignore */
return;
}
relative_depth = objs[0]->depth - root->depth; /* this assume that we have distances between objects of the same level */
if (nbobjs != hwloc_get_nbobjs_inside_cpuset_by_depth(topology, root->cpuset, root->depth + relative_depth))
/* count objects at that depth that are below root.
* we can't use hwloc_get_nbobjs_inside_cpuset_by_depth() because it ignore CPU-less objects.
*/
i = 0;
obj = NULL;
while ((obj = hwloc_get_next_obj_by_depth(topology, depth, obj)) != NULL) {
hwloc_obj_t myparent = obj->parent;
while (myparent->depth > root->depth)
myparent = myparent->parent;
if (myparent == root)
i++;
}
if (i != nbobjs)
/* the root does not cover the right number of objects, maybe we failed to insert a root (bad intersect or so). */
return;
@ -585,10 +598,14 @@ hwloc_distances__finalize_logical(struct hwloc_topology *topology,
}
/* store the normalized latency matrix in the root object */
tmpdistances = realloc(root->distances, (root->distances_count+1) * sizeof(struct hwloc_distances_s *));
if (!tmpdistances)
return; /* Failed to allocate, ignore this distance matrix */
root->distances = tmpdistances;
idx = root->distances_count++;
root->distances = realloc(root->distances, root->distances_count * sizeof(struct hwloc_distances_s *));
root->distances[idx] = malloc(sizeof(struct hwloc_distances_s));
root->distances[idx]->relative_depth = relative_depth;
root->distances[idx]->relative_depth = depth - root->depth;
root->distances[idx]->nbobjs = nbobjs;
root->distances[idx]->latency = matrix = malloc(nbobjs*nbobjs*sizeof(float));
root->distances[idx]->latency_base = (float) min;

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

@ -1,5 +1,5 @@
/*
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2017 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -470,9 +470,17 @@ hwloc_pci_find_linkspeed(const unsigned char *config,
/* 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
* PCIe Gen4 = 16 GT/s signal-rate per lane with 128/130 encoding = 2 GB/s data-rate per lane
*/
lanespeed = speed <= 2 ? 2.5f * speed * 0.8f : 8.0f * 128/130; /* Gbit/s per lane */
*linkspeed = lanespeed * width / 8; /* GB/s */
/* lanespeed in Gbit/s */
if (speed <= 2)
lanespeed = 2.5f * speed * 0.8f;
else
lanespeed = 8.0f * (1<<(speed-3)) * 128/130; /* assume Gen5 will be 32 GT/s and so on */
/* linkspeed in GB/s */
*linkspeed = lanespeed * width / 8;
return 0;
}

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

@ -650,7 +650,7 @@ look_rset(int sdl, hwloc_obj_type_t type, struct hwloc_topology *topology, int l
obj->memory.page_types = malloc(2*sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, 2*sizeof(*obj->memory.page_types));
obj->memory.page_types[0].size = hwloc_getpagesize();
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
/* TODO: obj->memory.page_types[1].count = rs_getinfo(rset, R_LGPGFREE, 0) / hugepagesize */

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

@ -1,5 +1,5 @@
/*
* Copyright © 2013-2015 Inria. All rights reserved.
* Copyright © 2013-2017 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -17,33 +17,45 @@
#ifndef HWLOC_DISABLE_BGQ_PORT_TEST
#define HWLOC_BGQ_CORES 17 /* spare core ignored for now */
static int
hwloc_bgq__get_allowed_resources(struct hwloc_topology *topology)
{
const char *env;
unsigned i;
/* mark the 17th core (OS-reserved) as disallowed */
hwloc_bitmap_clr_range(topology->levels[0][0]->allowed_cpuset, (HWLOC_BGQ_CORES-1)*4, HWLOC_BGQ_CORES*4-1);
if (topology->is_thissystem) { /* don't call CNK unless thissystem */
env = getenv("BG_THREADMODEL");
if (!env || atoi(env) != 2) {
/* process cannot use cores/threads outside of its Kernel_ThreadMask() unless BG_THREADMODEL=2 */
uint64_t bgmask = Kernel_ThreadMask(Kernel_MyTcoord());
/* the mask is reversed, manually reverse it */
for(i=0; i<64; i++)
if (((bgmask >> i) & 1) == 0)
hwloc_bitmap_clr(topology->levels[0][0]->allowed_cpuset, 63-i);
}
}
return 0;
}
static int
hwloc_look_bgq(struct hwloc_backend *backend)
{
struct hwloc_topology *topology = backend->topology;
unsigned i;
const char *env;
if (!topology->levels[0][0]->cpuset) {
/* Nobody created objects yet, setup everything */
hwloc_bitmap_t set;
hwloc_obj_t obj;
#define HWLOC_BGQ_CORES 17 /* spare core ignored for now */
hwloc_alloc_obj_cpusets(topology->levels[0][0]);
/* mark the 17th core (OS-reserved) as disallowed */
hwloc_bitmap_clr_range(topology->levels[0][0]->allowed_cpuset, (HWLOC_BGQ_CORES-1)*4, HWLOC_BGQ_CORES*4-1);
env = getenv("BG_THREADMODEL");
if (!env || atoi(env) != 2) {
/* process cannot use cores/threads outside of its Kernel_ThreadMask() */
uint64_t bgmask = Kernel_ThreadMask(Kernel_MyTcoord());
/* the mask is reversed, manually reverse it */
for(i=0; i<64; i++)
if (((bgmask >> i) & 1) == 0)
hwloc_bitmap_clr(topology->levels[0][0]->allowed_cpuset, 63-i);
}
hwloc_bgq__get_allowed_resources(topology);
/* a single memory bank */
set = hwloc_bitmap_alloc();
@ -183,6 +195,21 @@ hwloc_bgq_set_thisthread_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t
return hwloc_bgq_set_thread_cpubind(topology, pthread_self(), hwloc_set, flags);
}
static int
hwloc_bgq_get_allowed_resources(struct hwloc_topology *topology)
{
/* Loading BGQ from XML isn't much useful since everything is hardwired anyway.
* But still implement XML + this callback in case portable applications want to always use XMLs.
*/
/* In theory, when applying local restrictions to a XML-loaded topology,
* we should check that the current topology contains 1 NUMA nodes and 17*4 PUs.
*
* Just trust the user when he sets THISSYSTEM=1.
*/
return hwloc_bgq__get_allowed_resources(topology);
}
void
hwloc_set_bgq_hooks(struct hwloc_binding_hooks *hooks __hwloc_attribute_unused,
struct hwloc_topology_support *support __hwloc_attribute_unused)
@ -194,6 +221,8 @@ hwloc_set_bgq_hooks(struct hwloc_binding_hooks *hooks __hwloc_attribute_unused,
/* threads cannot be bound to more than one PU, so get_last_cpu_location == get_cpubind */
hooks->get_thisthread_last_cpu_location = hwloc_bgq_get_thisthread_cpubind;
/* hooks->get_thread_last_cpu_location = hwloc_bgq_get_thread_cpubind; */
hooks->get_allowed_resources = hwloc_bgq_get_allowed_resources;
}
static struct hwloc_backend *
@ -204,17 +233,23 @@ hwloc_bgq_component_instantiate(struct hwloc_disc_component *component,
{
struct utsname utsname;
struct hwloc_backend *backend;
const char *env;
int forced_nonbgq = 0;
int err;
env = getenv("HWLOC_FORCE_BGQ");
if (!env || !atoi(env)) {
err = uname(&utsname);
if (err || strcmp(utsname.sysname, "CNK") || strcmp(utsname.machine, "BGQ")) {
fprintf(stderr, "*** Found unexpected uname sysname `%s' machine `%s'\n", utsname.sysname, utsname.machine);
fprintf(stderr, "*** The BGQ backend is only enabled on compute nodes by default (sysname=CNK machine=BGQ)\n");
fprintf(stderr, "*** Set HWLOC_FORCE_BGQ=1 in the environment to enforce the BGQ backend anyway.\n");
err = uname(&utsname);
if (err || strcmp(utsname.sysname, "CNK") || strcmp(utsname.machine, "BGQ")) {
const char *env = getenv("HWLOC_FORCE_BGQ");
if (!env || !atoi(env)) {
fprintf(stderr, "*** Found unexpected uname sysname `%s' machine `%s'.\n", utsname.sysname, utsname.machine);
fprintf(stderr, "*** The BlueGene/Q backend (bgq) is only enabled by default on compute nodes\n"
"*** (where uname returns sysname=CNK and machine=BGQ).\n"
"*** If you know you *really* want to run the bgq backend on this non-compute node,\n"
"*** set HWLOC_FORCE_BGQ=1 in the environment.\n"
"*** If you just want to discover the native topology of this non-compute node,\n"
"*** do not pass any BlueGene/Q-specific options on the configure command-line.\n");
return NULL;
} else {
forced_nonbgq = 1;
}
}
@ -222,6 +257,8 @@ hwloc_bgq_component_instantiate(struct hwloc_disc_component *component,
if (!backend)
return NULL;
backend->discover = hwloc_look_bgq;
if (forced_nonbgq)
backend->is_thissystem = 0;
return backend;
}

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2014 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2013 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -238,7 +238,7 @@ hwloc_look_darwin(struct hwloc_backend *backend)
obj->memory.page_types = malloc(2*sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, 2*sizeof(*obj->memory.page_types));
obj->memory.page_types[0].size = hwloc_getpagesize();
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
}

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

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2015 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -291,7 +291,7 @@ hwloc_look_osf(struct hwloc_backend *backend)
obj->memory.page_types = malloc(2*sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, 2*sizeof(*obj->memory.page_types));
obj->memory.page_types[0].size = hwloc_getpagesize();
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif

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

@ -1,6 +1,7 @@
/*
* Copyright © 2009-2010 Oracle and/or its affiliates. All rights reserved.
* Copyright © 2013 Université Bordeaux. All rights reserved.
* Copyright © 2016 Inria. All rights reserved.
*
* $COPYRIGHT$
*
@ -52,7 +53,9 @@ static const char* sparc_modes[] = {
"T1",
"T2",
"SPARC64_VII",
"ROCK"
"ROCK",
"T5"
/* needs T4, T3 and T2+ ? */
};
/*****************************************************************************
@ -144,6 +147,10 @@ static void assign_string_value(int index, char* string_val) {
PICL_PROPNAMELEN_MAX) == 0) {
dss_chip_mode = 8;
}
else if (strncasecmp(string_val, "SPARC-T5",
PICL_PROPNAMELEN_MAX) == 0) {
dss_chip_mode = 9;
}
} else if (index == 8) { /* ProcessorType */
strncpy(&dss_chip_type[0], string_val, PICL_PROPNAMELEN_MAX);
} else if (index == 10) { /* brand-string */

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

@ -382,7 +382,7 @@ browse(struct hwloc_topology *topology, lgrp_cookie_t cookie, lgrp_id_t lgrp, hw
obj->memory.page_types = malloc(2*sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, 2*sizeof(*obj->memory.page_types));
obj->memory.page_types[0].size = hwloc_getpagesize();
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
hwloc_insert_object_by_cpuset(topology, obj);
@ -429,7 +429,7 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
if (nlgrps > 0) {
hwloc_obj_t *glob_lgrps = calloc(nlgrps, sizeof(hwloc_obj_t));
browse(topology, cookie, root, glob_lgrps, &curlgrp);
#ifdef HAVE_LGRP_LATENCY_COOKIE
#if HAVE_DECL_LGRP_LATENCY_COOKIE
if (nlgrps > 1) {
float *distances = calloc(curlgrp*curlgrp, sizeof(float));
unsigned *indexes = calloc(curlgrp,sizeof(unsigned));
@ -440,8 +440,9 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
distances[i*curlgrp+j] = (float) lgrp_latency_cookie(cookie, glob_lgrps[i]->os_index, glob_lgrps[j]->os_index, LGRP_LAT_CPU_TO_MEM);
}
hwloc_distances_set(topology, HWLOC_OBJ_NUMANODE, curlgrp, indexes, glob_lgrps, distances, 0 /* OS cannot force */);
}
#endif /* HAVE_LGRP_LATENCY_COOKIE */
} else
#endif /* HAVE_DECL_LGRP_LATENCY_COOKIE */
free(glob_lgrps);
}
lgrp_fini(cookie);
}
@ -520,8 +521,11 @@ hwloc_look_kstat(struct hwloc_topology *topology)
hwloc_debug("cpu%u\n", cpuid);
if (cpuid >= Pproc_alloc) {
struct hwloc_solaris_Pproc *tmp = realloc(Pproc, 2*Pproc_alloc * sizeof(*Pproc));
if (!tmp)
goto err;
Pproc = tmp;
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].Lpkg = -1;
@ -532,8 +536,11 @@ hwloc_look_kstat(struct hwloc_topology *topology)
Pproc[cpuid].Lproc = Lproc_num;
if (Lproc_num >= Lproc_alloc) {
struct hwloc_solaris_Lproc *tmp = realloc(Lproc, 2*Lproc_alloc * sizeof(*Lproc));
if (!tmp)
goto err;
Lproc = tmp;
Lproc_alloc *= 2;
Lproc = realloc(Lproc, Lproc_alloc * sizeof(*Lproc));
}
Lproc[Lproc_num].Pproc = cpuid;
Lproc_num++;
@ -594,8 +601,11 @@ hwloc_look_kstat(struct hwloc_topology *topology)
hwloc_debug("%u on package %u (%u)\n", cpuid, i, pkgid);
if (i == Lpkg_num) {
if (Lpkg_num == Lpkg_alloc) {
struct hwloc_solaris_Lpkg *tmp = realloc(Lpkg, 2*Lpkg_alloc * sizeof(*Lpkg));
if (!tmp)
goto err;
Lpkg = tmp;
Lpkg_alloc *= 2;
Lpkg = realloc(Lpkg, Lpkg_alloc * sizeof(*Lpkg));
}
Lpkg[Lpkg_num++].Ppkg = pkgid;
}
@ -640,8 +650,11 @@ hwloc_look_kstat(struct hwloc_topology *topology)
hwloc_debug("%u on core %u (%u)\n", cpuid, i, coreid);
if (i == Lcore_num) {
if (Lcore_num == Lcore_alloc) {
struct hwloc_solaris_Lcore *tmp = realloc(Lcore, 2*Lcore_alloc * sizeof(*Lcore));
if (!tmp)
goto err;
Lcore = tmp;
Lcore_alloc *= 2;
Lcore = realloc(Lcore, Lcore_alloc * sizeof(*Lcore));
}
Lcore[Lcore_num].Ppkg = Pproc[cpuid].Ppkg;
Lcore[Lcore_num++].Pcore = coreid;
@ -710,8 +723,16 @@ hwloc_look_kstat(struct hwloc_topology *topology)
free(Lproc);
free(Lcore);
free(Lpkg);
return Lproc_num > 0;
err:
kstat_close(kc);
free(Pproc);
free(Lproc);
free(Lcore);
free(Lpkg);
return 0;
}
#endif /* LIBKSTAT */

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

@ -81,7 +81,7 @@ hwloc_synthetic_process_level_indexes(struct hwloc_synthetic_backend_data_s *dat
unsigned idx = strtoul(attr, (char **) &next, 10);
if (next == attr) {
if (verbose)
fprintf(stderr, "Failed to read synthetic index #%lu at '%s'\n", i, attr);
fprintf(stderr, "Failed to read synthetic index #%lu at '%s'\n", (unsigned long) i, attr);
goto out_with_array;
}
@ -89,7 +89,7 @@ hwloc_synthetic_process_level_indexes(struct hwloc_synthetic_backend_data_s *dat
if (i != total-1) {
if (*next != ',') {
if (verbose)
fprintf(stderr, "Missing comma after synthetic index #%lu at '%s'\n", i, attr);
fprintf(stderr, "Missing comma after synthetic index #%lu at '%s'\n", (unsigned long) i, attr);
goto out_with_array;
}
attr = next+1;
@ -870,7 +870,7 @@ static int hwloc_topology_export_synthetic_indexes(struct hwloc_topology * topol
unsigned total = topology->level_nbobjects[depth];
unsigned step = 1;
unsigned nr_loops = 0;
struct hwloc_synthetic_intlv_loop_s *loops = NULL;
struct hwloc_synthetic_intlv_loop_s *loops = NULL, *tmploops;
hwloc_obj_t cur;
unsigned i, j;
ssize_t tmplen = buflen;
@ -897,9 +897,10 @@ static int hwloc_topology_export_synthetic_indexes(struct hwloc_topology * topol
break;
nr_loops++;
loops = realloc(loops, nr_loops*sizeof(*loops));
if (!loops)
tmploops = realloc(loops, nr_loops*sizeof(*loops));
if (!tmploops)
goto exportall;
loops = tmploops;
loops[nr_loops-1].step = i;
loops[nr_loops-1].nb = j;
step *= j;

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2015 Inria. All rights reserved.
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -741,7 +741,7 @@ hwloc_look_windows(struct hwloc_backend *backend)
GetSystemInfo(&SystemInfo);
if (!GetLogicalProcessorInformationExProc && GetLogicalProcessorInformationProc) {
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION procInfo;
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION procInfo, tmpprocInfo;
unsigned id;
unsigned i;
struct hwloc_obj *obj;
@ -755,7 +755,12 @@ hwloc_look_windows(struct hwloc_backend *backend)
break;
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return -1;
procInfo = realloc(procInfo, length);
tmpprocInfo = realloc(procInfo, length);
if (!tmpprocInfo) {
free(procInfo);
goto out;
}
procInfo = tmpprocInfo;
}
assert(!length || procInfo);
@ -811,7 +816,7 @@ hwloc_look_windows(struct hwloc_backend *backend)
memset(obj->memory.page_types, 0, 2 * sizeof(*obj->memory.page_types));
obj->memory.page_types_len = 1;
obj->memory.page_types[0].size = SystemInfo.dwPageSize;
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types_len++;
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
@ -850,8 +855,7 @@ hwloc_look_windows(struct hwloc_backend *backend)
}
if (GetLogicalProcessorInformationExProc) {
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX procInfoTotal, procInfo;
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX procInfoTotal, tmpprocInfoTotal, procInfo;
unsigned id;
struct hwloc_obj *obj;
hwloc_obj_type_t type;
@ -864,7 +868,12 @@ hwloc_look_windows(struct hwloc_backend *backend)
break;
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return -1;
procInfoTotal = realloc(procInfoTotal, length);
tmpprocInfoTotal = realloc(procInfoTotal, length);
if (!tmpprocInfoTotal) {
free(procInfoTotal);
goto out;
}
procInfoTotal = tmpprocInfoTotal;
}
for (procInfo = procInfoTotal;
@ -952,7 +961,7 @@ hwloc_look_windows(struct hwloc_backend *backend)
memset(obj->memory.page_types, 0, 2 * sizeof(*obj->memory.page_types));
obj->memory.page_types_len = 1;
obj->memory.page_types[0].size = SystemInfo.dwPageSize;
#ifdef HAVE__SC_LARGE_PAGESIZE
#if HAVE_DECL__SC_LARGE_PAGESIZE
obj->memory.page_types_len++;
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
@ -1018,6 +1027,7 @@ hwloc_look_windows(struct hwloc_backend *backend)
}
}
out:
hwloc_obj_add_info(topology->levels[0][0], "Backend", "Windows");
if (topology->is_thissystem)
hwloc_add_uname_info(topology, NULL);

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

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2016 Inria. All rights reserved.
* Copyright © 2010-2017 Inria. All rights reserved.
* Copyright © 2010-2013 Université Bordeaux
* Copyright © 2010-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -81,7 +81,7 @@ enum cpuid_type {
static void fill_amd_cache(struct procinfo *infos, unsigned level, int type, unsigned cpuid)
{
struct cacheinfo *cache;
struct cacheinfo *cache, *tmpcaches;
unsigned cachenum;
unsigned long size = 0;
@ -94,8 +94,13 @@ static void fill_amd_cache(struct procinfo *infos, unsigned level, int type, uns
if (!size)
return;
tmpcaches = realloc(infos->cache, (infos->numcaches+1)*sizeof(*infos->cache));
if (!tmpcaches)
/* failed to allocated, ignore that cache */
return;
infos->cache = tmpcaches;
cachenum = infos->numcaches++;
infos->cache = realloc(infos->cache, infos->numcaches*sizeof(*infos->cache));
cache = &infos->cache[cachenum];
cache->type = type;
@ -178,8 +183,9 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
}
infos->cpustepping = eax & 0xf;
if (cpuid_type == intel && infos->cpufamilynumber == 0x6 && infos->cpumodelnumber == 0x57)
data->is_knl = 1;
if (cpuid_type == intel && infos->cpufamilynumber == 0x6 &&
(infos->cpumodelnumber == 0x57 || infos->cpumodelnumber == 0x85))
data->is_knl = 1; /* KNM is the same as KNL */
/* Get cpu vendor string from cpuid 0x00 */
memset(regs, 0, sizeof(regs));
@ -240,19 +246,37 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
* (AMD topology extension)
*/
if (cpuid_type != intel && has_topoext(features)) {
unsigned apic_id, node_id, nodes_per_proc, unit_id, cores_per_unit;
unsigned apic_id, node_id, nodes_per_proc;
eax = 0x8000001e;
hwloc_x86_cpuid(&eax, &ebx, &ecx, &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);
if (infos->cpufamilynumber == 0x16) {
/* ecx is reserved */
node_id = 0;
nodes_per_proc = 1;
} else {
node_id = ecx & 0xff;
nodes_per_proc = ((ecx >> 8) & 7) + 1;
}
infos->nodeid = node_id;
if ((infos->cpufamilynumber == 0x15 && nodes_per_proc > 2)
|| (infos->cpufamilynumber == 0x17 && nodes_per_proc > 4)) {
hwloc_debug("warning: undefined nodes_per_proc value %d, assuming it means %d\n", nodes_per_proc, nodes_per_proc);
}
if (infos->cpufamilynumber <= 0x16) { /* topoext appeared in 0x15 and compute-units were only used in 0x15 and 0x16 */
unsigned unit_id, cores_per_unit;
infos->unitid = unit_id = ebx & 0xff;
cores_per_unit = ((ebx >> 8) & 0xff) + 1;
hwloc_debug("topoext %08x, %d nodes, node %d, %d cores in unit %d\n", apic_id, nodes_per_proc, node_id, cores_per_unit, unit_id);
} else {
unsigned core_id, threads_per_core;
infos->coreid = core_id = ebx & 0xff;
threads_per_core = ((ebx >> 8) & 0xff) + 1;
hwloc_debug("topoext %08x, %d nodes, node %d, %d threads in core %d\n", apic_id, nodes_per_proc, node_id, threads_per_core, core_id);
}
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;
@ -731,6 +755,7 @@ static int summarize(struct hwloc_backend *backend, struct procinfo *infos, int
hwloc_bitmap_copy(remaining_cpuset, complete_cpuset);
while ((i = hwloc_bitmap_first(remaining_cpuset)) != (unsigned) -1) {
unsigned packageid = infos[i].packageid;
unsigned nodeid = infos[i].nodeid;
unsigned coreid = infos[i].coreid;
if (coreid == (unsigned) -1) {
@ -745,7 +770,7 @@ static int summarize(struct hwloc_backend *backend, struct procinfo *infos, int
continue;
}
if (infos[j].packageid == packageid && infos[j].coreid == coreid) {
if (infos[j].packageid == packageid && infos[j].nodeid == nodeid && infos[j].coreid == coreid) {
hwloc_bitmap_set(core_cpuset, j);
hwloc_bitmap_clr(remaining_cpuset, j);
}

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

@ -131,10 +131,12 @@ hwloc__libxml_import_get_content(hwloc__xml_import_state_t state,
size_t length;
child = lstate->node->children;
if (!child)
return 0;
if (child->type != XML_TEXT_NODE)
if (!child || child->type != XML_TEXT_NODE) {
if (expected_length)
return -1;
*beginp = "";
return 0;
}
length = strlen((char *) child->content);
if (length != expected_length)

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

@ -219,8 +219,12 @@ hwloc__nolibxml_import_get_content(hwloc__xml_import_state_t state,
char *end;
/* auto-closed tags have no content */
if (nstate->closed)
if (nstate->closed) {
if (expected_length)
return -1;
*beginp = "";
return 0;
}
/* find the next tag, where the content ends */
end = strchr(buffer, '<');
@ -315,7 +319,7 @@ hwloc_nolibxml_read_file(const char *xmlpath, char **bufferp, size_t *buflenp)
FILE * file;
size_t buflen, offset, readlen;
struct stat statbuf;
char *buffer;
char *buffer, *tmp;
size_t ret;
if (!strcmp(xmlpath, "-"))
@ -346,9 +350,10 @@ hwloc_nolibxml_read_file(const char *xmlpath, char **bufferp, size_t *buflenp)
break;
buflen *= 2;
buffer = realloc(buffer, buflen+1);
if (!buffer)
goto out_with_file;
tmp = realloc(buffer, buflen+1);
if (!tmp)
goto out_with_buffer;
buffer = tmp;
readlen = buflen/2;
}
@ -357,6 +362,8 @@ hwloc_nolibxml_read_file(const char *xmlpath, char **bufferp, size_t *buflenp)
*buflenp = offset+1;
return 0;
out_with_buffer:
free(buffer);
out_with_file:
fclose(file);
out:
@ -677,10 +684,17 @@ hwloc_nolibxml_export_buffer(hwloc_topology_t topology, char **bufferp, int *buf
bufferlen = 16384; /* random guess for large enough default */
buffer = malloc(bufferlen);
if (!buffer)
return -1;
res = hwloc___nolibxml_prepare_export(topology, buffer, (int)bufferlen);
if (res > bufferlen) {
buffer = realloc(buffer, res);
char *tmp = realloc(buffer, res);
if (!tmp) {
free(buffer);
return -1;
}
buffer = tmp;
hwloc___nolibxml_prepare_export(topology, buffer, (int)res);
}
@ -769,10 +783,17 @@ hwloc_nolibxml_export_diff_buffer(hwloc_topology_diff_t diff, const char *refnam
bufferlen = 16384; /* random guess for large enough default */
buffer = malloc(bufferlen);
if (!buffer)
return -1;
res = hwloc___nolibxml_prepare_export_diff(diff, refname, buffer, (int)bufferlen);
if (res > bufferlen) {
buffer = realloc(buffer, res);
char *tmp = realloc(buffer, res);
if (!tmp) {
free(buffer);
return -1;
}
buffer = tmp;
hwloc___nolibxml_prepare_export_diff(diff, refname, buffer, (int)res);
}

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2017 Inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -338,8 +338,11 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology __hwloc_attribute_
}
}
else if (!strcmp(name, "subtype")) {
/* FIXME: should be "CoProcType" for osdev/coproc but we don't have that type-specific attribute yet */
hwloc_obj_add_info(obj, "Type", value);
/* will be changed into CoProcType in the caller once we have osdev.type too */
}
else if (!strcmp(name, "gp_index")) {
/* doesn't exist in v1.x */
}
@ -470,10 +473,14 @@ hwloc__xml_import_pagetype(hwloc_topology_t topology __hwloc_attribute_unused, h
if (size) {
int idx = obj->memory.page_types_len;
obj->memory.page_types = realloc(obj->memory.page_types, (idx+1)*sizeof(*obj->memory.page_types));
obj->memory.page_types_len = idx+1;
obj->memory.page_types[idx].size = size;
obj->memory.page_types[idx].count = count;
struct hwloc_obj_memory_page_type_s *tmp;
tmp = realloc(obj->memory.page_types, (idx+1)*sizeof(*obj->memory.page_types));
if (tmp) { /* if failed to allocate, ignore this page_type entry */
obj->memory.page_types = tmp;
obj->memory.page_types_len = idx+1;
obj->memory.page_types[idx].size = size;
obj->memory.page_types[idx].count = count;
}
}
return state->global->close_tag(state);
@ -569,12 +576,13 @@ hwloc__xml_import_distances(struct hwloc_xml_backend_data_s *data,
free(distances);
} else {
/* queue the distance */
distances->prev = data->last_distances;
distances->next = NULL;
if (data->last_distances)
data->last_distances->next = distances;
else
data->first_distances = distances;
distances->prev = data->last_distances;
distances->next = NULL;
data->last_distances = distances;
}
}
@ -682,6 +690,21 @@ hwloc__xml_import_object(hwloc_topology_t topology,
}
}
/* obj->subtype is imported as "CoProcType" instead of "Type" for osdev/coproc.
* Cannot properly import earlier because osdev.type is imported after subtype.
* Don't do it later so that the actual infos array isn't imported yet,
* there's likely only "Type" in obj->infos[].
*/
if (obj->type == HWLOC_OBJ_OS_DEVICE && obj->attr->osdev.type == HWLOC_OBJ_OSDEV_COPROC) {
unsigned i;
for(i=0; i<obj->infos_count; i++)
if (!strcmp(obj->infos[i].name, "Type")) {
/* HACK: we're not supposed to modify infos[].name from here */
free(obj->infos[i].name);
obj->infos[i].name = strdup("CoProcType");
}
}
if (parent) {
/* root->parent is NULL, and root is already inserted */
@ -776,7 +799,9 @@ hwloc__xml_import_object(hwloc_topology_t topology,
return state->global->close_tag(state);
error_with_object:
hwloc_free_unlinked_object(obj);
if (parent)
/* root->parent is NULL, and root is already inserted. the caller will cleanup that root. */
hwloc_free_unlinked_object(obj);
error:
return -1;
}
@ -959,32 +984,45 @@ hwloc_xml__handle_distances(struct hwloc_topology *topology,
while ((xmldist = data->first_distances) != NULL) {
hwloc_obj_t root = xmldist->root;
unsigned depth = root->depth + xmldist->distances.relative_depth;
unsigned nbobjs = hwloc_get_nbobjs_inside_cpuset_by_depth(topology, root->cpuset, depth);
unsigned nbobjs = xmldist->distances.nbobjs, j;
unsigned *indexes = malloc(nbobjs * sizeof(unsigned));
hwloc_obj_t child, *objs = malloc(nbobjs * sizeof(hwloc_obj_t));
data->first_distances = xmldist->next;
if (nbobjs != xmldist->distances.nbobjs) {
/* distances invalid, drop */
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid distance matrix with %u objs instead of %u\n",
msgprefix, xmldist->distances.nbobjs, nbobjs);
free(xmldist->distances.latency);
} else {
/* distances valid, add it to the internal OS distances list for grouping */
unsigned *indexes = malloc(nbobjs * sizeof(unsigned));
hwloc_obj_t child, *objs = malloc(nbobjs * sizeof(hwloc_obj_t));
unsigned j;
for(j=0, child = hwloc_get_next_obj_inside_cpuset_by_depth(topology, root->cpuset, depth, NULL);
j<nbobjs;
j++, child = hwloc_get_next_obj_inside_cpuset_by_depth(topology, root->cpuset, depth, child)) {
j = 0;
child = NULL;
/* we can't use hwloc_get_next_obj_inside_cpuset_by_depth() because it ignore CPU-less objects */
while ((child = hwloc_get_next_obj_by_depth(topology, depth, child)) != NULL) {
hwloc_obj_t myparent = child->parent;
while (myparent->depth > root->depth)
myparent = myparent->parent;
if (myparent == root) {
if (j == nbobjs)
goto badnbobjs;
indexes[j] = child->os_index;
objs[j] = child;
j++;
}
for(j=0; j<nbobjs*nbobjs; j++)
xmldist->distances.latency[j] *= xmldist->distances.latency_base;
hwloc_distances_set(topology, objs[0]->type, nbobjs, indexes, objs, xmldist->distances.latency, 0 /* XML cannot force */);
}
if (j < nbobjs)
goto badnbobjs;
/* distances valid, add it to the internal OS distances list for grouping */
for(j=0; j<nbobjs*nbobjs; j++)
xmldist->distances.latency[j] *= xmldist->distances.latency_base;
hwloc_distances_set(topology, objs[0]->type, nbobjs, indexes, objs, xmldist->distances.latency, 0 /* XML cannot force */);
free(xmldist);
continue;
badnbobjs:
printf("bad nbobjs\n");
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid distance matrix, there aren't exactly %u objects below root\n",
msgprefix, nbobjs);
free(indexes);
free(objs);
free(xmldist->distances.latency);
free(xmldist);
}

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

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2016 Inria. All rights reserved.
* Copyright © 2009-2017 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -285,8 +285,13 @@ void hwloc__add_info(struct hwloc_obj_info_s **infosp, unsigned *countp, const c
#define OBJECT_INFO_ALLOC 8
/* nothing allocated initially, (re-)allocate by multiple of 8 */
unsigned alloccount = (count + 1 + (OBJECT_INFO_ALLOC-1)) & ~(OBJECT_INFO_ALLOC-1);
if (count != alloccount)
infos = realloc(infos, alloccount*sizeof(*infos));
if (count != alloccount) {
struct hwloc_obj_info_s *tmpinfos = realloc(infos, alloccount*sizeof(*infos));
if (!tmpinfos)
/* failed to allocate, ignore this info */
return;
infos = tmpinfos;
}
infos[count].name = strdup(name);
infos[count].value = value ? strdup(value) : NULL;
*infosp = infos;
@ -315,8 +320,13 @@ void hwloc__move_infos(struct hwloc_obj_info_s **dst_infosp, unsigned *dst_count
#define OBJECT_INFO_ALLOC 8
/* nothing allocated initially, (re-)allocate by multiple of 8 */
unsigned alloccount = (dst_count + src_count + (OBJECT_INFO_ALLOC-1)) & ~(OBJECT_INFO_ALLOC-1);
if (dst_count != alloccount)
dst_infos = realloc(dst_infos, alloccount*sizeof(*dst_infos));
if (dst_count != alloccount) {
struct hwloc_obj_info_s *tmp_infos = realloc(dst_infos, alloccount*sizeof(*dst_infos));
if (!tmp_infos)
/* Failed to realloc, ignore the appended infos */
goto drop;
dst_infos = tmp_infos;
}
for(i=0; i<src_count; i++, dst_count++) {
dst_infos[dst_count].name = src_infos[i].name;
dst_infos[dst_count].value = src_infos[i].value;
@ -326,6 +336,17 @@ void hwloc__move_infos(struct hwloc_obj_info_s **dst_infosp, unsigned *dst_count
free(src_infos);
*src_infosp = NULL;
*src_countp = 0;
return;
drop:
for(i=0; i<src_count; i++, dst_count++) {
free(src_infos[i].name);
free(src_infos[i].value);
}
free(src_infos);
*src_infosp = NULL;
*src_countp = 0;
/* dst_infos not modified */
}
void hwloc_obj_add_info(hwloc_obj_t obj, const char *name, const char *value)
@ -520,7 +541,7 @@ hwloc_topology_dup(hwloc_topology_t *newp,
unsigned i;
if (!old->is_loaded) {
errno = -EINVAL;
errno = EINVAL;
return -1;
}
@ -889,10 +910,17 @@ merge_insert_equal(hwloc_obj_t new, hwloc_obj_t old)
if (new->distances_count) {
if (old->distances_count) {
old->distances_count += new->distances_count;
old->distances = realloc(old->distances, old->distances_count * sizeof(*old->distances));
memcpy(old->distances + new->distances_count, new->distances, new->distances_count * sizeof(*old->distances));
free(new->distances);
struct hwloc_distances_s **tmpdists;
tmpdists = realloc(old->distances, (old->distances_count+new->distances_count) * sizeof(*old->distances));
if (!tmpdists) {
/* failed to realloc, ignore new distances */
hwloc_clear_object_distances(new);
} else {
old->distances = tmpdists;
old->distances_count += new->distances_count;
memcpy(old->distances + new->distances_count, new->distances, new->distances_count * sizeof(*old->distances));
free(new->distances);
}
} else {
old->distances_count = new->distances_count;
old->distances = new->distances;
@ -1479,7 +1507,7 @@ add_default_object_sets(hwloc_obj_t obj, int parent_has_sets)
}
/* Setup object cpusets/nodesets by OR'ing its children. */
HWLOC_DECLSPEC int
int
hwloc_fill_object_sets(hwloc_obj_t obj)
{
hwloc_obj_t child;
@ -2233,15 +2261,17 @@ hwloc_build_level_from_list(struct hwloc_obj *first, struct hwloc_obj ***levelp)
}
nb = i;
/* allocate and fill level */
*levelp = malloc(nb * sizeof(struct hwloc_obj *));
obj = first;
i = 0;
while (obj) {
obj->logical_index = i;
(*levelp)[i] = obj;
i++;
obj = obj->next_cousin;
if (nb) {
/* allocate and fill level */
*levelp = malloc(nb * sizeof(struct hwloc_obj *));
obj = first;
i = 0;
while (obj) {
obj->logical_index = i;
(*levelp)[i] = obj;
i++;
obj = obj->next_cousin;
}
}
return nb;
@ -2527,6 +2557,13 @@ next_cpubackend:
hwloc_debug("%s", "\nRestrict topology cpusets to existing PU and NODE objects\n");
collect_proc_cpuset(topology->levels[0][0], NULL);
if (topology->binding_hooks.get_allowed_resources && topology->is_thissystem) {
const char *env = getenv("HWLOC_THISSYSTEM_ALLOWED_RESOURCES");
if ((env && atoi(env))
|| (topology->flags & HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES))
topology->binding_hooks.get_allowed_resources(topology);
}
hwloc_debug("%s", "\nPropagate offline and disallowed cpus down and up\n");
propagate_unused_cpuset(topology->levels[0][0], NULL);
@ -2655,12 +2692,6 @@ next_noncpubackend:
}
}
/*
* Now set binding hooks according to topology->is_thissystem
* what the native OS backend offers.
*/
hwloc_set_binding_hooks(topology);
return 0;
}
@ -2693,7 +2724,7 @@ hwloc_topology_setup_defaults(struct hwloc_topology *topology)
topology->first_pcidev = topology->last_pcidev = NULL;
topology->first_osdev = topology->last_osdev = NULL;
/* sane values to type_depth */
for (l = HWLOC_OBJ_SYSTEM; l < HWLOC_OBJ_MISC; l++)
for (l = HWLOC_OBJ_SYSTEM; l <= HWLOC_OBJ_MISC; l++)
topology->type_depth[l] = HWLOC_TYPE_DEPTH_UNKNOWN;
topology->type_depth[HWLOC_OBJ_BRIDGE] = HWLOC_TYPE_DEPTH_BRIDGE;
topology->type_depth[HWLOC_OBJ_PCI_DEVICE] = HWLOC_TYPE_DEPTH_PCI_DEVICE;
@ -2984,6 +3015,11 @@ hwloc_topology_load (struct hwloc_topology *topology)
hwloc_disc_components_enable_others(topology);
/* now that backends are enabled, update the thissystem flag */
hwloc_backends_is_thissystem(topology);
/*
* Now set binding hooks according to topology->is_thissystem
* and what the native OS backend offers.
*/
hwloc_set_binding_hooks(topology);
/* get distance matrix from the environment are store them (as indexes) in the topology.
* indexes will be converted into objects later once the tree will be filled
@ -3016,6 +3052,11 @@ hwloc_topology_restrict(struct hwloc_topology *topology, hwloc_const_cpuset_t cp
{
hwloc_bitmap_t droppedcpuset, droppednodeset;
if (!topology->is_loaded) {
errno = EINVAL;
return -1;
}
/* make sure we'll keep something in the topology */
if (!hwloc_bitmap_intersects(cpuset, topology->levels[0][0]->cpuset)) {
errno = EINVAL; /* easy failure, just don't touch the topology */
@ -3229,11 +3270,13 @@ hwloc_topology_check(struct hwloc_topology *topology)
/* check that PUs and NUMA nodes have cpuset/nodeset */
if (obj->type == HWLOC_OBJ_PU) {
assert(obj->cpuset);
assert(obj->complete_cpuset);
assert(hwloc_bitmap_weight(obj->complete_cpuset) == 1);
assert(hwloc_bitmap_first(obj->complete_cpuset) == (int) obj->os_index);
}
if (obj->type == HWLOC_OBJ_NUMANODE) {
assert(obj->nodeset);
assert(obj->complete_nodeset);
assert(hwloc_bitmap_weight(obj->complete_nodeset) == 1);
assert(hwloc_bitmap_first(obj->complete_nodeset) == (int) obj->os_index);
}

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

@ -327,6 +327,7 @@ hwloc_pci_class_string(unsigned short class_id)
case 0x0205: return "WrdFip";
case 0x0206: return "PICMG";
case 0x0207: return "IB";
case 0x0208: return "FI";
}
return "Net";
case 0x03:

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

@ -4,6 +4,8 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
*
@ -16,8 +18,8 @@
* this header represents the public interface to this static component.
*/
#ifndef MCA_OPAL_HWLOC_HWLOC1113_H
#define MCA_OPAL_HWLOC_HWLOC1113_H
#ifndef MCA_OPAL_HWLOC_HWLOC1116_H
#define MCA_OPAL_HWLOC_HWLOC1116_H
BEGIN_C_DECLS
@ -45,4 +47,4 @@ BEGIN_C_DECLS
END_C_DECLS
#endif /* MCA_OPAL_HWLOC_HWLOC1113_H */
#endif /* MCA_OPAL_HWLOC_HWLOC1116_H */

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

@ -4,6 +4,8 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
*
@ -22,20 +24,20 @@
#include "opal/constants.h"
#include "opal/mca/hwloc/hwloc-internal.h"
#include "hwloc1113.h"
#include "hwloc1116.h"
/*
* Public string showing the sysinfo ompi_linux component version number
*/
const char *opal_hwloc_hwloc1113_component_version_string =
"OPAL hwloc1113 hwloc MCA component version " OPAL_VERSION;
const char *opal_hwloc_hwloc1116_component_version_string =
"OPAL hwloc1116 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_hwloc1113_component = {
const opal_hwloc_component_t mca_hwloc_hwloc1116_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
@ -44,7 +46,7 @@ const opal_hwloc_component_t mca_hwloc_hwloc1113_component = {
OPAL_HWLOC_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "hwloc1113",
.mca_component_name = "hwloc1116",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
},

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