+ Add hwloc_topology_dup() for duplicating an entire topology.
* Tools
+ Add hwloc-diff and hwloc-patch tools together with the new diff API.
+ + Add hwloc-compress-dir to compress an entire directory of XML files
+ using hwloc-diff.
+ Object colors in the graphical output of lstopo may be changed by adding
a "lstopoStyle" info attribute. See CUSTOM COLORS in the lstopo(1) manpage
for details. Thanks to Jirka Hladky for discussing the idea.
hwloc_config_prefix[tests/xml/test-topology.sh]
hwloc_config_prefix[tests/wrapper.sh]
hwloc_config_prefix[utils/hwloc-assembler-remote]
+ hwloc_config_prefix[utils/hwloc-compress-dir]
hwloc_config_prefix[utils/test-hwloc-annotate.sh]
hwloc_config_prefix[utils/test-hwloc-assembler.sh]
hwloc_config_prefix[utils/test-hwloc-calc.sh]
hwloc_config_prefix[utils/test-hwloc-ls.sh]
hwloc_config_prefix[utils/test-fake-plugin.sh])
- AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc-assembler-remote ]hwloc_config_prefix[utils/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-diffpatch.sh ]hwloc_config_prefix[utils/test-hwloc-distances.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/test-hwloc-info.sh ]hwloc_config_prefix[utils/test-hwloc-ls.sh ]hwloc_config_prefix[utils/test-fake-plugin.sh])
+ AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc-assembler-remote ]hwloc_config_prefix[utils/hwloc-compress-dir ]hwloc_config_prefix[utils/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-diffpatch.sh ]hwloc_config_prefix[utils/test-hwloc-distances.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/test-hwloc-info.sh ]hwloc_config_prefix[utils/test-hwloc-ls.sh ]hwloc_config_prefix[utils/test-fake-plugin.sh])
# These links are only needed in standalone mode. It would
# be nice to m4 foreach this somehow, but whenever I tried
hwloc-patch reads such a difference file and applies to
another topology.
+\section cli_hwloc_compressdir hwloc-compress-dir
+
+hwloc-compress-dir compresses an entire directory of XML
+files by using hwloc-diff to save the differences between
+topologies instead of entire topologies.
+
\section cli_hwloc_assembler hwloc-assembler
hwloc-assembler combines several XML topology files into a single
hwloc-calc.h \
hwloc-calc.c
-bin_SCRIPTS = hwloc-assembler-remote
+bin_SCRIPTS = hwloc-assembler-remote hwloc-compress-dir
if !HWLOC_HAVE_MINGW32
TESTS = \
hwloc-assembler-remote.1 \
hwloc-bind.1 \
hwloc-calc.1 \
+ hwloc-compress-dir.1 \
hwloc-diff.1 \
hwloc-distances.1 \
hwloc-distrib.1 \
rm -f $(DESTDIR)$(man1dir)/lstopo-no-graphics.1
cd $(DESTDIR)$(man1dir) && $(LN_S) lstopo.1 lstopo-no-graphics.1
$(SED) -e 's/HWLOC_top_builddir\/utils/bindir/' -e '/HWLOC_top_builddir/d' $(DESTDIR)$(bindir)/hwloc-assembler-remote > $(DESTDIR)$(bindir)/hwloc-assembler-remote.tmp && mv -f $(DESTDIR)$(bindir)/hwloc-assembler-remote.tmp $(DESTDIR)$(bindir)/hwloc-assembler-remote
- chmod +x $(DESTDIR)$(bindir)/hwloc-assembler-remote
+ $(SED) -e 's/HWLOC_top_builddir\/utils/bindir/' -e '/HWLOC_top_builddir/d' $(DESTDIR)$(bindir)/hwloc-compress-dir > $(DESTDIR)$(bindir)/hwloc-compress-dir.tmp && mv -f $(DESTDIR)$(bindir)/hwloc-compress-dir.tmp $(DESTDIR)$(bindir)/hwloc-compress-dir
+ chmod +x $(DESTDIR)$(bindir)/hwloc-assembler-remote $(DESTDIR)$(bindir)/hwloc-compress-dir
uninstall-local:
rm -f $(DESTDIR)$(bindir)/hwloc-ls$(EXEEXT)
--- /dev/null
+.\" -*- nroff -*-
+.\" Copyright © 2013 inria. All rights reserved.
+.\" See COPYING in top-level directory.
+.TH HWLOC-COMPRESS-DIR "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
+.SH NAME
+hwloc-compress-dir \- Compress a directory of XML topologies
+.
+.\" **************************
+.\" Synopsis Section
+.\" **************************
+.SH SYNOPSIS
+.B hwloc-compress-dir
+[\fIoptions\fR]
+<inputdir>
+<outputdir>
+\fR
+.
+.\" **************************
+.\" Options Section
+.\" **************************
+.SH OPTIONS
+.TP
+\fB\-v \-\-verbose\fR
+Display verbose messages.
+.
+.\" **************************
+.\" Description Section
+.\" **************************
+.SH DESCRIPTION
+.
+hwloc-compress-dir takes an input directory containing XML exports
+and tries to compress it by computing topology diffs between them
+(with the hwloc-diff program).
+Each file is copied in the output directory either as a diff if it
+could be compressed, or as its original entire file otherwise.
+.
+.PP
+hwloc-compress-dir may recompress a directory that was previously
+compressed. All input files that are already in the output directory,
+either compressed or not, are ignored. New input files are compressed
+as much as possible as usual.
+.
+.PP
+For each file of the directory, the output filename is
+the same as the original if not compressed,
+otherwise its extension is changed to \fB.diff.xml\fR.
+.
+.PP
+Compressed files are based on another non-compressed topology.
+Its name is stored in the \fBrefname\fR topology diff attribute.
+.
+.PP
+The generated output diff files may be used with hwloc-patch
+just like any file generated by hwloc-diff.
+.
+.\" **************************
+.\" Examples Section
+.\" **************************
+.SH EXAMPLES
+.PP
+To compress the input files from directory in into directory out:
+
+ $ hwloc-compress-dir in out
+.
+.\" **************************
+.\" Return value section
+.\" **************************
+.SH RETURN VALUE
+Upon successful execution, hwloc-compress-dir returns 0.
+.
+.PP
+hwloc-compress-dir will return nonzero if any kind of error occurs,
+such as (but not limited to) failure to parse the command line.
+.
+.\" **************************
+.\" See also section
+.\" **************************
+.SH SEE ALSO
+.
+.ft R
+hwloc(7), lstopo(1), hwloc-diff(1), hwloc-patch(1)
+.sp
--- /dev/null
+#!/bin/sh
+#-*-sh-*-
+
+#
+# Copyright © 2013 Inria. All rights reserved.
+# See COPYING in top-level directory.
+#
+
+HWLOC_top_builddir="@HWLOC_top_builddir@"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+bindir="@bindir@"
+# this will be changed into $bindir/lstopo during make install
+localhwlocdiff="$HWLOC_top_builddir/utils/hwloc-diff"
+
+verbose=0
+
+error()
+{
+ echo $@ 2>&1
+}
+
+usage()
+{
+ echo "$0 [options] <inputdir> <outputdir>"
+ echo " Compress topologies from <inputdir> into <outputdir>"
+ echo "Options:"
+ echo " -v --verbose Display verbose messages"
+}
+
+while test $# -gt 2 ; do
+ case "$1" in
+ -v|--verbose)
+ verbose=1
+ ;;
+ -h)
+ usage
+ exit 0
+ ;;
+ -*)
+ error "Unrecognized option: $1"
+ usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if test $# -lt 2 ; then
+ usage
+ exit 1
+fi
+
+inputdir="$1"
+test x`echo $inputdir | sed -e 's/^\///'` = x$inputdir && inputdir="$PWD/$inputdir"
+outputdir="$2"
+test x`echo $outputdir | sed -e 's/^\///'` = x$outputdir && outputdir="$PWD/$outputdir"
+
+if ! cd "$outputdir" ; then
+ echo "Cannot enter output directory $outputdir"
+ exit 1
+fi
+
+alreadycompressed=0
+alreadynoncompressed=0
+newlycompressed=0
+newlynoncompressed=0
+
+inputs=`ls -1 "$inputdir"`
+for input in $inputs ; do
+ name=`echo $input | sed -e 's/.xml$//'`
+
+ if test "x${name}.xml" != "x$input"; then
+ test x$verbose = x1 && echo "Ignoring non-XML file $input"
+ continue
+ fi
+ if test -f "$outputdir/${name}.xml" ; then
+ test x$verbose = x1 && echo "$name already non-compressed, skipping"
+ alreadynoncompressed=`expr $alreadynoncompressed + 1`
+ continue
+ fi
+ if test -f "$outputdir/${name}.diff.xml" ; then
+ test x$verbose = x1 && echo "$name already compressed, skipping"
+ alreadycompressed=`expr $alreadycompressed + 1`
+ continue
+ fi
+
+ found=
+ outputs=`ls -1 "$outputdir"`
+ for output in $outputs ; do
+ outputname=`echo $output | sed -e 's/.xml$//' | sed -e 's/.diff$//'`
+ test -f "${outputdir}/${outputname}.diff.xml" && continue
+
+ if $localhwlocdiff "$outputdir/${outputname}.xml" "$inputdir/${name}.xml" "$outputdir/${name}.diff.xml" >/dev/null 2>/dev/null; then
+ echo "Compressed $name on top of $outputname"
+ newlycompressed=`expr $newlycompressed + 1`
+ found=1
+ break
+ fi
+ done
+
+ if test x$found = x ; then
+ echo "Could not compress $name, keeping non-compressed"
+ newlynoncompressed=`expr $newlynoncompressed + 1`
+ cp "$inputdir/${name}.xml" "$outputdir/${name}.xml"
+ fi
+done
+
+echo "Compressed $newlycompressed new topologies ($alreadycompressed were already compressed)"
+echo "Kept $newlynoncompressed new topologies non-compressed ($alreadynoncompressed were already non-compressed)"
with hwloc-patch.
.
.PP
+hwloc-compress-dir may be used for computing the diffs between
+all XML files in a directory.
+.
+.PP
.B NOTE:
It is highly recommended that you read the hwloc(7) overview page
before reading this man page. Most of the concepts described in
.SH SEE ALSO
.
.ft R
-hwloc(7), lstopo(1), hwloc-patch(1)
+hwloc(7), lstopo(1), hwloc-patch(1), hwloc-compress-dir(1)
.sp
the standard input.
.
.PP
-The XML difference may have been computed earlier with hwloc-diff.
+The XML difference may have been computed earlier with hwloc-diff
+or hwloc-compress-dir.
.
.PP
.B NOTE:
.SH SEE ALSO
.
.ft R
-hwloc(7), lstopo(1), hwloc-diff(1)
+hwloc(7), lstopo(1), hwloc-diff(1), hwloc-compress-dir(1)
.sp