[mpich2-commits] r5530 - in mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc: . config doc include include/hwloc include/private src tests tests/linux utils
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Thu Oct 22 10:32:53 CDT 2009
Author: balaji
Date: 2009-10-22 10:32:53 -0500 (Thu, 22 Oct 2009)
New Revision: 5530
Added:
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/hwloc.dtd
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_shared_cache_covering_obj.c
Removed:
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/ibverbs.h
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/lstopo.dtd
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_cache_covering_obj.c
Modified:
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/README
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/VERSION
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/config/distscript.csh
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/configure.ac
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/Makefile.am
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/doxygen-config.cfg.in
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/hwloc.doxy
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/Makefile.am
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc.h
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/cpuset.h
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/helper.h
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/private/private.h
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/Makefile.am
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/cpuset.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-linux.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-osf.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-synthetic.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-xml.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/traversal.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/Makefile.am
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/ibverbs.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/linux/16em64t-4s2c2t.xml.tar.gz.output
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/lstopo_xml.sh.in
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/Makefile.am
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-distrib.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-mask.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-cairo.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-draw.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-xml.c
mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo.c
Log:
Update hwloc to the 0.9.1rc2 release. This fixes a bunch of issues
with strict compilation.
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/README
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/README 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/README 2009-10-22 15:32:53 UTC (rev 5530)
@@ -34,10 +34,10 @@
hwloc offers a programming interface for manipulating topologies and objects.
It also brings a powerful cpu bitmap API that is used to describe topology
-objects location on physical/logical processors. See the Programming Interface
-interface 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, ...
+objects location on physical/logical processors. See the Programming interface
+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, ...
Installation
@@ -150,7 +150,7 @@
L1(32KB) + Core#2 + P#3
L1(32KB) + Core#3 + P#7
-Programming Interface
+Programming interface
The basic interface is available in hwloc.h . It mostly offers low-level
routines for advanced programmers that want to manually manipulate objects and
@@ -307,5 +307,5 @@
-------------------------------------------------------------------------------
-Generated on Thu Oct 8 16:51:28 2009 for Hardware Locality (hwloc) by doxygen
+Generated on Fri Oct 16 14:19:12 2009 for Hardware Locality (hwloc) by doxygen
1.6.1
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/VERSION
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/VERSION 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/VERSION 2009-10-22 15:32:53 UTC (rev 5530)
@@ -16,7 +16,7 @@
# requirement is that it must be entirely printable ASCII characters
# and have no white space.
-greek=rc1
+greek=rc2
# If want_svn=1, then the SVN r number will be included in the overall
# hwloc version number in some form.
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/config/distscript.csh
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/config/distscript.csh 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/config/distscript.csh 2009-10-22 15:32:53 UTC (rev 5530)
@@ -18,8 +18,13 @@
# $HEADER$
#
+set builddir="`pwd`"
+
set srcdir="$1"
-set builddir="`pwd`"
+cd "$srcdir"
+set srcdir=`pwd`
+cd "$builddir"
+
set distdir="$builddir/$2"
set HWLOC_VERSION="$3"
set HWLOC_SVN_VERSION="$4"
@@ -32,10 +37,20 @@
exit 1
endif
+#========================================================================
+
+if ("$srcdir" != "$builddir") then
+ set vpath=1
+ set vpath_msg=yes
+else
+ set vpath=0
+ set vpath_msg=no
+endif
+
# We can catch some hard (but possible) to do mistakes by looking at
# our tree's revision number, but only if we are in the source tree.
# Otherwise, use what configure told us, at the cost of allowing one
-# or two corner cases in (but otherwise VPATH builds won't work)
+# or two corner cases in (but otherwise VPATH builds won't work).
set svn_r=$HWLOC_SVN_VERSION
if (-d .svn) then
set svn_r="r`svnversion .`"
@@ -46,6 +61,9 @@
Creating hwloc distribution
In directory: `pwd`
+Srcdir: $srcdir
+Builddir: $builddir
+VPATH: $vpath_msg
Version: $HWLOC_VERSION
Started: $start
@@ -74,33 +92,73 @@
touch -r "${srcdir}/VERSION" "${distdir}/VERSION"
echo "*** Updated VERSION file with SVN r number"
else
- echo "*** Did NOT updated VERSION file with SVN r number"
+ echo "*** Did NOT update VERSION file with SVN r number"
endif
#
-# Force the generation of new doxygen documentation
+# VPATH builds only work if the srcdir has valid docs already built.
+# If we're VPATH and the srcdir doesn't have valid docs, then fail.
#
-cd doc
-rm -rf doxygen-doc
-make
-if ($status != 0) then
- echo ERROR: generating doxygen docs failed
- echo ERROR: cannot continue
+if ($vpath == 1 && ! -d $srcdir/doc/doxygen-doc) then
+ echo "*** This is a VPATH 'make dist', but the srcdir does not already"
+ echo "*** have a doxygen-doc tree built. hwloc's config/distscript.csh"
+ echo "*** the docs to be built in the srcdir before executing 'make"
+ echo "*** dist' in a VPATH build."
exit 1
endif
-cp -rpf doxygen-doc ../$distdir/doc
-make readme
-if ($status != 0) then
- echo ERROR: generating new README failed
- echo ERROR: cannot continue
- exit 1
+#
+# If we're not VPATH, force the generation of new doxygen documentation
+#
+
+if ($vpath == 0) then
+ # Not VPATH
+ echo "*** Making new doxygen documentation (doxygen-doc tree)"
+ echo "*** Directory: srcdir: $srcdir, distdir: $distdir, pwd: `pwd`"
+ cd doc
+ # We're still in the src tree, so kill any previous doxygen-docs
+ # tree and make a new one.
+ chmod -R a=rwx doxygen-doc
+ rm -rf doxygen-doc
+ make
+ if ($status != 0) then
+ echo ERROR: generating doxygen docs failed
+ echo ERROR: cannot continue
+ exit 1
+ endif
+
+ # Remove generate latex kruft; no need to ship that.
+ echo "*** Remove generated latex kruft: `pwd`"
+ cd doxygen-doc/latex
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out
+ cd ../..
+
+ # Make new README file
+ echo "*** Making new README"
+ make readme
+ if ($status != 0) then
+ echo ERROR: generating new README failed
+ echo ERROR: cannot continue
+ exit 1
+ endif
+else
+ echo "*** This is a VPATH build; assuming that the doxygen docs and REAME"
+ echo "*** are current in the srcdir (i.e., we'll just copy those)"
endif
-cd ..
-cp -pf README $distdir
+echo "*** Copying doxygen-doc tree to dist..."
+echo "*** Directory: srcdir: $srcdir, distdir: $distdir, pwd: `pwd`"
+chmod -R a=rwx $distdir/doc/doxygen-doc
+echo rm -rf $distdir/doc/doxygen-doc
+rm -rf $distdir/doc/doxygen-doc
+echo cp -rpf $srcdir/doc/doxygen-doc $distdir/doc
+cp -rpf $srcdir/doc/doxygen-doc $distdir/doc
+echo "*** Copying new README"
+ls -lf $distdir/README
+cp -pf $srcdir/README $distdir
+
#########################################################
# VERY IMPORTANT: Now go into the new distribution tree #
#########################################################
@@ -149,6 +207,7 @@
echo " - WARNING: Got bad config.sub from ftp.gnu.org (not executable)"
else
echo " - Got good config.guess and config.sub from ftp.gnu.org"
+ chmod +w ../config.sub ../config.guess
cp config.sub config.guess ..
set happy=1
endif
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/configure.ac
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/configure.ac 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/configure.ac 2009-10-22 15:32:53 UTC (rev 5530)
@@ -19,7 +19,7 @@
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/topology.c])
-AM_INIT_AUTOMAKE([1.10 foreign -Wall -Werror])
+AM_INIT_AUTOMAKE([1.10 dist-bzip2 foreign tar-ustar -Wall -Werror])
# Make configure depend on the VERSION file, since it's used in AC_INIT
@@ -223,6 +223,7 @@
AM_PROG_CC_C_O
AC_PROG_CC_C99
AC_PROG_LN_S
+AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_EGREP
PKG_CHECK_EXISTS
@@ -430,8 +431,6 @@
AC_CHECK_FUNCS([openat], [have_openat=yes])
AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = "xyes"])
-AC_FUNC_ALLOCA
-
AC_CHECK_DECL([numa_bitmask_alloc], [have_linux_libnuma=yes], [],
[#include <numa.h>])
AM_CONDITIONAL([HAVE_LINUX_LIBNUMA], [test "x$have_linux_libnuma" = "xyes"])
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/Makefile.am
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/Makefile.am 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/Makefile.am 2009-10-22 15:32:53 UTC (rev 5530)
@@ -36,6 +36,9 @@
images/hagrid.png \
images/diagram.fig \
www.open-mpi.org.cfg \
+ www.open-mpi.org-css.inc \
+ www.open-mpi.org-footer.inc \
+ www.open-mpi.org-header.inc \
$(image_built_sources) \
$(DOX_HTML_DIR) $(DOX_MAN_DIR) $(DOX_LATEX_DIR) $(DOX_TAG)
@@ -51,8 +54,10 @@
$(top_srcdir)/include/hwloc.h \
$(top_srcdir)/include/hwloc/helper.h \
$(top_srcdir)/include/hwloc/cpuset.h \
+ $(top_srcdir)/include/hwloc/linux.h \
$(top_srcdir)/include/hwloc/linux-libnuma.h \
- $(top_srcdir)/include/hwloc/glibc-sched.h
+ $(top_srcdir)/include/hwloc/glibc-sched.h \
+ $(top_srcdir)/include/hwloc/openfabrics-verbs.h
#
# Create the images that we need for the PDF output and the HTML
@@ -88,7 +93,7 @@
if BUILD_DOXYGEN
$(DOX_TAG): $(BUILT_SOURCES) $(dox_inputs)
- $(RM) -r $(DOX_DIR)
+ rm -fr $(DOX_DIR)
$(DOXYGEN) $(DOX_CONFIG)
-sed -i -e 's/__hwloc_restrict/restrict/g;s/\\_\\-\\_\\-hwloc\\_\\-restrict/restrict/g;s/__inline/inline/g;s/\\_\\-\\_\\-inline/inline/g' $(DOX_DIR)/html/*.html $(DOX_DIR)/latex/*.tex $(DOX_DIR)/man/man3/*.3
endif
@@ -105,7 +110,7 @@
# is necessary.
$(DOX_A4PDF): $(DOX_TAG)
cd $(DOX_LATEX_DIR); \
- $(RM) *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
cp refman.tex a4-refman.tex; \
$(PDFLATEX) a4-refman.tex; \
$(MAKEINDEX) a4-refman.idx; \
@@ -125,7 +130,7 @@
# to make suitable for US letter.
$(DOX_LETTERPDF): $(DOX_TAG)
cd $(DOX_LATEX_DIR); \
- $(RM) *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
sed -e 's/a4paper/letterpaper/g' -e 's/\\usepackage{a4wide}//' refman.tex > letter-refman.tex; \
$(PDFLATEX) letter-refman.tex; \
$(MAKEINDEX) letter-refman.idx; \
@@ -257,13 +262,15 @@
$(DOX_MAN_DIR)/man3/hwloc_get_obj_inside_cpuset_by_depth.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_obj_by_type.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_obj_by_depth.3 \
- $(DOX_MAN_DIR)/man3/hwloc_get_cache_covering_obj.3 \
+ $(DOX_MAN_DIR)/man3/hwloc_get_shared_cache_covering_obj.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_system_obj.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_type_depth.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_nbobjs_by_type.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_nbobjs_by_depth.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_type_or_above_depth.3 \
$(DOX_MAN_DIR)/man3/hwloc_get_type_or_below_depth.3 \
+ $(DOX_MAN_DIR)/man3/hwloc_ibv_get_device_cpuset.3 \
+ $(DOX_MAN_DIR)/man3/hwloc_linux_parse_cpumap_file.3 \
$(DOX_MAN_DIR)/man3/hwloc_obj.3 \
$(DOX_MAN_DIR)/man3/hwloc_obj_attr_u.3 \
$(DOX_MAN_DIR)/man3/hwloc_obj_attr_u_hwloc_cache_attr_s.3 \
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/doxygen-config.cfg.in
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/doxygen-config.cfg.in 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/doxygen-config.cfg.in 2009-10-22 15:32:53 UTC (rev 5530)
@@ -10,7 +10,9 @@
@top_srcdir@/include/hwloc/helper.h \
@top_srcdir@/include/hwloc/cpuset.h \
@top_srcdir@/include/hwloc/glibc-sched.h \
- @top_srcdir@/include/hwloc/linux-libnuma.h
+ @top_srcdir@/include/hwloc/linux.h \
+ @top_srcdir@/include/hwloc/linux-libnuma.h \
+ @top_srcdir@/include/hwloc/openfabrics-verbs.h
EXAMPLE_PATH = @top_srcdir@/doc
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/hwloc.doxy
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/hwloc.doxy 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/doc/hwloc.doxy 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -199,12 +200,14 @@
that it contains. These cpusets may be used for \ref hwlocality_binding.
hwloc offers an extensive cpuset manipulation interface in hwloc/cpuset.h .
-Moreover, hwloc also comes with additional helpers for interoperability
-with several commonly used environments. For Linux, some specific helpers
-are available in hwloc/linux.h , and hwloc/linux-libnuma.h if using libnuma.
-On glibc-based systems, additional helpers are available in hwloc/glibc-sched.h .
-For systems with the Infiniband Verbs library, some dedicated helpers are
-provided in hwloc/ibverbs.h .
+Moreover, hwloc also comes with additional helpers for
+interoperability with several commonly used environments. For Linux,
+some specific helpers are available in hwloc/linux.h , and
+hwloc/linux-libnuma.h if using libnuma. On glibc-based systems,
+additional helpers are available in hwloc/glibc-sched.h . For Linux
+systems with the OpenFabrics verbs library, some dedicated helpers are
+provided in hwloc/openfabrics-verbs.h (this helper file is not yet
+useful on non-Linux systems with the OpenFabrics verbs library).
To precisely define the vocabulary used by hwloc, a \ref glossary is
available and should probably be read first.
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/Makefile.am
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/Makefile.am 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/Makefile.am 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,10 +1,11 @@
# Copyright 2009 INRIA, Université Bordeaux 1
+# Copyright 2009 Cisco Systems, Inc. All rights reserved.
include $(top_srcdir)/hwloc.am
include_HEADERS = hwloc.h
include_hwlocdir = $(includedir)/hwloc
-include_hwloc_HEADERS = hwloc/cpuset.h hwloc/helper.h hwloc/ibverbs.h
+include_hwloc_HEADERS = hwloc/cpuset.h hwloc/helper.h hwloc/openfabrics-verbs.h
nodist_include_hwloc_HEADERS = hwloc/config.h
noinst_HEADERS = private/private.h private/debug.h private/cpuset.h
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/cpuset.h
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/cpuset.h 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/cpuset.h 2009-10-22 15:32:53 UTC (rev 5530)
@@ -26,7 +26,8 @@
/** \brief
* Set of CPUs represented as an opaque pointer to an internal bitmask.
*/
-typedef struct hwloc_opaque_cpuset_s * hwloc_cpuset_t;
+typedef struct hwloc_cpuset_s * hwloc_cpuset_t;
+typedef const struct hwloc_cpuset_s * hwloc_const_cpuset_t;
/*
@@ -57,14 +58,14 @@
* \return the number of character that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
-int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_cpuset_t set);
+int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_cpuset_t set);
/** \brief Stringify a cpuset into a newly allocated string.
*
* \return the number of character that were actually written
* (not including the ending \\0).
*/
-int hwloc_cpuset_asprintf(char ** strp, hwloc_cpuset_t set);
+int hwloc_cpuset_asprintf(char ** strp, hwloc_const_cpuset_t set);
/** \brief Parse a cpuset string.
*
@@ -90,10 +91,10 @@
void hwloc_cpuset_from_ith_ulong(hwloc_cpuset_t set, int i, unsigned long mask);
/** \brief Convert the beginning part of CPU set \p set into unsigned long \p mask */
-unsigned long hwloc_cpuset_to_ulong(hwloc_cpuset_t set);
+unsigned long hwloc_cpuset_to_ulong(hwloc_const_cpuset_t set);
/** \brief Convert the \p i -th subset of CPU set \p set into unsigned long mask */
-unsigned long hwloc_cpuset_to_ith_ulong(hwloc_cpuset_t set, int i);
+unsigned long hwloc_cpuset_to_ith_ulong(hwloc_const_cpuset_t set, int i);
/** \brief Clear CPU set \p set and set CPU \p cpu */
void hwloc_cpuset_cpu(hwloc_cpuset_t set, unsigned cpu);
@@ -111,40 +112,40 @@
void hwloc_cpuset_clr(hwloc_cpuset_t set, unsigned cpu);
/** \brief Test whether CPU \p cpu is part of set \p set */
-int hwloc_cpuset_isset(hwloc_cpuset_t set, unsigned cpu);
+int hwloc_cpuset_isset(hwloc_const_cpuset_t set, unsigned cpu);
/** \brief Test whether set \p set is zero */
-int hwloc_cpuset_iszero(hwloc_cpuset_t set);
+int hwloc_cpuset_iszero(hwloc_const_cpuset_t set);
/** \brief Test whether set \p set is full */
-int hwloc_cpuset_isfull(hwloc_cpuset_t set);
+int hwloc_cpuset_isfull(hwloc_const_cpuset_t set);
/** \brief Test whether set \p set1 is equal to set \p set2 */
-int hwloc_cpuset_isequal (hwloc_cpuset_t set1, hwloc_cpuset_t set2);
+int hwloc_cpuset_isequal (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
/** \brief Test whether sets \p set1 and \p set2 intersects */
-int hwloc_cpuset_intersects (hwloc_cpuset_t set1, hwloc_cpuset_t set2);
+int hwloc_cpuset_intersects (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
/** \brief Test whether set \p sub_set is part of set \p super_set */
-int hwloc_cpuset_isincluded (hwloc_cpuset_t sub_set, hwloc_cpuset_t super_set);
+int hwloc_cpuset_isincluded (hwloc_const_cpuset_t sub_set, hwloc_const_cpuset_t super_set);
/** \brief Or set \p modifier_set into set \p set */
-void hwloc_cpuset_orset (hwloc_cpuset_t set, hwloc_cpuset_t modifier_set);
+void hwloc_cpuset_orset (hwloc_cpuset_t set, hwloc_const_cpuset_t modifier_set);
/** \brief And set \p modifier_set into set \p set */
-void hwloc_cpuset_andset (hwloc_cpuset_t set, hwloc_cpuset_t modifier_set);
+void hwloc_cpuset_andset (hwloc_cpuset_t set, hwloc_const_cpuset_t modifier_set);
/** \brief Clear set \p modifier_set out of set \p set */
-void hwloc_cpuset_clearset (hwloc_cpuset_t set, hwloc_cpuset_t modifier_set);
+void hwloc_cpuset_clearset (hwloc_cpuset_t set, hwloc_const_cpuset_t modifier_set);
/** \brief Xor set \p set with set \p modifier_set */
-void hwloc_cpuset_xorset (hwloc_cpuset_t set, hwloc_cpuset_t modifier_set);
+void hwloc_cpuset_xorset (hwloc_cpuset_t set, hwloc_const_cpuset_t modifier_set);
/** \brief Compute the first CPU (least significant bit) in CPU set \p set */
-int hwloc_cpuset_first(hwloc_cpuset_t set);
+int hwloc_cpuset_first(hwloc_const_cpuset_t set);
/** \brief Compute the last CPU (most significant bit) in CPU set \p set */
-int hwloc_cpuset_last(hwloc_cpuset_t set);
+int hwloc_cpuset_last(hwloc_const_cpuset_t set);
/** \brief Keep a single CPU among those set in CPU set \p set
*
@@ -159,17 +160,17 @@
* Smaller least significant bit is smaller.
* The empty CPU set is considered higher than anything.
*/
-int hwloc_cpuset_compar_first(hwloc_cpuset_t set1, hwloc_cpuset_t set2);
+int hwloc_cpuset_compar_first(hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
/** \brief Compar CPU sets \p set1 and \p set2 using their last bits.
*
* Higher most significant bit is higher.
* The empty CPU set is considered lower than anything.
*/
-int hwloc_cpuset_compar(hwloc_cpuset_t set1, hwloc_cpuset_t set2);
+int hwloc_cpuset_compar(hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
/** \brief Compute the weight of CPU set \p set */
-int hwloc_cpuset_weight(hwloc_cpuset_t set);
+int hwloc_cpuset_weight(hwloc_const_cpuset_t set);
/** \brief Loop macro iterating on CPU set \p set
*
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/helper.h
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/helper.h 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/helper.h 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -200,13 +201,13 @@
*/
static __inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_cpuset_t set,
- unsigned depth, unsigned index)
+ unsigned depth, unsigned idx)
{
int count = 0;
hwloc_obj_t obj = hwloc_get_obj_by_depth (topology, depth, 0);
while (obj) {
if (hwloc_cpuset_isincluded(obj->cpuset, set)) {
- if (count == index)
+ if (count == idx)
return obj;
count++;
}
@@ -215,19 +216,19 @@
return NULL;
}
-/** \brief Return the \p index -th object of type \p type included in CPU set \p set.
+/** \brief Return the \p idx -th object of type \p type included in CPU set \p set.
*
* If there are multiple or no depth for given type, return \c NULL and let the caller
* fallback to hwloc_get_obj_inside_cpuset_by_depth().
*/
static __inline hwloc_obj_t
hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_cpuset_t set,
- hwloc_obj_type_t type, unsigned index)
+ hwloc_obj_type_t type, unsigned idx)
{
int depth = hwloc_get_type_depth(topology, type);
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
return NULL;
- return hwloc_get_obj_inside_cpuset_by_depth(topology, set, depth, index);
+ return hwloc_get_obj_inside_cpuset_by_depth(topology, set, depth, idx);
}
/** \brief Return the number of objects at depth \p depth included in CPU set \p set. */
@@ -274,7 +275,7 @@
*
* \return \c NULL if no child matches.
*/
-static inline hwloc_obj_t
+static __inline hwloc_obj_t
hwloc_get_child_covering_cpuset (hwloc_topology_t topology, hwloc_cpuset_t set,
hwloc_obj_t father)
{
@@ -291,7 +292,7 @@
*
* \return \c NULL if no object matches.
*/
-static inline hwloc_obj_t
+static __inline hwloc_obj_t
hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_cpuset_t set)
{
struct hwloc_obj *current = hwloc_get_system_obj(topology);
@@ -383,7 +384,7 @@
* \return \c NULL if no cache matches
*/
static __inline hwloc_obj_t
-hwloc_get_cache_covering_obj (hwloc_topology_t topology, hwloc_obj_t obj)
+hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology, hwloc_obj_t obj)
{
hwloc_obj_t current = obj->father;
while (current) {
Deleted: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/ibverbs.h
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/ibverbs.h 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc/ibverbs.h 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
- * See COPYING in top-level directory.
- */
-
-/** \file
- * \brief Macros to help interaction between hwloc and infiniband verbs.
- *
- * Applications that use both hwloc and infiniband verbs may want to include
- * this file so as to get topology information for infiniband hardware.
- */
-
-#ifndef HWLOC_IBVERBS_H
-#define HWLOC_IBVERBS_H
-
-#include <hwloc.h>
-#include <hwloc/linux.h>
-
-#include <infiniband/verbs.h>
-
-/** \brief Get the CPU set \p set of logical processors that are physicall close to device \p ibdev.
- *
- * For the given infiniband device \p ibdev, read the corresponding kernel-provided cpumap file
- * and store it inside the given CPU set \p set.
- */
-
-static inline int
-hwloc_ibverbs_get_device_cpuset(struct ibv_device *ibdev, hwloc_cpuset_t *set)
-{
-#define HWLOC_IBVERBS_SYSFS_PATH_MAX 128
- char path[HWLOC_IBVERBS_SYSFS_PATH_MAX];
- FILE *sysfile = NULL;
-
- sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
- ibv_get_device_name(ibdev));
- sysfile = fopen(path, "r");
- if (!sysfile)
- return -1;
-
- hwloc_linux_parse_cpumap_file(sysfile, set);
-
- fclose(sysfile);
- return 0;
-}
-
-#endif /* HWLOC_IBVERBS_H */
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc.h
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc.h 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/hwloc.h 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,13 +1,14 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/** \file
* \brief The hwloc API.
*
- * See hwloc/cpuset.h for CPU set specific macros
- * See hwloc/helper.h for high-level topology traversal helpers
+ * See hwloc/cpuset.h for CPU set specific macros.
+ * See hwloc/helper.h for high-level topology traversal helpers.
*/
#ifndef HWLOC_H
@@ -413,7 +414,7 @@
*/
/** \brief Returns the topology object at index \p index from depth \p depth */
-extern hwloc_obj_t hwloc_get_obj_by_depth (hwloc_topology_t topology, unsigned depth, unsigned index);
+extern hwloc_obj_t hwloc_get_obj_by_depth (hwloc_topology_t topology, unsigned depth, unsigned idx);
/** \brief Returns the topology object at index \p index with type \p type
*
@@ -422,14 +423,14 @@
* and ther caller may fallback to hwloc_get_obj_by_depth().
*/
static __inline hwloc_obj_t
-hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned index)
+hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
{
int depth = hwloc_get_type_depth(topology, type);
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
return NULL;
if (depth == HWLOC_TYPE_DEPTH_MULTIPLE)
return NULL;
- return hwloc_get_obj_by_depth(topology, depth, index);
+ return hwloc_get_obj_by_depth(topology, depth, idx);
}
/** @} */
@@ -448,7 +449,17 @@
/** \brief Stringify a given topology object into a human-readable form.
*
- * \return how many characters were actually written (not including the ending \\0). */
+ * Fill string \p string up to \p size characters with the description
+ * of topology object \p obj in topology \p topology.
+ *
+ * If \p verbose is set, a longer description is used. Otherwise a
+ * short description is used.
+ *
+ * \p indexprefix is used to prefix the \p os_index attribute number of
+ * the object in the description. If \c NULL, the \c # character is used.
+ *
+ * \return how many characters were actually written (not including the ending \\0).
+ */
extern int hwloc_obj_snprintf(char * __hwloc_restrict string, size_t size,
hwloc_topology_t topology, hwloc_obj_t obj,
const char * __hwloc_restrict indexprefix, int verbose);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/private/private.h
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/private/private.h 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/include/private/private.h 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -141,7 +142,7 @@
/** \brief Return a locally-allocated stringified cpuset for printf-like calls. */
-static inline char *
+static __inline char *
hwloc_cpuset_printf_value(hwloc_cpuset_t cpuset)
{
char *buf;
@@ -149,14 +150,14 @@
return buf;
}
-static inline struct hwloc_obj *
-hwloc_alloc_setup_object(hwloc_obj_type_t type, signed index)
+static __inline struct hwloc_obj *
+hwloc_alloc_setup_object(hwloc_obj_type_t type, signed idx)
{
struct hwloc_obj *obj = malloc(sizeof(*obj));
assert(obj);
memset(obj, 0, sizeof(*obj));
obj->type = type;
- obj->os_index = index;
+ obj->os_index = idx;
obj->os_level = -1;
obj->attr = malloc(sizeof(*obj->attr));
/* do not allocate the cpuset here, let the caller do it */
@@ -196,4 +197,8 @@
hwloc_debug("\n");
}
+/* On some systems, snprintf returns the size of written data, not the actually
+ * required size. hwloc_snprintf always report the actually required size. */
+int hwloc_snprintf(char *str, size_t size, const char *format, ...);
+
#endif /* HWLOC_PRIVATE_H */
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/Makefile.am
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/Makefile.am 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/Makefile.am 2009-10-22 15:32:53 UTC (rev 5530)
@@ -77,6 +77,6 @@
EXTRA_DIST += topology-darwin.c
endif !HAVE_DARWIN
-xml_DATA = $(srcdir)/lstopo.dtd
+xml_DATA = $(srcdir)/hwloc.dtd
xmldir = $(pkgdatadir)
-EXTRA_DIST += lstopo.dtd
+EXTRA_DIST += hwloc.dtd
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/cpuset.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/cpuset.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/cpuset.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,12 +1,17 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/cpuset.h>
+#include <private/private.h>
+#include <hwloc/cpuset.h>
+#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
+#include <errno.h>
/* overzealous check in debug-mode, not as powerful as valgrind but still useful */
@@ -16,8 +21,42 @@
#define HWLOC__CPUSET_CHECK(set)
#endif
+int hwloc_snprintf(char *str, size_t size, const char *format, ...)
+{
+ int ret;
+ va_list ap;
+ static char bin;
-struct hwloc_cpuset_s * hwloc_cpuset_alloc(void);
+ /* Some systems crash on str == NULL */
+ if (!size) {
+ str = &bin;
+ size = 1;
+ }
+
+ va_start(ap, format);
+ ret = vsnprintf(str, size, format, ap);
+ va_end(ap);
+
+ if (ret >= 0 && ret != size-1)
+ return ret;
+
+ /* vsnprintf returned size-1 or -1. That could be a system which reports the
+ * written data and not the actually required room. Try increasing buffer
+ * size to get the latter. */
+
+ do {
+ size *= 2;
+ str = malloc(size);
+ va_start(ap, format);
+ errno = 0;
+ ret = vsnprintf(str, size, format, ap);
+ va_end(ap);
+ free(str);
+ } while (ret == size-1 || (ret < 0 && !errno));
+
+ return ret;
+}
+
struct hwloc_cpuset_s * hwloc_cpuset_alloc(void)
{
struct hwloc_cpuset_s * set;
@@ -29,7 +68,6 @@
return set;
}
-void hwloc_cpuset_free(struct hwloc_cpuset_s * set);
void hwloc_cpuset_free(struct hwloc_cpuset_s * set)
{
HWLOC__CPUSET_CHECK(set);
@@ -40,12 +78,12 @@
free(set);
}
-struct hwloc_cpuset_s * hwloc_cpuset_dup(struct hwloc_cpuset_s * old);
struct hwloc_cpuset_s * hwloc_cpuset_dup(struct hwloc_cpuset_s * old)
{
+ struct hwloc_cpuset_s * new;
+
HWLOC__CPUSET_CHECK(old);
- struct hwloc_cpuset_s * new;
new = malloc(sizeof(*new));
if (new) {
#ifdef HWLOC_DEBUG
@@ -56,7 +94,6 @@
return new;
}
-void hwloc_cpuset_copy(struct hwloc_cpuset_s * dst, struct hwloc_cpuset_s * src);
void hwloc_cpuset_copy(struct hwloc_cpuset_s * dst, struct hwloc_cpuset_s * src)
{
HWLOC__CPUSET_CHECK(dst);
@@ -65,16 +102,12 @@
memcpy(dst, src, sizeof(*dst));
}
-int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_cpuset_s * __hwloc_restrict set);
int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_cpuset_s * __hwloc_restrict set)
{
- HWLOC__CPUSET_CHECK(set);
-
ssize_t size = buflen;
char *tmp = buf;
- int res;
+ int res, ret = 0;
int needcomma = 0;
- int missed = 0;
int i;
unsigned long accum = 0;
int accumed = 0;
@@ -84,6 +117,8 @@
const unsigned long accum_mask = ((1UL << HWLOC_CPUSET_SUBSTRING_SIZE) - 1) << (HWLOC_BITS_PER_LONG - HWLOC_CPUSET_SUBSTRING_SIZE);
#endif /* HWLOC_BITS_PER_LONG != HWLOC_CPUSET_SUBSTRING_SIZE */
+ HWLOC__CPUSET_CHECK(set);
+
/* mark the end in case we do nothing later */
if (buflen > 0)
tmp[0] = '\0';
@@ -98,17 +133,20 @@
if (accum & accum_mask) {
/* print the whole subset if not empty */
- res = snprintf(tmp, size, needcomma ? "," HWLOC_PRIxCPUSUBSET : HWLOC_PRIxCPUSUBSET,
+ res = hwloc_snprintf(tmp, size, needcomma ? "," HWLOC_PRIxCPUSUBSET : HWLOC_PRIxCPUSUBSET,
(accum & accum_mask) >> (HWLOC_BITS_PER_LONG - HWLOC_CPUSET_SUBSTRING_SIZE));
needcomma = 1;
} else if (i == -1 && accumed == HWLOC_CPUSET_SUBSTRING_SIZE) {
/* print a single 0 to mark the last subset */
- res = snprintf(tmp, size, needcomma ? ",0" : "0");
+ res = hwloc_snprintf(tmp, size, needcomma ? ",0" : "0");
} else if (needcomma) {
- res = snprintf(tmp, size, ",");
+ res = hwloc_snprintf(tmp, size, ",");
} else {
res = 0;
}
+ if (res < 0)
+ return -1;
+ ret += res;
#if HWLOC_BITS_PER_LONG == HWLOC_CPUSET_SUBSTRING_SIZE
accum = 0;
@@ -118,30 +156,29 @@
accumed -= HWLOC_CPUSET_SUBSTRING_SIZE;
#endif
- if (res >= size) {
- int written = size>0 ? size-1 : 0;
- missed += res - written;
- res = written;
- }
+ if (res >= size)
+ res = size>0 ? size - 1 : 0;
+
tmp += res;
size -= res;
}
- return tmp-buf+missed;
+ return ret;
}
-int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_cpuset_s * __hwloc_restrict set);
int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_cpuset_s * __hwloc_restrict set)
{
+ int len;
+ char *buf;
+
HWLOC__CPUSET_CHECK(set);
- int len = hwloc_cpuset_snprintf(NULL, 0, set);
- char *buf = malloc(len+1);
+ len = hwloc_cpuset_snprintf(NULL, 0, set);
+ buf = malloc(len+1);
*strp = buf;
return hwloc_cpuset_snprintf(buf, len+1, set);
}
-struct hwloc_cpuset_s * hwloc_cpuset_from_string(const char * __hwloc_restrict string);
struct hwloc_cpuset_s * hwloc_cpuset_from_string(const char * __hwloc_restrict string)
{
struct hwloc_cpuset_s * set;
@@ -194,50 +231,49 @@
return set;
}
-void hwloc_cpuset_zero(struct hwloc_cpuset_s * set);
void hwloc_cpuset_zero(struct hwloc_cpuset_s * set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) = HWLOC_CPUSUBSET_ZERO;
}
-void hwloc_cpuset_fill(struct hwloc_cpuset_s * set);
void hwloc_cpuset_fill(struct hwloc_cpuset_s * set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) = HWLOC_CPUSUBSET_FULL;
}
-void hwloc_cpuset_from_ulong(struct hwloc_cpuset_s *set, unsigned long mask);
void hwloc_cpuset_from_ulong(struct hwloc_cpuset_s *set, unsigned long mask)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
HWLOC_CPUSUBSET_SUBSET(*set,0) = mask;
for(i=1; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) = HWLOC_CPUSUBSET_ZERO;
}
-void hwloc_cpuset_from_ith_ulong(struct hwloc_cpuset_s *set, int i, unsigned long mask);
void hwloc_cpuset_from_ith_ulong(struct hwloc_cpuset_s *set, int i, unsigned long mask)
{
+ int j;
+
HWLOC__CPUSET_CHECK(set);
- int j;
HWLOC_CPUSUBSET_SUBSET(*set,i) = mask;
for(j=1; j<HWLOC_CPUSUBSET_COUNT; j++)
if (j != i)
HWLOC_CPUSUBSET_SUBSET(*set,j) = HWLOC_CPUSUBSET_ZERO;
}
-unsigned long hwloc_cpuset_to_ulong(const struct hwloc_cpuset_s *set);
unsigned long hwloc_cpuset_to_ulong(const struct hwloc_cpuset_s *set)
{
HWLOC__CPUSET_CHECK(set);
@@ -245,7 +281,6 @@
return HWLOC_CPUSUBSET_SUBSET(*set,0);
}
-unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_cpuset_s *set, int i);
unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_cpuset_s *set, int i)
{
HWLOC__CPUSET_CHECK(set);
@@ -253,7 +288,6 @@
return HWLOC_CPUSUBSET_SUBSET(*set,i);
}
-void hwloc_cpuset_cpu(struct hwloc_cpuset_s * set, unsigned cpu);
void hwloc_cpuset_cpu(struct hwloc_cpuset_s * set, unsigned cpu)
{
HWLOC__CPUSET_CHECK(set);
@@ -262,7 +296,6 @@
HWLOC_CPUSUBSET_CPUSUBSET(*set,cpu) |= HWLOC_CPUSUBSET_VAL(cpu);
}
-void hwloc_cpuset_all_but_cpu(struct hwloc_cpuset_s * set, unsigned cpu);
void hwloc_cpuset_all_but_cpu(struct hwloc_cpuset_s * set, unsigned cpu)
{
HWLOC__CPUSET_CHECK(set);
@@ -271,7 +304,6 @@
HWLOC_CPUSUBSET_CPUSUBSET(*set,cpu) &= ~HWLOC_CPUSUBSET_VAL(cpu);
}
-void hwloc_cpuset_set(struct hwloc_cpuset_s * set, unsigned cpu);
void hwloc_cpuset_set(struct hwloc_cpuset_s * set, unsigned cpu)
{
HWLOC__CPUSET_CHECK(set);
@@ -279,17 +311,16 @@
HWLOC_CPUSUBSET_CPUSUBSET(*set,cpu) |= HWLOC_CPUSUBSET_VAL(cpu);
}
-void hwloc_cpuset_set_range(struct hwloc_cpuset_s * set, unsigned begincpu, unsigned endcpu);
void hwloc_cpuset_set_range(struct hwloc_cpuset_s * set, unsigned begincpu, unsigned endcpu)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for (i=begincpu; i<=endcpu; i++)
HWLOC_CPUSUBSET_CPUSUBSET(*set,i) |= HWLOC_CPUSUBSET_VAL(i);
}
-void hwloc_cpuset_clr(struct hwloc_cpuset_s * set, unsigned cpu);
void hwloc_cpuset_clr(struct hwloc_cpuset_s * set, unsigned cpu)
{
HWLOC__CPUSET_CHECK(set);
@@ -297,7 +328,6 @@
HWLOC_CPUSUBSET_CPUSUBSET(*set,cpu) &= ~HWLOC_CPUSUBSET_VAL(cpu);
}
-int hwloc_cpuset_isset(const struct hwloc_cpuset_s * set, unsigned cpu);
int hwloc_cpuset_isset(const struct hwloc_cpuset_s * set, unsigned cpu)
{
HWLOC__CPUSET_CHECK(set);
@@ -305,119 +335,119 @@
return (HWLOC_CPUSUBSET_CPUSUBSET(*set,cpu) & HWLOC_CPUSUBSET_VAL(cpu)) != 0;
}
-int hwloc_cpuset_iszero(const struct hwloc_cpuset_s *set);
int hwloc_cpuset_iszero(const struct hwloc_cpuset_s *set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
if (HWLOC_CPUSUBSET_SUBSET(*set,i) != HWLOC_CPUSUBSET_ZERO)
return 0;
return 1;
}
-int hwloc_cpuset_isfull(const struct hwloc_cpuset_s *set);
int hwloc_cpuset_isfull(const struct hwloc_cpuset_s *set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
if (HWLOC_CPUSUBSET_SUBSET(*set,i) != HWLOC_CPUSUBSET_FULL)
return 0;
return 1;
}
-int hwloc_cpuset_isequal (const struct hwloc_cpuset_s *set1, const struct hwloc_cpuset_s *set2);
int hwloc_cpuset_isequal (const struct hwloc_cpuset_s *set1, const struct hwloc_cpuset_s *set2)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set1);
HWLOC__CPUSET_CHECK(set2);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
if (HWLOC_CPUSUBSET_SUBSET(*set1,i) != HWLOC_CPUSUBSET_SUBSET(*set2,i))
return 0;
return 1;
}
-int hwloc_cpuset_intersects (const struct hwloc_cpuset_s *set1, const struct hwloc_cpuset_s *set2);
int hwloc_cpuset_intersects (const struct hwloc_cpuset_s *set1, const struct hwloc_cpuset_s *set2)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set1);
HWLOC__CPUSET_CHECK(set2);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
if ((HWLOC_CPUSUBSET_SUBSET(*set1,i) & HWLOC_CPUSUBSET_SUBSET(*set2,i)) != HWLOC_CPUSUBSET_ZERO)
return 1;
return 0;
}
-int hwloc_cpuset_isincluded (const struct hwloc_cpuset_s *sub_set, const struct hwloc_cpuset_s *super_set);
int hwloc_cpuset_isincluded (const struct hwloc_cpuset_s *sub_set, const struct hwloc_cpuset_s *super_set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(sub_set);
HWLOC__CPUSET_CHECK(super_set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
if (HWLOC_CPUSUBSET_SUBSET(*super_set,i) != (HWLOC_CPUSUBSET_SUBSET(*super_set,i) | HWLOC_CPUSUBSET_SUBSET(*sub_set,i)))
return 0;
return 1;
}
-void hwloc_cpuset_orset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set);
void hwloc_cpuset_orset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
HWLOC__CPUSET_CHECK(modifier_set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) |= HWLOC_CPUSUBSET_SUBSET(*modifier_set,i);
}
-void hwloc_cpuset_andset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set);
void hwloc_cpuset_andset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
HWLOC__CPUSET_CHECK(modifier_set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) &= HWLOC_CPUSUBSET_SUBSET(*modifier_set,i);
}
-void hwloc_cpuset_clearset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set);
void hwloc_cpuset_clearset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
HWLOC__CPUSET_CHECK(modifier_set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) &= ~HWLOC_CPUSUBSET_SUBSET(*modifier_set,i);
}
-void hwloc_cpuset_xorset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set);
void hwloc_cpuset_xorset (struct hwloc_cpuset_s *set, const struct hwloc_cpuset_s *modifier_set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
HWLOC__CPUSET_CHECK(modifier_set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
HWLOC_CPUSUBSET_SUBSET(*set,i) ^= HWLOC_CPUSUBSET_SUBSET(*modifier_set,i);
}
-int hwloc_cpuset_first(const struct hwloc_cpuset_s * set);
int hwloc_cpuset_first(const struct hwloc_cpuset_s * set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++) {
/* subsets are unsigned longs, use ffsl */
int _ffs = hwloc_ffsl(HWLOC_CPUSUBSET_SUBSET(*set,i));
@@ -428,12 +458,12 @@
return -1;
}
-int hwloc_cpuset_last(const struct hwloc_cpuset_s * set);
int hwloc_cpuset_last(const struct hwloc_cpuset_s * set)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int i;
for(i=HWLOC_CPUSUBSET_COUNT-1; i>=0; i--) {
/* subsets are unsigned longs, use flsl */
int _fls = hwloc_flsl(HWLOC_CPUSUBSET_SUBSET(*set,i));
@@ -444,12 +474,12 @@
return -1;
}
-void hwloc_cpuset_singlify(struct hwloc_cpuset_s * set);
void hwloc_cpuset_singlify(struct hwloc_cpuset_s * set)
{
+ int i,found = 0;
+
HWLOC__CPUSET_CHECK(set);
- int i,found = 0;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++) {
if (found) {
HWLOC_CPUSUBSET_SUBSET(*set,i) = HWLOC_CPUSUBSET_ZERO;
@@ -465,13 +495,13 @@
}
}
-int hwloc_cpuset_compar_first(const struct hwloc_cpuset_s * set1, const struct hwloc_cpuset_s * set2);
int hwloc_cpuset_compar_first(const struct hwloc_cpuset_s * set1, const struct hwloc_cpuset_s * set2)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set1);
HWLOC__CPUSET_CHECK(set2);
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++) {
int _ffs1 = hwloc_ffsl(HWLOC_CPUSUBSET_SUBSET(*set1,i));
int _ffs2 = hwloc_ffsl(HWLOC_CPUSUBSET_SUBSET(*set2,i));
@@ -486,13 +516,13 @@
return 0;
}
-int hwloc_cpuset_compar(const struct hwloc_cpuset_s * set1, const struct hwloc_cpuset_s * set2);
int hwloc_cpuset_compar(const struct hwloc_cpuset_s * set1, const struct hwloc_cpuset_s * set2)
{
+ int i;
+
HWLOC__CPUSET_CHECK(set1);
HWLOC__CPUSET_CHECK(set2);
- int i;
for(i=HWLOC_CPUSUBSET_COUNT-1; i>=0; i--) {
if (HWLOC_CPUSUBSET_SUBSET(*set1,i) == HWLOC_CPUSUBSET_SUBSET(*set2,i))
continue;
@@ -501,13 +531,13 @@
return 0;
}
-int hwloc_cpuset_weight(const struct hwloc_cpuset_s * set);
int hwloc_cpuset_weight(const struct hwloc_cpuset_s * set)
{
+ int weight = 0;
+ int i;
+
HWLOC__CPUSET_CHECK(set);
- int weight = 0;
- int i;
for(i=0; i<HWLOC_CPUSUBSET_COUNT; i++)
weight += hwloc_weight_long(HWLOC_CPUSUBSET_SUBSET(*set,i));
return weight;
Copied: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/hwloc.dtd (from rev 5527, mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/lstopo.dtd)
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/hwloc.dtd (rev 0)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/hwloc.dtd 2009-10-22 15:32:53 UTC (rev 5530)
@@ -0,0 +1,12 @@
+<!ELEMENT root (object)+>
+
+<!ELEMENT object (object)*>
+<!ATTLIST object type (System | Machine | Misc | NUMANode | Socket| Cache | Core | Proc) #REQUIRED>
+<!ATTLIST object os_index CDATA "-1" >
+<!ATTLIST object cpuset CDATA "0" >
+<!ATTLIST object dmi_board_vendor CDATA "" >
+<!ATTLIST object dmi_board_name CDATA "" >
+<!ATTLIST object memory_kB CDATA "0" >
+<!ATTLIST object huge_page_size_kB CDATA "0" >
+<!ATTLIST object huge_page_free CDATA "0" >
+<!ATTLIST object depth CDATA "-1" >
Deleted: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/lstopo.dtd
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/lstopo.dtd 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/lstopo.dtd 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,12 +0,0 @@
-<!ELEMENT root (object)+>
-
-<!ELEMENT object (object)*>
-<!ATTLIST object type (System | Machine | Misc | NUMANode | Socket| Cache | Core | Proc) #REQUIRED>
-<!ATTLIST object os_index CDATA "-1" >
-<!ATTLIST object cpuset CDATA "0" >
-<!ATTLIST object dmi_board_vendor CDATA "" >
-<!ATTLIST object dmi_board_name CDATA "" >
-<!ATTLIST object memory_kB CDATA "0" >
-<!ATTLIST object huge_page_size_kB CDATA "0" >
-<!ATTLIST object huge_page_free CDATA "0" >
-<!ATTLIST object depth CDATA "-1" >
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-linux.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-linux.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-linux.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -148,14 +149,6 @@
return hwloc_linux_set_tid_cpubind(topology, 0, hwloc_set, strict);
}
-static int
-hwloc_linux_set_proc_cpubind(hwloc_topology_t topology, pid_t pid, hwloc_cpuset_t hwloc_set, int strict)
-{
- /* XXX: doesn't bind all threads of the processus !! */
- /* Same problem for thisproc */
- return hwloc_linux_set_tid_cpubind(topology, pid, hwloc_set, strict);
-}
-
#if HAVE_DECL_PTHREAD_SETAFFINITY_NP
#pragma weak pthread_setaffinity_np
@@ -531,45 +524,47 @@
if (nbnodes <= 1)
return;
- hwloc_obj_t nodes[nbnodes];
- unsigned distances[nbnodes][nbnodes];
-
- for (osnode=0; osnode < nbnodes; osnode++)
- {
- char nodepath[SYSFS_NUMA_NODE_PATH_LEN];
- hwloc_cpuset_t cpuset;
- unsigned long size = -1;
- unsigned long hpfree = -1;
-
- sprintf(nodepath, "%s/node%u/cpumap", path, osnode);
- cpuset = hwloc_parse_cpumap(nodepath, topology->backend_params.sysfs.root_fd);
- if (!cpuset)
- continue;
-
- /* clear disabled cpus */
- hwloc_cpuset_clearset(cpuset, admin_disabled_cpus_set);
-
- if (hwloc_cpuset_isset(admin_disabled_mems_set, osnode)) {
- size = 0; hpfree = 0;
- } else
- hwloc_sysfs_node_meminfo_info(topology, path, osnode, &size, &hpfree);
-
- node = hwloc_alloc_setup_object(HWLOC_OBJ_NODE, osnode);
- node->cpuset = cpuset;
- node->attr->node.memory_kB = size;
- node->attr->node.huge_page_free = hpfree;
- node->cpuset = cpuset;
-
- hwloc_debug_1arg_cpuset("os node %u has cpuset %s\n",
- osnode, node->cpuset);
- hwloc_add_object(topology, node);
- nodes[osnode] = node;
-
- sprintf(nodepath, "%s/node%u/distance", path, osnode);
- hwloc_parse_node_distance(nodepath, nbnodes, distances[osnode], topology->backend_params.sysfs.root_fd);
- }
-
- hwloc_setup_misc_level_from_distances(topology, nbnodes, nodes, distances);
+ /* For convenience, put these declarations inside a block. Saves us
+ from a bunch of mallocs, particularly with the 2D array. */
+ {
+ hwloc_obj_t nodes[nbnodes];
+ unsigned distances[nbnodes][nbnodes];
+ for (osnode=0; osnode < nbnodes; osnode++) {
+ char nodepath[SYSFS_NUMA_NODE_PATH_LEN];
+ hwloc_cpuset_t cpuset;
+ unsigned long size = -1;
+ unsigned long hpfree = -1;
+
+ sprintf(nodepath, "%s/node%u/cpumap", path, osnode);
+ cpuset = hwloc_parse_cpumap(nodepath, topology->backend_params.sysfs.root_fd);
+ if (!cpuset)
+ continue;
+
+ /* clear disabled cpus */
+ hwloc_cpuset_clearset(cpuset, admin_disabled_cpus_set);
+
+ if (hwloc_cpuset_isset(admin_disabled_mems_set, osnode)) {
+ size = 0; hpfree = 0;
+ } else
+ hwloc_sysfs_node_meminfo_info(topology, path, osnode, &size, &hpfree);
+
+ node = hwloc_alloc_setup_object(HWLOC_OBJ_NODE, osnode);
+ node->cpuset = cpuset;
+ node->attr->node.memory_kB = size;
+ node->attr->node.huge_page_free = hpfree;
+ node->cpuset = cpuset;
+
+ hwloc_debug_1arg_cpuset("os node %u has cpuset %s\n",
+ osnode, node->cpuset);
+ hwloc_add_object(topology, node);
+ nodes[osnode] = node;
+
+ sprintf(nodepath, "%s/node%u/distance", path, osnode);
+ hwloc_parse_node_distance(nodepath, nbnodes, distances[osnode], topology->backend_params.sysfs.root_fd);
+ }
+
+ hwloc_setup_misc_level_from_distances(topology, nbnodes, nodes, distances);
+ }
}
/* Look at Linux' /sys/devices/system/cpu/cpu%d/topology/ */
@@ -579,7 +574,7 @@
{
hwloc_cpuset_t cpuset;
#define CPU_TOPOLOGY_STR_LEN 128
- char string[CPU_TOPOLOGY_STR_LEN];
+ char str[CPU_TOPOLOGY_STR_LEN];
DIR *dir;
int i,j;
FILE *fd;
@@ -607,16 +602,16 @@
}
/* check whether the kernel exports topology information for this cpu */
- sprintf(string, "%s/cpu%lu/topology", path, cpu);
- if (hwloc_access(string, X_OK, topology->backend_params.sysfs.root_fd) < 0 && errno == ENOENT) {
+ sprintf(str, "%s/cpu%lu/topology", path, cpu);
+ if (hwloc_access(str, X_OK, topology->backend_params.sysfs.root_fd) < 0 && errno == ENOENT) {
hwloc_debug("os proc %lu has no accessible %s/cpu%lu/topology\n",
cpu, path, cpu);
continue;
}
/* check whether this processor is offline */
- sprintf(string, "%s/cpu%lu/online", path, cpu);
- fd = hwloc_fopen(string, "r", topology->backend_params.sysfs.root_fd);
+ sprintf(str, "%s/cpu%lu/online", path, cpu);
+ fd = hwloc_fopen(str, "r", topology->backend_params.sysfs.root_fd);
if (fd) {
if (fgets(online, sizeof(online), fd)) {
fclose(fd);
@@ -647,11 +642,11 @@
/* look at the socket */
mysocketid = 0; /* shut-up the compiler */
- sprintf(string, "%s/cpu%d/topology/physical_package_id", path, i);
- hwloc_parse_sysfs_unsigned(string, &mysocketid, topology->backend_params.sysfs.root_fd);
+ sprintf(str, "%s/cpu%d/topology/physical_package_id", path, i);
+ hwloc_parse_sysfs_unsigned(str, &mysocketid, topology->backend_params.sysfs.root_fd);
- sprintf(string, "%s/cpu%d/topology/core_siblings", path, i);
- socketset = hwloc_parse_cpumap(string, topology->backend_params.sysfs.root_fd);
+ sprintf(str, "%s/cpu%d/topology/core_siblings", path, i);
+ socketset = hwloc_parse_cpumap(str, topology->backend_params.sysfs.root_fd);
assert(socketset);
hwloc_cpuset_clearset(socketset, admin_disabled_cpus_set);
assert(hwloc_cpuset_weight(socketset) >= 1);
@@ -668,11 +663,11 @@
/* look at the core */
mycoreid = 0; /* shut-up the compiler */
- sprintf(string, "%s/cpu%d/topology/core_id", path, i);
- hwloc_parse_sysfs_unsigned(string, &mycoreid, topology->backend_params.sysfs.root_fd);
+ sprintf(str, "%s/cpu%d/topology/core_id", path, i);
+ hwloc_parse_sysfs_unsigned(str, &mycoreid, topology->backend_params.sysfs.root_fd);
- sprintf(string, "%s/cpu%d/topology/thread_siblings", path, i);
- coreset = hwloc_parse_cpumap(string, topology->backend_params.sysfs.root_fd);
+ sprintf(str, "%s/cpu%d/topology/thread_siblings", path, i);
+ coreset = hwloc_parse_cpumap(str, topology->backend_params.sysfs.root_fd);
assert(coreset);
hwloc_cpuset_clearset(coreset, admin_disabled_cpus_set);
assert(hwloc_cpuset_weight(coreset) >= 1);
@@ -703,19 +698,18 @@
for(j=0; j<10; j++) {
#define SHARED_CPU_MAP_STRLEN 128
char mappath[SHARED_CPU_MAP_STRLEN];
- char string[20]; /* enough for a level number (one digit) or a type (Data/Instruction/Unified) */
+ char str2[20]; /* enough for a level number (one digit) or a type (Data/Instruction/Unified) */
struct hwloc_obj *cache;
hwloc_cpuset_t cacheset;
unsigned long kB = 0;
int depth; /* 0 for L1, .... */
- FILE * fd;
/* get the cache level depth */
sprintf(mappath, "%s/cpu%d/cache/index%d/level", path, i, j);
fd = hwloc_fopen(mappath, "r", topology->backend_params.sysfs.root_fd);
if (fd) {
- if (fgets(string,sizeof(string), fd))
- depth = strtoul(string, NULL, 10)-1;
+ if (fgets(str2,sizeof(str2), fd))
+ depth = strtoul(str2, NULL, 10)-1;
else
continue;
fclose(fd);
@@ -726,9 +720,9 @@
sprintf(mappath, "%s/cpu%d/cache/index%d/type", path, i, j);
fd = hwloc_fopen(mappath, "r", topology->backend_params.sysfs.root_fd);
if (fd) {
- if (fgets(string, sizeof(string), fd)) {
+ if (fgets(str2, sizeof(str2), fd)) {
fclose(fd);
- if (!strncmp(string, "Instruction", 11))
+ if (!strncmp(str2, "Instruction", 11))
continue;
} else {
fclose(fd);
@@ -741,8 +735,8 @@
sprintf(mappath, "%s/cpu%d/cache/index%d/size", path, i, j);
fd = hwloc_fopen(mappath, "r", topology->backend_params.sysfs.root_fd);
if (fd) {
- if (fgets(string,sizeof(string), fd))
- kB = atol(string); /* in kB */
+ if (fgets(str2,sizeof(str2), fd))
+ kB = atol(str2); /* in kB */
fclose(fd);
}
@@ -783,7 +777,7 @@
hwloc_cpuset_t admin_disabled_cpus_set)
{
FILE *fd;
- char string[strlen(PHYSID)+1+9+1+1];
+ char str[strlen(PHYSID)+1+9+1+1];
char *endptr;
unsigned proc_physids[] = { [0 ... HWLOC_NBMAXCPUS-1] = -1 };
unsigned osphysids[] = { [0 ... HWLOC_NBMAXCPUS-1] = -1 };
@@ -812,12 +806,12 @@
/* Just record information and count number of sockets and cores */
hwloc_debug("\n\n * Topology extraction from /proc/cpuinfo *\n\n");
- while (fgets(string,sizeof(string),fd)!=NULL)
+ while (fgets(str,sizeof(str),fd)!=NULL)
{
# define getprocnb_begin(field, var) \
- if ( !strncmp(field,string,strlen(field))) \
+ if ( !strncmp(field,str,strlen(field))) \
{ \
- char *c = strchr(string, ':')+1; \
+ char *c = strchr(str, ':')+1; \
var = strtoul(c,&endptr,0); \
if (endptr==c) \
{ \
@@ -864,7 +858,7 @@
(numcores)++;
}
getprocnb_end()
- if (string[strlen(string)-1]!='\n')
+ if (str[strlen(str)-1]!='\n')
{
fscanf(fd,"%*[^\n]");
getc(fd);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-osf.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-osf.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-osf.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -32,6 +32,7 @@
cpuset_t cpuset, xor_cpuset;
radid_t radid;
int ret = 0;
+ int ret_errno = 0;
cpusetcreate(&target_cpuset);
cpuemptyset(target_cpuset);
@@ -58,12 +59,13 @@
}
}
/* radset containing exactly this set of CPUs not found */
- errno = EXDEV;
+ ret_errno = EXDEV;
out:
cpusetdestroy(&target_cpuset);
cpusetdestroy(&cpuset);
cpusetdestroy(&xor_cpuset);
+ errno = ret_errno;
return ret;
}
@@ -73,7 +75,7 @@
radset_t radset;
if (hwloc_cpuset_isequal(hwloc_set, hwloc_get_system_obj(topology)->cpuset)) {
- if (pthread_rad_detach(thread))
+ if ((errno = pthread_rad_detach(thread)))
return -1;
return 0;
}
@@ -82,10 +84,10 @@
return -1;
if (strict) {
- if (pthread_rad_bind(thread, radset, RAD_INSIST | RAD_WAIT))
+ if ((errno = pthread_rad_bind(thread, radset, RAD_INSIST | RAD_WAIT)))
return -1;
} else {
- if (pthread_rad_attach(thread, radset, RAD_WAIT))
+ if ((errno = pthread_rad_attach(thread, radset, RAD_WAIT)))
return -1;
}
radsetdestroy(&radset);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-synthetic.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-synthetic.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-synthetic.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -20,6 +21,8 @@
const char *pos, *next_pos;
unsigned long item, count;
int i;
+ int cache_depth = 0, misc_depth = 0;
+ int nb_machine_levels = 0, nb_node_levels = 0;
assert(topology->backend_type == HWLOC_BACKEND_NONE);
@@ -79,9 +82,6 @@
return -1;
}
- int cache_depth = 0, misc_depth = 0;
- int nb_machine_levels = 0, nb_node_levels = 0;
-
for(i=0; i<count; i++) {
hwloc_obj_type_t type;
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-xml.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-xml.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology-xml.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -28,6 +28,8 @@
if (!doc)
return -1;
+ /* TODO: warn if dtd is not hwloc.dtd? */
+
topology->backend_params.xml.doc = doc;
topology->is_thissystem = 0;
topology->backend_type = HWLOC_BACKEND_XML;
@@ -241,7 +243,7 @@
return;
}
} else {
- fprintf(stderr, "ignoring unexpected xml attr type %u\n", node->type);
+ fprintf(stderr, "ignoring unexpected xml attr type %u\n", attr->type);
}
}
@@ -251,7 +253,7 @@
if (attr->children)
hwloc__look_xml_attr(topology, obj, attr->name, attr->children);
} else {
- fprintf(stderr, "ignoring unexpected xml attr type %u\n", node->type);
+ fprintf(stderr, "ignoring unexpected xml attr type %u\n", attr->type);
}
}
@@ -269,7 +271,7 @@
} else {
/* add object */
- if (obj->type == HWLOC_OBJ_TYPE_MAX) {
+ if (obj->type >= HWLOC_OBJ_TYPE_MAX) {
fprintf(stderr, "ignoring object with invalid type %u\n", obj->type);
free(obj);
} else if (obj->type == HWLOC_OBJ_SYSTEM) {
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/topology.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -232,47 +233,51 @@
return;
}
- /* create new misc objects and record their size */
- hwloc_obj_t groupobjs[nbgroups];
- unsigned groupsizes[nbgroups];
- memset(groupsizes, 0, sizeof(groupsizes));
- for(i=0; i<nbgroups; i++) {
- /* create the misc object */
- hwloc_obj_t misc_obj;
- misc_obj = hwloc_alloc_setup_object(HWLOC_OBJ_MISC, -1);
- misc_obj->cpuset = hwloc_cpuset_alloc();
- hwloc_cpuset_zero(misc_obj->cpuset);
- misc_obj->attr->misc.depth = depth;
- for (j=0; j<nbobjs; j++)
- if (groupids[j] == i+1) {
- hwloc_cpuset_orset(misc_obj->cpuset, objs[j]->cpuset);
- groupsizes[i]++;
+ /* For convenience, put these declarations inside a block. Saves us
+ from a bunch of mallocs, particularly with the 2D array. */
+ {
+ hwloc_obj_t groupobjs[nbgroups];
+ unsigned groupsizes[nbgroups];
+ unsigned groupdistances[nbgroups][nbgroups];
+ /* create new misc objects and record their size */
+ memset(groupsizes, 0, sizeof(groupsizes));
+ for(i=0; i<nbgroups; i++) {
+ /* create the misc object */
+ hwloc_obj_t misc_obj;
+ misc_obj = hwloc_alloc_setup_object(HWLOC_OBJ_MISC, -1);
+ misc_obj->cpuset = hwloc_cpuset_alloc();
+ hwloc_cpuset_zero(misc_obj->cpuset);
+ misc_obj->attr->misc.depth = depth;
+ for (j=0; j<nbobjs; j++)
+ if (groupids[j] == i+1) {
+ hwloc_cpuset_orset(misc_obj->cpuset, objs[j]->cpuset);
+ groupsizes[i]++;
+ }
+ hwloc_debug_1arg_cpuset("adding misc object with %u objects and cpuset %s\n",
+ groupsizes[i], misc_obj->cpuset);
+ hwloc_add_object(topology, misc_obj);
+ groupobjs[i] = misc_obj;
}
- hwloc_debug_1arg_cpuset("adding misc object with %u objects and cpuset %s\n",
- groupsizes[i], misc_obj->cpuset);
- hwloc_add_object(topology, misc_obj);
- groupobjs[i] = misc_obj;
- }
-
- /* factorize distances */
- unsigned groupdistances[nbgroups][nbgroups];
- memset(groupdistances, 0, sizeof(groupdistances));
- for(i=0; i<nbobjs; i++)
- for(j=0; j<nbobjs; j++)
- groupdistances[groupids[i]-1][groupids[j]-1] += distances[i][j];
- for(i=0; i<nbgroups; i++)
- for(j=0; j<nbgroups; j++)
- groupdistances[i][j] /= groupsizes[i]*groupsizes[j];
+
+ /* factorize distances */
+ memset(groupdistances, 0, sizeof(groupdistances));
+ for(i=0; i<nbobjs; i++)
+ for(j=0; j<nbobjs; j++)
+ groupdistances[groupids[i]-1][groupids[j]-1] += distances[i][j];
+ for(i=0; i<nbgroups; i++)
+ for(j=0; j<nbgroups; j++)
+ groupdistances[i][j] /= groupsizes[i]*groupsizes[j];
#ifdef HWLOC_DEBUG
- hwloc_debug("group distances:\n");
- for(i=0; i<nbgroups; i++) {
- for(j=0; j<nbgroups; j++)
- hwloc_debug("%u ", groupdistances[i][j]);
- hwloc_debug("\n");
+ hwloc_debug("group distances:\n");
+ for(i=0; i<nbgroups; i++) {
+ for(j=0; j<nbgroups; j++)
+ hwloc_debug("%u ", groupdistances[i][j]);
+ hwloc_debug("\n");
+ }
+#endif
+
+ hwloc__setup_misc_level_from_distances(topology, nbgroups, groupobjs, groupdistances, depth + 1);
}
-#endif
-
- hwloc__setup_misc_level_from_distances(topology, nbgroups, groupobjs, groupdistances, depth + 1);
}
/*
@@ -1303,6 +1308,8 @@
int
hwloc_topology_load (struct hwloc_topology *topology)
{
+ char *local_env;
+
if (topology->is_loaded) {
hwloc_topology_clear(topology);
hwloc_topology_setup_defaults(topology);
@@ -1310,17 +1317,21 @@
}
#ifdef LINUX_SYS
- char *fsroot_path_env = getenv("HWLOC_FSROOT");
- if (fsroot_path_env) {
- hwloc_backend_exit(topology);
- hwloc_backend_sysfs_init(topology, fsroot_path_env);
+ {
+ char *fsroot_path_env = getenv("HWLOC_FSROOT");
+ if (fsroot_path_env) {
+ hwloc_backend_exit(topology);
+ hwloc_backend_sysfs_init(topology, fsroot_path_env);
+ }
}
#endif
#ifdef HAVE_XML
- char *xmlpath_env = getenv("HWLOC_XMLFILE");
- if (xmlpath_env) {
- hwloc_backend_exit(topology);
- hwloc_backend_xml_init(topology, xmlpath_env);
+ {
+ char *xmlpath_env = getenv("HWLOC_XMLFILE");
+ if (xmlpath_env) {
+ hwloc_backend_exit(topology);
+ hwloc_backend_xml_init(topology, xmlpath_env);
+ }
}
#endif
@@ -1334,7 +1345,7 @@
hwloc_discover(topology);
- char *local_env = getenv("HWLOC_THISSYSTEM");
+ local_env = getenv("HWLOC_THISSYSTEM");
if (local_env)
topology->is_thissystem = atoi(local_env);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/traversal.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/traversal.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/src/traversal.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -33,13 +34,13 @@
}
struct hwloc_obj *
-hwloc_get_obj_by_depth (struct hwloc_topology *topology, unsigned depth, unsigned index)
+hwloc_get_obj_by_depth (struct hwloc_topology *topology, unsigned depth, unsigned idx)
{
if (depth >= topology->nb_levels)
return NULL;
- if (index >= topology->level_nbobjects[depth])
+ if (idx >= topology->level_nbobjects[depth])
return NULL;
- return topology->levels[depth][index];
+ return topology->levels[depth][idx];
}
int hwloc_get_closest_objs (struct hwloc_topology *topology, struct hwloc_obj *src, struct hwloc_obj **objs, int max)
@@ -171,9 +172,10 @@
int
hwloc_obj_snprintf(char *string, size_t size,
- struct hwloc_topology *topology, struct hwloc_obj *l, const char *indexprefix, int verbose)
+ struct hwloc_topology *topology, struct hwloc_obj *l, const char *_indexprefix, int verbose)
{
hwloc_obj_type_t type = l->type;
+ const char *indexprefix = _indexprefix ? _indexprefix : "#";
char os_index[12] = "";
if (l->os_index != -1)
@@ -182,43 +184,43 @@
switch (type) {
case HWLOC_OBJ_SOCKET:
case HWLOC_OBJ_CORE:
- return snprintf(string, size, "%s%s", hwloc_obj_type_string(type), os_index);
+ return hwloc_snprintf(string, size, "%s%s", hwloc_obj_type_string(type), os_index);
case HWLOC_OBJ_MISC:
/* TODO: more pretty presentation? */
- return snprintf(string, size, "%s%u%s", hwloc_obj_type_string(type), l->attr->misc.depth, os_index);
+ return hwloc_snprintf(string, size, "%s%u%s", hwloc_obj_type_string(type), l->attr->misc.depth, os_index);
case HWLOC_OBJ_PROC:
- return snprintf(string, size, "P%s", os_index);
+ return hwloc_snprintf(string, size, "P%s", os_index);
case HWLOC_OBJ_SYSTEM:
if (verbose)
- return snprintf(string, size, "%s(%lu%s HP=%lu*%lukB %s %s)", hwloc_obj_type_string(type),
+ return hwloc_snprintf(string, size, "%s(%lu%s HP=%lu*%lukB %s %s)", hwloc_obj_type_string(type),
hwloc_memory_size_printf_value(l->attr->system.memory_kB),
hwloc_memory_size_printf_unit(l->attr->system.memory_kB),
l->attr->system.huge_page_free, l->attr->system.huge_page_size_kB,
l->attr->system.dmi_board_vendor?l->attr->system.dmi_board_vendor:"",
l->attr->system.dmi_board_name?l->attr->system.dmi_board_name:"");
else
- return snprintf(string, size, "%s(%lu%s)", hwloc_obj_type_string(type),
+ return hwloc_snprintf(string, size, "%s(%lu%s)", hwloc_obj_type_string(type),
hwloc_memory_size_printf_value(l->attr->system.memory_kB),
hwloc_memory_size_printf_unit(l->attr->system.memory_kB));
case HWLOC_OBJ_MACHINE:
if (verbose)
- return snprintf(string, size, "%s(%lu%s HP=%lu*%lukB %s %s)", hwloc_obj_type_string(type),
+ return hwloc_snprintf(string, size, "%s(%lu%s HP=%lu*%lukB %s %s)", hwloc_obj_type_string(type),
hwloc_memory_size_printf_value(l->attr->machine.memory_kB),
hwloc_memory_size_printf_unit(l->attr->machine.memory_kB),
l->attr->machine.huge_page_free, l->attr->machine.huge_page_size_kB,
l->attr->machine.dmi_board_vendor?l->attr->machine.dmi_board_vendor:"",
l->attr->machine.dmi_board_name?l->attr->machine.dmi_board_name:"");
else
- return snprintf(string, size, "%s%s(%lu%s)", hwloc_obj_type_string(type), os_index,
+ return hwloc_snprintf(string, size, "%s%s(%lu%s)", hwloc_obj_type_string(type), os_index,
hwloc_memory_size_printf_value(l->attr->machine.memory_kB),
hwloc_memory_size_printf_unit(l->attr->machine.memory_kB));
case HWLOC_OBJ_NODE:
- return snprintf(string, size, "%s%s(%lu%s)",
+ return hwloc_snprintf(string, size, "%s%s(%lu%s)",
verbose ? hwloc_obj_type_string(type) : "Node", os_index,
hwloc_memory_size_printf_value(l->attr->node.memory_kB),
hwloc_memory_size_printf_unit(l->attr->node.memory_kB));
case HWLOC_OBJ_CACHE:
- return snprintf(string, size, "L%u%s%s(%lu%s)", l->attr->cache.depth,
+ return hwloc_snprintf(string, size, "L%u%s%s(%lu%s)", l->attr->cache.depth,
verbose ? hwloc_obj_type_string(type) : "", os_index,
hwloc_memory_size_printf_value(l->attr->node.memory_kB),
hwloc_memory_size_printf_unit(l->attr->node.memory_kB));
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/Makefile.am
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/Makefile.am 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/Makefile.am 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,4 +1,5 @@
# Copyright 2009 INRIA, Université Bordeaux 1
+# Copyright 2009 Cisco Systems, Inc. All rights reserved.
include $(top_srcdir)/hwloc.am
@@ -11,7 +12,7 @@
hwloc_get_largest_objs_inside_cpuset \
hwloc_get_next_obj_covering_cpuset \
hwloc_get_obj_inside_cpuset \
- hwloc_get_cache_covering_obj \
+ hwloc_get_shared_cache_covering_obj \
hwloc_cpuset_first_last_weight \
hwloc_cpuset_singlify \
hwloc_type_depth \
@@ -35,9 +36,9 @@
endif !HAVE_SCHED_SETAFFINITY
if HAVE_LIBIBVERBS
-check_PROGRAMS += ibverbs
+check_PROGRAMS += openfabrics-verbs
else !HAVE_LIBIBVERBS
-EXTRA_DIST += ibverbs.c
+EXTRA_DIST += openfabrics-verbs.c
endif !HAVE_LIBIBVERBS
TESTS = $(check_PROGRAMS)
@@ -49,7 +50,7 @@
LIBS = $(top_builddir)/src/libhwloc.la
linux_libnuma_LDFLAGS = -lnuma
-ibverbs_LDFLAGS = -libverbs
+openfabrics_verbs_LDFLAGS = -libverbs
if HAVE_WINDOWS
else
hwloc_bind_LDFLAGS = -lpthread
Deleted: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_cache_covering_obj.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_cache_covering_obj.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_cache_covering_obj.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,75 +0,0 @@
-/*
- * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
- * See COPYING in top-level directory.
- */
-
-#include <hwloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-/* check hwloc_get_cache_covering_obj() */
-
-#define SYNTHETIC_TOPOLOGY_DESCRIPTION_SHARED "6 5 4 3 2" /* 736bits wide topology */
-#define SYNTHETIC_TOPOLOGY_DESCRIPTION_NONSHARED "6 5 4 1 2" /* 736bits wide topology */
-
-int main()
-{
- hwloc_topology_t topology;
- hwloc_obj_t obj, cache;
-
- hwloc_topology_init(&topology);
- hwloc_topology_set_synthetic(topology, SYNTHETIC_TOPOLOGY_DESCRIPTION_SHARED);
- hwloc_topology_load(topology);
-
- /* check the cache above a given cpu */
-#define CPUINDEX 180
- obj = hwloc_get_obj_by_depth(topology, 5, CPUINDEX);
- assert(obj);
- cache = hwloc_get_cache_covering_obj(topology, obj);
- assert(cache);
- assert(cache->type == HWLOC_OBJ_CACHE);
- assert(cache->logical_index == CPUINDEX/2/3);
- assert(hwloc_obj_is_in_subtree(topology, obj, cache));
-
- /* check no shared cache above the L2 cache */
- obj = hwloc_get_obj_by_depth(topology, 3, 0);
- assert(obj);
- cache = hwloc_get_cache_covering_obj(topology, obj);
- assert(!cache);
-
- /* check no shared cache above the node */
- obj = hwloc_get_obj_by_depth(topology, 1, 0);
- assert(obj);
- cache = hwloc_get_cache_covering_obj(topology, obj);
- assert(!cache);
-
- hwloc_topology_destroy(topology);
-
-
- hwloc_topology_init(&topology);
- hwloc_topology_set_synthetic(topology, SYNTHETIC_TOPOLOGY_DESCRIPTION_NONSHARED);
- hwloc_topology_load(topology);
-
- /* check the cache above a given cpu */
-#define CPUINDEX 180
- obj = hwloc_get_obj_by_depth(topology, 5, CPUINDEX);
- assert(obj);
- cache = hwloc_get_cache_covering_obj(topology, obj);
- assert(cache);
- assert(cache->type == HWLOC_OBJ_CACHE);
- assert(cache->logical_index == CPUINDEX/2/1);
- assert(hwloc_obj_is_in_subtree(topology, obj, cache));
-
- /* check no shared-cache above the core */
- obj = hwloc_get_obj_by_depth(topology, 4, CPUINDEX/2);
- assert(obj);
- cache = hwloc_get_cache_covering_obj(topology, obj);
- assert(!cache);
-
- hwloc_topology_destroy(topology);
-
- return EXIT_SUCCESS;
-}
Copied: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_shared_cache_covering_obj.c (from rev 5527, mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_cache_covering_obj.c)
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_shared_cache_covering_obj.c (rev 0)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/hwloc_get_shared_cache_covering_obj.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * See COPYING in top-level directory.
+ */
+
+#include <hwloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* check hwloc_get_shared_cache_covering_obj() */
+
+#define SYNTHETIC_TOPOLOGY_DESCRIPTION_SHARED "6 5 4 3 2" /* 736bits wide topology */
+#define SYNTHETIC_TOPOLOGY_DESCRIPTION_NONSHARED "6 5 4 1 2" /* 736bits wide topology */
+
+int main()
+{
+ hwloc_topology_t topology;
+ hwloc_obj_t obj, cache;
+
+ hwloc_topology_init(&topology);
+ hwloc_topology_set_synthetic(topology, SYNTHETIC_TOPOLOGY_DESCRIPTION_SHARED);
+ hwloc_topology_load(topology);
+
+ /* check the cache above a given cpu */
+#define CPUINDEX 180
+ obj = hwloc_get_obj_by_depth(topology, 5, CPUINDEX);
+ assert(obj);
+ cache = hwloc_get_shared_cache_covering_obj(topology, obj);
+ assert(cache);
+ assert(cache->type == HWLOC_OBJ_CACHE);
+ assert(cache->logical_index == CPUINDEX/2/3);
+ assert(hwloc_obj_is_in_subtree(topology, obj, cache));
+
+ /* check no shared cache above the L2 cache */
+ obj = hwloc_get_obj_by_depth(topology, 3, 0);
+ assert(obj);
+ cache = hwloc_get_shared_cache_covering_obj(topology, obj);
+ assert(!cache);
+
+ /* check no shared cache above the node */
+ obj = hwloc_get_obj_by_depth(topology, 1, 0);
+ assert(obj);
+ cache = hwloc_get_shared_cache_covering_obj(topology, obj);
+ assert(!cache);
+
+ hwloc_topology_destroy(topology);
+
+
+ hwloc_topology_init(&topology);
+ hwloc_topology_set_synthetic(topology, SYNTHETIC_TOPOLOGY_DESCRIPTION_NONSHARED);
+ hwloc_topology_load(topology);
+
+ /* check the cache above a given cpu */
+#define CPUINDEX 180
+ obj = hwloc_get_obj_by_depth(topology, 5, CPUINDEX);
+ assert(obj);
+ cache = hwloc_get_shared_cache_covering_obj(topology, obj);
+ assert(cache);
+ assert(cache->type == HWLOC_OBJ_CACHE);
+ assert(cache->logical_index == CPUINDEX/2/1);
+ assert(hwloc_obj_is_in_subtree(topology, obj, cache));
+
+ /* check no shared-cache above the core */
+ obj = hwloc_get_obj_by_depth(topology, 4, CPUINDEX/2);
+ assert(obj);
+ cache = hwloc_get_shared_cache_covering_obj(topology, obj);
+ assert(!cache);
+
+ hwloc_topology_destroy(topology);
+
+ return EXIT_SUCCESS;
+}
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/ibverbs.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/ibverbs.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/ibverbs.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -31,7 +31,7 @@
i, ibv_get_device_name(dev));
} else {
char *cpuset_string = NULL;
- hwloc_cpuset_asprintf(&cpuset_string, &set);
+ hwloc_cpuset_asprintf(&cpuset_string, set);
printf("got cpuset %s for device %d (%s)\n",
cpuset_string, i, ibv_get_device_name(dev));
free(cpuset_string);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/linux/16em64t-4s2c2t.xml.tar.gz.output
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/linux/16em64t-4s2c2t.xml.tar.gz.output 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/linux/16em64t-4s2c2t.xml.tar.gz.output 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE root SYSTEM "lstopo.dtd">
+<!DOCTYPE root SYSTEM "hwloc.dtd">
<root>
<object type="System" os_index="0" cpuset="0000ffff" dmi_board_vendor="" dmi_board_name="" memory_kB="0" huge_page_free="0" huge_page_size_kB="0">
<object type="Socket" os_index="0" cpuset="00001111">
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/lstopo_xml.sh.in
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/lstopo_xml.sh.in 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/tests/lstopo_xml.sh.in 2009-10-22 15:32:53 UTC (rev 5530)
@@ -23,7 +23,7 @@
diff @HWLOC_DIFF_U@ "$srcdir"/linux/16em64t-4s2c2t.xml.tar.gz.output "$file"
if [ -n "@XMLLINT@" ]
then
- cp "$srcdir"/../src/lstopo.dtd "$tmp/"
+ cp "$srcdir"/../src/hwloc.dtd "$tmp/"
@XMLLINT@ --valid "$file" > /dev/null
fi
rm -rf "$tmp"
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/Makefile.am
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/Makefile.am 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/Makefile.am 2009-10-22 15:32:53 UTC (rev 5530)
@@ -27,13 +27,14 @@
nodist_man_MANS = $(man_pages)
install-exec-hook: install-man
- $(RM) $(DESTDIR)$(bindir)/hwloc-ls$(EXEEXT) $(DESTDIR)$(bindir)/hwloc-info$(EXEEXT)
+ rm -f $(DESTDIR)$(bindir)/hwloc-ls$(EXEEXT) $(DESTDIR)$(bindir)/hwloc-info$(EXEEXT)
cd $(DESTDIR)$(bindir) && $(LN_S) lstopo$(EXEEXT) hwloc-ls$(EXEEXT) && $(LN_S) lstopo$(EXEEXT) hwloc-info$(EXEEXT)
+ rm -f $(DESTDIR)$(man1dir)/hwloc-ls.1 $(DESTDIR)$(man1dir)/hwloc-info.1
cd $(DESTDIR)$(man1dir) && $(LN_S) lstopo.1 hwloc-ls.1 && $(LN_S) lstopo.1 hwloc-info.1
uninstall-local:
- $(RM) $(DESTDIR)$(bindir)/hwloc-ls$(EXEEXT) $(DESTDIR)$(bindir)/hwloc-info$(EXEEXT)
- $(RM) $(DESTDIR)$(man1dir)/hwloc-ls.1 $(DESTDIR)$(man1dir)/hwloc-info.1
+ rm -f $(DESTDIR)$(bindir)/hwloc-ls$(EXEEXT) $(DESTDIR)$(bindir)/hwloc-info$(EXEEXT)
+ rm -f $(DESTDIR)$(man1dir)/hwloc-ls.1 $(DESTDIR)$(man1dir)/hwloc-info.1
distclean-local:
rm -f $(man_pages)
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-distrib.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-distrib.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-distrib.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -26,7 +26,7 @@
{
long n = -1;
char * synthetic = NULL;
- char * xmlpath = NULL;
+ const char * xmlpath = NULL;
int verbose = 0;
char **orig_argv = argv;
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-mask.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-mask.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/hwloc-mask.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -94,7 +94,7 @@
while ((proc = hwloc_get_next_obj_covering_cpuset_by_type(topology, set, HWLOC_OBJ_PROC, prev)) != NULL) {
if (prev)
printf(",");
- printf("%u", proc->os_index);
+ printf("%d", proc->os_index);
prev = proc;
}
printf("\n");
@@ -103,7 +103,7 @@
while ((node = hwloc_get_next_obj_covering_cpuset_by_type(topology, set, HWLOC_OBJ_NODE, prev)) != NULL) {
if (prev)
printf(",");
- printf("%u", node->os_index);
+ printf("%d", node->os_index);
prev = node;
}
printf("\n");
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-cairo.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-cairo.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-cairo.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -96,7 +96,7 @@
cairo_destroy(c);
}
-static void null(void) {}
+static void null_declare_color (void *output, int r, int g, int b) {}
#endif /* (CAIRO_HAS_XLIB_SURFACE + CAIRO_HAS_PNG_FUNCTIONS + CAIRO_HAS_PDF_SURFACE + CAIRO_HAS_PS_SURFACE + CAIRO_HAS_SVG_SURFACE) */
@@ -164,7 +164,7 @@
static struct draw_methods x11_draw_methods = {
.start = x11_start,
- .declare_color = (void*) null,
+ .declare_color = null_declare_color,
.box = topo_cairo_box,
.line = topo_cairo_line,
.text = topo_cairo_text,
@@ -276,7 +276,7 @@
static struct draw_methods png_draw_methods = {
.start = png_start,
- .declare_color = (void*) null,
+ .declare_color = null_declare_color,
.box = topo_cairo_box,
.line = topo_cairo_line,
.text = topo_cairo_text,
@@ -311,7 +311,7 @@
static struct draw_methods pdf_draw_methods = {
.start = pdf_start,
- .declare_color = (void*) null,
+ .declare_color = null_declare_color,
.box = topo_cairo_box,
.line = topo_cairo_line,
.text = topo_cairo_text,
@@ -346,7 +346,7 @@
static struct draw_methods ps_draw_methods = {
.start = ps_start,
- .declare_color = (void*) null,
+ .declare_color = null_declare_color,
.box = topo_cairo_box,
.line = topo_cairo_line,
.text = topo_cairo_text,
@@ -381,7 +381,7 @@
static struct draw_methods svg_draw_methods = {
.start = svg_start,
- .declare_color = (void*) null,
+ .declare_color = null_declare_color,
.box = topo_cairo_box,
.line = topo_cairo_line,
.text = topo_cairo_text,
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-draw.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-draw.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-draw.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -1,5 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -188,6 +189,10 @@
#define RECURSE_RECT_BEGIN(obj, methods, separator, border) \
RECURSE_BEGIN(obj, border) \
unsigned obj_maxwidth = 0, obj_maxheight = 0; \
+ unsigned area; \
+ float idealtotheight; \
+ unsigned rows, columns; \
+ float under_ratio, over_ratio; \
RECURSE_FOR() \
RECURSE_CALL_FUN(&null_draw_methods); \
if (height > obj_maxheight) \
@@ -196,20 +201,20 @@
obj_maxwidth = width; \
} \
/* Total area for subobjects */ \
- unsigned area = (obj_maxwidth + (separator)) * (obj_maxheight + (separator)) * numsubobjs; \
+ area = (obj_maxwidth + (separator)) * (obj_maxheight + (separator)) * numsubobjs; \
/* Ideal total height for spreading that area with RATIO */ \
- float idealtotheight = sqrt(area/RATIO); \
+ idealtotheight = sqrt(area/RATIO); \
/* Underestimated number of rows */ \
- unsigned rows = idealtotheight / (obj_maxheight + (separator)); \
- unsigned columns = rows ? (numsubobjs + rows - 1) / rows : 1; \
+ rows = idealtotheight / (obj_maxheight + (separator)); \
+ columns = rows ? (numsubobjs + rows - 1) / rows : 1; \
/* Ratio obtained by underestimation */ \
- float under_ratio = (float) (columns * (obj_maxwidth + (separator))) / (rows * (obj_maxheight + (separator))); \
+ under_ratio = (float) (columns * (obj_maxwidth + (separator))) / (rows * (obj_maxheight + (separator))); \
\
/* try to overestimate too */ \
rows++; \
columns = (numsubobjs + rows - 1) / rows; \
/* Ratio obtained by overestimation */ \
- float over_ratio = (float) (columns * (obj_maxwidth + (separator))) / (rows * (obj_maxheight + (separator))); \
+ over_ratio = (float) (columns * (obj_maxwidth + (separator))) / (rows * (obj_maxheight + (separator))); \
/* Did we actually preferred underestimation? (good row/column fit or good ratio) */ \
if (rows > 1 && prefer_ratio(under_ratio, over_ratio)) { \
rows--; \
@@ -257,14 +262,14 @@
#define RECURSE_RECT(obj, methods, separator, border) do {\
if (obj->arity && obj->children[0]->type == HWLOC_OBJ_NODE) { \
/* Nodes shouldn't be put with an arbitrary geometry, as NUMA distances may not be that way */ \
- int vert = prefer_vert(topology, level, output, depth, x, y, separator); \
- if (vert) \
+ int pvert = prefer_vert(topology, level, output, depth, x, y, separator); \
+ if (pvert) \
RECURSE_VERT(level, methods, separator, border); \
else \
RECURSE_HORIZ(level, methods, separator, border); \
} else {\
RECURSE_RECT_BEGIN(obj, methods, separator, border) \
- RECURSE_CALL_FUN(methods); \
+ RECURSE_CALL_FUN(methods); \
RECURSE_RECT_END(obj, methods, separator, border); \
} \
} while (0)
@@ -495,10 +500,11 @@
if (level->arity > 1 && level->children[0]->type == HWLOC_OBJ_MACHINE) {
if (vert) {
unsigned top = 0, bottom = 0;
+ unsigned center;
RECURSE_BEGIN(level, gridsize)
RECURSE_FOR()
RECURSE_CALL_FUN(methods);
- unsigned center = y + totheight + height / 2;
+ center = y + totheight + height / 2;
if (!top)
top = center;
bottom = center;
@@ -509,10 +515,11 @@
methods->line(output, 0, 0, 0, depth, x + mywidth, top, x + mywidth, bottom);
} else {
unsigned left = 0, right = 0;
+ unsigned center;
RECURSE_BEGIN(level, gridsize)
RECURSE_FOR()
RECURSE_CALL_FUN(methods);
- unsigned center = x + totwidth + width / 2;
+ center = x + totwidth + width / 2;
if (!left)
left = center;
right = center;
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-xml.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-xml.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo-xml.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -8,6 +8,7 @@
#ifdef HAVE_XML
#include <hwloc.h>
+#include <string.h>
#include <strings.h>
@@ -100,7 +101,7 @@
xmlDocSetRootElement(doc, root_node);
/* Creates a DTD declaration. Isn't mandatory. */
- dtd = xmlCreateIntSubset(doc, BAD_CAST "root", NULL, BAD_CAST "lstopo.dtd");
+ dtd = xmlCreateIntSubset(doc, BAD_CAST "root", NULL, BAD_CAST "hwloc.dtd");
output_topology (topology, hwloc_get_system_obj(topology), root_node, verbose_mode);
Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo.c 2009-10-22 14:55:56 UTC (rev 5529)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/hwloc/utils/lstopo.c 2009-10-22 15:32:53 UTC (rev 5530)
@@ -94,7 +94,7 @@
int ignorecache = 0;
char * callname;
char * synthetic = NULL;
- char * xmlpath = NULL;
+ const char * xmlpath = NULL;
char * fsysroot = NULL;
int opt;
More information about the mpich2-commits
mailing list