1
1

Merge pull request #4089 from rhc54/topic/errors

Fix some build errors on master - fix typos in update-my-copyright
Этот коммит содержится в:
Ralph Castain 2017-08-15 14:42:38 -07:00 коммит произвёл GitHub
родитель 99c7482dd8 98f36711e3
Коммит 37ec6d45c5
36 изменённых файлов: 403 добавлений и 302 удалений

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

@ -71,9 +71,9 @@ my $my_manual_list = "";
# Protected directories
my @protected = qw(
opal\\/mca\\/pmi\\/pmix.+?\\/pmix\\/
opal\\/mca\\/pmix\\/pmix.+?\\/pmix\\/
opal\\/mca\\/hwloc\\/hwloc.+?\\/hwloc\\/
opal\\/mca\\/libevent\\/libevent.+?\\/libevent\\/
opal\\/mca\\/event\\/libevent.+?\\/libevent\\/
contrib\\/update-my-copyright.pl
);

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

@ -18,72 +18,6 @@ EXTRA_DIST = \
SUBDIRS = include hwloc
if BUILD_NETLOC
SUBDIRS += netloc
endif
if HWLOC_BUILD_STANDALONE
SUBDIRS += utils tests contrib/systemd contrib/misc
# We need doc/ if HWLOC_BUILD_DOXYGEN, or during make install if HWLOC_INSTALL_DOXYGEN.
# There's no INSTALL_SUBDIRS, so always enter doc/ and check HWLOC_BUILD/INSTALL_DOXYGEN there
SUBDIRS += doc
endif
# Do not let automake automatically add the non-standalone dirs to the
# distribution tarball if we're building in embedded mode.
DIST_SUBDIRS = $(SUBDIRS)
# Only install the pkg file if we're building in standalone mode (and not on Windows)
if HWLOC_BUILD_STANDALONE
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = hwloc.pc
if BUILD_NETLOC
# JMS Need to compare hwloc.pc and netloc.pc -- I think netloc.pc is
# missing some things.
# pkgconfig_DATA += netloc.pc Disabled until the netloc API is public
EXTRA_DIST += netloc.pc
if BUILD_NETLOCSCOTCH
pkgconfig_DATA += netlocscotch.pc
endif BUILD_NETLOCSCOTCH
endif BUILD_NETLOC
endif HWLOC_BUILD_STANDALONE
# Only install the valgrind suppressions file if we're building in
# standalone mode
if HWLOC_BUILD_STANDALONE
dist_pkgdata_DATA = contrib/hwloc-valgrind.supp
endif
# Only install entire visual studio subdirectory if we're building in
# standalone mode
if HWLOC_BUILD_STANDALONE
EXTRA_DIST += contrib/windows
endif
if HWLOC_BUILD_STANDALONE
dist-hook:
sh "$(top_srcdir)/config/distscript.sh" "$(top_srcdir)" "$(distdir)" "$(HWLOC_VERSION)"
endif HWLOC_BUILD_STANDALONE
if HWLOC_BUILD_STANDALONE
if HWLOC_HAVE_WINDOWS
#
# Winball specific rules
#
install-data-local:
sed -e 's/$$/'$$'\015'/ < $(srcdir)/README > $(DESTDIR)$(prefix)/README.txt
sed -e 's/$$/'$$'\015'/ < $(srcdir)/NEWS > $(DESTDIR)$(prefix)/NEWS.txt
sed -e 's/$$/'$$'\015'/ < $(srcdir)/COPYING > $(DESTDIR)$(prefix)/COPYING.txt
uninstall-local:
rm -f $(DESTDIR)$(prefix)/README.txt $(DESTDIR)$(prefix)/NEWS.txt $(DESTDIR)$(prefix)/COPYING.txt
endif HWLOC_HAVE_WINDOWS
endif HWLOC_BUILD_STANDALONE
#
# Build the documenation and top-level README file
#
if HWLOC_BUILD_STANDALONE
.PHONY: doc readme
doc readme:
$(MAKE) -C doc
endif HWLOC_BUILD_STANDALONE

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

@ -3,7 +3,6 @@ Copyright © 2009-2017 Inria. All rights reserved.
Copyright © 2009-2013 Université Bordeaux
Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2017 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
@ -51,6 +50,8 @@ Version 2.0.0
for instance for exporting XMLs that are compatible with hwloc 1.x.
+ The distance API has been completely reworked. It is now described
in hwloc/distances.h.
+ Add hwloc/shmem.h for sharing topologies between processes running on
the same machine (for reducing the memory footprint).
+ Add the experimental netloc subproject. It is enabled by default when
supported and can be disabled with --disable-netloc.
It currently brings command-line tools to gather and visualize the

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

@ -18,17 +18,17 @@ release=0
# requirement is that it must be entirely printable ASCII characters
# and have no white space.
greek=
greek=a1
# The date when this release was created
date="Jul 21, 2017"
date="Unreleased developer copy"
# If snapshot=1, then use the value from snapshot_version as the
# entire hwloc version (i.e., ignore major, minor, release, and
# greek). This is only set to 1 when making snapshot tarballs.
snapshot=0
snapshot_version=${major}.${minor}.${release}${greek}-git
snapshot=1
snapshot_version=shmem-20170815.1857.git2478ce8
# The shared library version of hwloc's public library. This version
# is maintained in accordance with the "Library Interface Versions"

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

@ -12,7 +12,6 @@
# All rights reserved.
# Copyright © 2010-2014 Inria. All rights reserved.
# Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -12,7 +12,6 @@ dnl Copyright © 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright © 2011 Cisco Systems, Inc. All rights reserved.
dnl Copyright © 2015 Inria. All rights reserved.
dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow

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

@ -12,7 +12,6 @@
# All rights reserved.
# Copyright © 2008-2014 Cisco Systems, Inc. All rights reserved.
# Copyright © 2014 Inria. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -356,6 +356,10 @@ EOF
[#include <numa.h>])
])
AC_CHECK_HEADERS([stdlib.h], [
AC_CHECK_FUNCS([mkstemp])
])
AC_CHECK_HEADERS([infiniband/verbs.h], [
AC_CHECK_LIB([ibverbs], [ibv_open_device],
[AC_DEFINE([HAVE_LIBIBVERBS], 1, [Define to 1 if we have -libverbs])

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

@ -51,7 +51,6 @@ AH_TOP([/* -*- c -*-
*
* Copyright © 2009, 2011, 2012 CNRS, inria., Université Bordeaux All rights reserved.
* Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -269,7 +269,7 @@ int hwloc_internal_distances_add_by_index(hwloc_topology_t topology,
/* cannot group without objects,
* and we don't group from XML anyway since the hwloc that generated the XML should have grouped already.
*/
if (flags & HWLOC_DISTANCES_FLAG_GROUP) {
if (flags & HWLOC_DISTANCES_ADD_FLAG_GROUP) {
errno = EINVAL;
goto err;
}
@ -291,12 +291,12 @@ int hwloc_internal_distances_add(hwloc_topology_t topology,
goto err;
}
if (topology->grouping && (flags & HWLOC_DISTANCES_FLAG_GROUP)) {
if (topology->grouping && (flags & HWLOC_DISTANCES_ADD_FLAG_GROUP)) {
float full_accuracy = 0.f;
float *accuracies;
unsigned nbaccuracies;
if (flags & HWLOC_DISTANCES_FLAG_GROUP_INACCURATE) {
if (flags & HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE) {
accuracies = topology->grouping_accuracies;
nbaccuracies = topology->grouping_nbaccuracies;
} else {
@ -335,7 +335,7 @@ int hwloc_internal_distances_add(hwloc_topology_t topology,
#define HWLOC_DISTANCES_KIND_FROM_ALL (HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_FROM_USER)
#define HWLOC_DISTANCES_KIND_MEANS_ALL (HWLOC_DISTANCES_KIND_MEANS_LATENCY|HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH)
#define HWLOC_DISTANCES_KIND_ALL (HWLOC_DISTANCES_KIND_FROM_ALL|HWLOC_DISTANCES_KIND_MEANS_ALL)
#define HWLOC_DISTANCES_FLAG_ALL (HWLOC_DISTANCES_FLAG_GROUP|HWLOC_DISTANCES_FLAG_GROUP_INACCURATE)
#define HWLOC_DISTANCES_ADD_FLAG_ALL (HWLOC_DISTANCES_ADD_FLAG_GROUP|HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE)
/* The actual function exported to the user
*/
@ -356,7 +356,7 @@ int hwloc_distances_add(hwloc_topology_t topology,
if ((kind & ~HWLOC_DISTANCES_KIND_ALL)
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) != 1
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_MEANS_ALL) != 1
|| (flags & ~HWLOC_DISTANCES_FLAG_ALL)) {
|| (flags & ~HWLOC_DISTANCES_ADD_FLAG_ALL)) {
errno = EINVAL;
return -1;
}

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

@ -327,14 +327,14 @@ hwloc_pci_add_object(struct hwloc_obj *parent, struct hwloc_obj **parent_io_firs
}
void
hwloc_pci_tree_insert_by_busid(struct hwloc_obj **treep,
struct hwloc_obj *obj)
hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep,
struct hwloc_obj *obj)
{
hwloc_pci_add_object(NULL /* no parent on top of tree */, treep, obj);
}
int
hwloc_pci_tree_attach_belowroot(struct hwloc_topology *topology, struct hwloc_obj *old_tree)
hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *old_tree)
{
struct hwloc_obj **next_hb_p;
enum hwloc_type_filter_e bfilter;
@ -539,8 +539,8 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
}
struct hwloc_obj *
hwloc_pci_find_busid_parent(struct hwloc_topology *topology,
unsigned domain, unsigned bus, unsigned dev, unsigned func)
hwloc_pcidisc_find_busid_parent(struct hwloc_topology *topology,
unsigned domain, unsigned bus, unsigned dev, unsigned func)
{
struct hwloc_pcidev_attr_s busid;
busid.domain = domain;
@ -652,8 +652,8 @@ hwloc__pci_belowroot_find_by_busid(hwloc_obj_t parent,
}
struct hwloc_obj *
hwloc_pci_belowroot_find_by_busid(struct hwloc_topology *topology,
unsigned domain, unsigned bus, unsigned dev, unsigned func)
hwloc_pcidisc_find_by_busid(struct hwloc_topology *topology,
unsigned domain, unsigned bus, unsigned dev, unsigned func)
{
hwloc_obj_t root = hwloc_get_root_obj(topology);
hwloc_obj_t parent = hwloc__pci_belowroot_find_by_busid(root, domain, bus, dev, func);
@ -670,7 +670,7 @@ hwloc_pci_belowroot_find_by_busid(struct hwloc_topology *topology,
#define HWLOC_PCI_CAP_LIST_NEXT 1
unsigned
hwloc_pci_find_cap(const unsigned char *config, unsigned cap)
hwloc_pcidisc_find_cap(const unsigned char *config, unsigned cap)
{
unsigned char seen[256] = { 0 };
unsigned char ptr; /* unsigned char to make sure we stay within the 256-byte config space */
@ -702,8 +702,8 @@ hwloc_pci_find_cap(const unsigned char *config, unsigned cap)
#define HWLOC_PCI_EXP_LNKSTA_WIDTH 0x03f0
int
hwloc_pci_find_linkspeed(const unsigned char *config,
unsigned offset, float *linkspeed)
hwloc_pcidisc_find_linkspeed(const unsigned char *config,
unsigned offset, float *linkspeed)
{
unsigned linksta, speed, width;
float lanespeed;
@ -733,7 +733,7 @@ hwloc_pci_find_linkspeed(const unsigned char *config,
#define HWLOC_PCI_CLASS_BRIDGE_PCI 0x0604
hwloc_obj_type_t
hwloc_pci_check_bridge_type(unsigned device_class, const unsigned char *config)
hwloc_pcidisc_check_bridge_type(unsigned device_class, const unsigned char *config)
{
unsigned char headertype;
@ -750,8 +750,8 @@ hwloc_pci_check_bridge_type(unsigned device_class, const unsigned char *config)
#define HWLOC_PCI_SUBORDINATE_BUS 0x1a
int
hwloc_pci_setup_bridge_attr(hwloc_obj_t obj,
const unsigned char *config)
hwloc_pcidisc_setup_bridge_attr(hwloc_obj_t obj,
const unsigned char *config)
{
struct hwloc_bridge_attr_s *battr = &obj->attr->bridge;
struct hwloc_pcidev_attr_s *pattr = &battr->upstream.pci;

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

@ -107,19 +107,19 @@ hwloc_shmem_topology_write(hwloc_topology_t topology,
err = write(fd, &header, sizeof(header));
if (err != sizeof(header))
return -2;
return -1;
err = ftruncate(fd, fileoffset + length);
if (err < 0)
return -3;
return -1;
mmap_res = mmap(mmap_address, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, fileoffset);
if (mmap_res == MAP_FAILED)
return -4;
return -1;
if (mmap_res != mmap_address) {
munmap(mmap_res, length);
errno = EBUSY;
return -5;
return -1;
}
tma.malloc = tma_shmem_malloc;

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

@ -109,9 +109,9 @@ hwloc_cuda_discover(struct hwloc_backend *backend)
parent = NULL;
if (hwloc_cudart_get_device_pci_ids(NULL /* topology unused */, i, &domain, &bus, &dev) == 0) {
parent = hwloc_pci_belowroot_find_by_busid(topology, domain, bus, dev, 0);
parent = hwloc_pcidisc_find_by_busid(topology, domain, bus, dev, 0);
if (!parent)
parent = hwloc_pci_find_busid_parent(topology, domain, bus, dev, 0);
parent = hwloc_pcidisc_find_busid_parent(topology, domain, bus, dev, 0);
}
if (!parent)
parent = hwloc_get_root_obj(topology);

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

@ -120,9 +120,9 @@ hwloc_gl_discover(struct hwloc_backend *backend)
if (productname)
hwloc_obj_add_info(osdev, "GPUModel", productname);
parent = hwloc_pci_belowroot_find_by_busid(topology, nv_ctrl_pci_domain, nv_ctrl_pci_bus, nv_ctrl_pci_device, nv_ctrl_pci_func);
parent = hwloc_pcidisc_find_by_busid(topology, nv_ctrl_pci_domain, nv_ctrl_pci_bus, nv_ctrl_pci_device, nv_ctrl_pci_func);
if (!parent)
parent = hwloc_pci_find_busid_parent(topology, nv_ctrl_pci_domain, nv_ctrl_pci_bus, nv_ctrl_pci_device, nv_ctrl_pci_func);
parent = hwloc_pcidisc_find_busid_parent(topology, nv_ctrl_pci_domain, nv_ctrl_pci_bus, nv_ctrl_pci_device, nv_ctrl_pci_func);
if (!parent)
parent = hwloc_get_root_obj(topology);

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

@ -3230,7 +3230,7 @@ look_sysfsnode(struct hwloc_topology *topology,
if (distances)
hwloc_internal_distances_add(topology, nbnodes, nodes, distances,
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
HWLOC_DISTANCES_FLAG_GROUP);
HWLOC_DISTANCES_ADD_FLAG_GROUP);
else
free(nodes);
}
@ -3818,7 +3818,7 @@ hwloc_linux_parse_cpuinfo(struct hwloc_linux_backend_data_s *data,
while (end[-1] == ' ' || end[-1] == '\t') end--; /* need a strrspn() */
*end = 0;
/* find beginning of value, its end is already marked */
value = dot+1 + strspn(dot+1, " ");
value = dot+1 + strspn(dot+1, " \t");
/* defines for parsing numbers */
# define getprocnb_begin(field, var) \
@ -4210,7 +4210,7 @@ hwloc_linux_try_hardwired_cpuinfo(struct hwloc_backend *backend)
if (hwloc_read_path_by_length("/proc/cpuinfo", line, sizeof(line), data->root_fd) < 0)
return -1;
if (strncmp(line, "cpu ", 4))
if (strncmp(line, "cpu\t", 4))
return -1;
if (strstr(line, "Fujitsu SPARC64 VIIIfx"))
@ -4626,11 +4626,11 @@ hwloc_linuxfs_find_osdev_parent(struct hwloc_backend *backend, int root_fd,
if (foundpci) {
/* attach to a PCI parent */
parent = hwloc_pci_belowroot_find_by_busid(topology, pcidomain, pcibus, pcidev, pcifunc);
parent = hwloc_pcidisc_find_by_busid(topology, pcidomain, pcibus, pcidev, pcifunc);
if (parent)
return parent;
/* attach to a normal (non-I/O) parent found by PCI affinity */
parent = hwloc_pci_find_busid_parent(topology, pcidomain, pcibus, pcidev, pcifunc);
parent = hwloc_pcidisc_find_busid_parent(topology, pcidomain, pcibus, pcidev, pcifunc);
if (parent)
return parent;
}
@ -5503,7 +5503,7 @@ hwloc_linuxfs_pci_look_pcidevices(struct hwloc_backend *backend)
&& !hwloc_read_path_by_length(path, value, sizeof(value), root_fd))
class_id = strtoul(value, NULL, 16) >> 8;
type = hwloc_pci_check_bridge_type(class_id, config_space_cache);
type = hwloc_pcidisc_check_bridge_type(class_id, config_space_cache);
/* filtered? */
if (type == HWLOC_OBJ_PCI_DEVICE) {
@ -5563,7 +5563,7 @@ hwloc_linuxfs_pci_look_pcidevices(struct hwloc_backend *backend)
/* bridge specific attributes */
if (type == HWLOC_OBJ_BRIDGE) {
if (hwloc_pci_setup_bridge_attr(obj, config_space_cache) < 0)
if (hwloc_pcidisc_setup_bridge_attr(obj, config_space_cache) < 0)
continue;
}
@ -5571,16 +5571,16 @@ hwloc_linuxfs_pci_look_pcidevices(struct hwloc_backend *backend)
attr->revision = config_space_cache[HWLOC_PCI_REVISION_ID];
/* try to get the link speed */
offset = hwloc_pci_find_cap(config_space_cache, HWLOC_PCI_CAP_ID_EXP);
offset = hwloc_pcidisc_find_cap(config_space_cache, HWLOC_PCI_CAP_ID_EXP);
if (offset > 0 && offset + 20 /* size of PCI express block up to link status */ <= CONFIG_SPACE_CACHESIZE)
hwloc_pci_find_linkspeed(config_space_cache, offset, &attr->linkspeed);
hwloc_pcidisc_find_linkspeed(config_space_cache, offset, &attr->linkspeed);
hwloc_pci_tree_insert_by_busid(&tree, obj);
hwloc_pcidisc_tree_insert_by_busid(&tree, obj);
}
closedir(dir);
hwloc_pci_tree_attach_belowroot(backend->topology, tree);
hwloc_pcidisc_tree_attach(backend->topology, tree);
return 0;
}

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

@ -69,9 +69,9 @@ hwloc_nvml_discover(struct hwloc_backend *backend)
parent = NULL;
if (NVML_SUCCESS == nvmlDeviceGetPciInfo(device, &pci)) {
parent = hwloc_pci_belowroot_find_by_busid(topology, pci.domain, pci.bus, pci.device, 0);
parent = hwloc_pcidisc_find_by_busid(topology, pci.domain, pci.bus, pci.device, 0);
if (!parent)
parent = hwloc_pci_find_busid_parent(topology, pci.domain, pci.bus, pci.device, 0);
parent = hwloc_pcidisc_find_busid_parent(topology, pci.domain, pci.bus, pci.device, 0);
#if HAVE_DECL_NVMLDEVICEGETMAXPCIELINKGENERATION
if (parent && parent->type == HWLOC_OBJ_PCI_DEVICE) {
unsigned maxwidth = 0, maxgen = 0;

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

@ -141,9 +141,9 @@ hwloc_opencl_discover(struct hwloc_backend *backend)
parent = NULL;
#ifdef CL_DEVICE_TOPOLOGY_AMD
parent = hwloc_pci_belowroot_find_by_busid(topology, 0, amdtopo.pcie.bus, amdtopo.pcie.device, amdtopo.pcie.function);
parent = hwloc_pcidisc_find_by_busid(topology, 0, amdtopo.pcie.bus, amdtopo.pcie.device, amdtopo.pcie.function);
if (!parent)
parent = hwloc_pci_find_busid_parent(topology, 0, amdtopo.pcie.bus, amdtopo.pcie.device, amdtopo.pcie.function);
parent = hwloc_pcidisc_find_busid_parent(topology, 0, amdtopo.pcie.bus, amdtopo.pcie.device, amdtopo.pcie.function);
#endif
if (!parent)
parent = hwloc_get_root_obj(topology);

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

@ -140,7 +140,7 @@ hwloc_look_pci(struct hwloc_backend *backend)
device_class = pcidev->device_class >> 8;
/* bridge or pci dev? */
type = hwloc_pci_check_bridge_type(device_class, config_space_cache);
type = hwloc_pcidisc_check_bridge_type(device_class, config_space_cache);
/* filtered? */
if (type == HWLOC_OBJ_PCI_DEVICE) {
@ -222,13 +222,13 @@ hwloc_look_pci(struct hwloc_backend *backend)
obj->attr->pcidev.revision = config_space_cache[PCI_REVISION_ID];
obj->attr->pcidev.linkspeed = 0; /* unknown */
offset = hwloc_pci_find_cap(config_space_cache, PCI_CAP_ID_EXP);
offset = hwloc_pcidisc_find_cap(config_space_cache, PCI_CAP_ID_EXP);
if (offset > 0 && offset + 20 /* size of PCI express block up to link status */ <= CONFIG_SPACE_CACHESIZE)
hwloc_pci_find_linkspeed(config_space_cache, offset, &obj->attr->pcidev.linkspeed);
hwloc_pcidisc_find_linkspeed(config_space_cache, offset, &obj->attr->pcidev.linkspeed);
if (type == HWLOC_OBJ_BRIDGE) {
if (hwloc_pci_setup_bridge_attr(obj, config_space_cache) < 0)
if (hwloc_pcidisc_setup_bridge_attr(obj, config_space_cache) < 0)
continue;
}
@ -260,14 +260,14 @@ hwloc_look_pci(struct hwloc_backend *backend)
vendorname && *vendorname ? vendorname : "??",
devicename && *devicename ? devicename : "??");
hwloc_pci_tree_insert_by_busid(&tree, obj);
hwloc_pcidisc_tree_insert_by_busid(&tree, obj);
}
/* finalize device scanning */
pci_iterator_destroy(iter);
pci_system_cleanup();
hwloc_pci_tree_attach_belowroot(topology, tree);
hwloc_pcidisc_tree_attach(topology, tree);
return 0;
}

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

@ -3,7 +3,6 @@
* Copyright © 2013 Université Bordeaux. All rights reserved.
* Copyright © 2016 Inria. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -425,7 +425,7 @@ hwloc_look_lgrp(struct hwloc_topology *topology)
}
hwloc_internal_distances_add(topology, curlgrp, glob_lgrps, distances,
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
HWLOC_DISTANCES_FLAG_GROUP);
HWLOC_DISTANCES_ADD_FLAG_GROUP);
} else
#endif /* HAVE_DECL_LGRP_LATENCY_COOKIE */
free(glob_lgrps);

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

@ -764,13 +764,19 @@ hwloc__xml_import_object(hwloc_topology_t topology,
if (!strcasecmp(attrvalue, "Cache")) {
obj->type = _HWLOC_OBJ_CACHE_OLD; /* will be fixed below */
attribute_less_cache = 1;
} else
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "unrecognized object type string %s\n", attrvalue);
goto error_with_object;
}
}
} else {
/* type needed first */
if (obj->type == HWLOC_OBJ_TYPE_NONE)
if (obj->type == HWLOC_OBJ_TYPE_NONE) {
if (hwloc__xml_verbose())
fprintf(stderr, "object attribute %s found before type\n", attrname);
goto error_with_object;
}
hwloc__xml_import_object_attr(topology, obj, attrname, attrvalue, state);
}
}
@ -830,23 +836,35 @@ hwloc__xml_import_object(hwloc_topology_t topology,
if (!obj->cpuset != !obj->allowed_cpuset
|| !obj->cpuset != !obj->complete_cpuset) {
/* has some cpuset without others */
if (obj->type == HWLOC_OBJ_GROUP)
if (obj->type == HWLOC_OBJ_GROUP) {
ignored = 1;
else
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "invalid object %s P#%u with some missing cpusets\n",
hwloc_type_name(obj->type), obj->os_index);
goto error_with_object;
}
} else if (!obj->nodeset != !obj->allowed_nodeset
|| !obj->nodeset != !obj->complete_nodeset) {
/* has some nodeset withot others */
if (obj->type == HWLOC_OBJ_GROUP)
if (obj->type == HWLOC_OBJ_GROUP) {
ignored = 1;
else
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "invalid object %s P#%u with some missing nodesets\n",
hwloc_type_name(obj->type), obj->os_index);
goto error_with_object;
}
} else if (obj->nodeset && !obj->cpuset) {
/* has nodesets without cpusets (the contrary is allowed in pre-2.0) */
if (obj->type == HWLOC_OBJ_GROUP)
if (obj->type == HWLOC_OBJ_GROUP) {
ignored = 1;
else
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "invalid object %s P#%u with either cpuset or nodeset missing\n",
hwloc_type_name(obj->type), obj->os_index);
goto error_with_object;
}
}
/* check NUMA nodes */
@ -2220,20 +2238,20 @@ hwloc_export_obj_userdata(void *reserved,
int encoded;
size_t encoded_length;
const char *realname;
if (!strncmp(name, "normal", 6)) {
encoded = 0;
encoded_length = length;
} else if (!strncmp(name, "base64", 6)) {
if (!strncmp(name, "base64", 6)) {
encoded = 1;
encoded_length = BASE64_ENCODED_LENGTH(length);
} else
assert(0);
} else {
assert(!strncmp(name, "normal", 6));
encoded = 0;
encoded_length = length;
}
if (name[6] == ':')
realname = name+7;
else if (!strcmp(name+6, "-anon"))
else {
assert(!strcmp(name+6, "-anon"));
realname = NULL;
else
assert(0);
}
hwloc__export_obj_userdata(state, encoded, realname, length, buffer, encoded_length);
} else

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

@ -199,6 +199,35 @@ hwloc_setup_pu_level(struct hwloc_topology *topology,
}
}
/* Traverse children of a parent */
#define for_each_child(child, parent) for(child = parent->first_child; child; child = child->next_sibling)
#define for_each_io_child(child, parent) for(child = parent->io_first_child; child; child = child->next_sibling)
#define for_each_misc_child(child, parent) for(child = parent->misc_first_child; child; child = child->next_sibling)
/* Traverse children of a parent in a safe way: reread the next pointer as
* appropriate to prevent crash on child deletion: */
#define for_each_child_safe(child, parent, pchild) \
for (pchild = &(parent)->first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
#define for_each_io_child_safe(child, parent, pchild) \
for (pchild = &(parent)->io_first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
#define for_each_misc_child_safe(child, parent, pchild) \
for (pchild = &(parent)->misc_first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
#ifdef HWLOC_DEBUG
/* Just for debugging. */
static void
@ -257,11 +286,11 @@ hwloc_debug_print_objects(int indent __hwloc_attribute_unused, hwloc_obj_t obj)
{
hwloc_obj_t child;
hwloc_debug_print_object(indent, obj);
for (child = obj->first_child; child; child = child->next_sibling)
for_each_child (child, obj)
hwloc_debug_print_objects(indent + 1, child);
for (child = obj->io_first_child; child; child = child->next_sibling)
for_each_io_child (child, obj)
hwloc_debug_print_objects(indent + 1, child);
for (child = obj->misc_first_child; child; child = child->next_sibling)
for_each_misc_child (child, obj)
hwloc_debug_print_objects(indent + 1, child);
}
#else /* !HWLOC_DEBUG */
@ -389,30 +418,6 @@ static int hwloc__tma_dup_infos(struct hwloc_tma *tma, hwloc_obj_t new, hwloc_ob
return -1;
}
/* Traverse children of a parent in a safe way: reread the next pointer as
* appropriate to prevent crash on child deletion: */
#define for_each_child_safe(child, parent, pchild) \
for (pchild = &(parent)->first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
#define for_each_io_child_safe(child, parent, pchild) \
for (pchild = &(parent)->io_first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
#define for_each_misc_child_safe(child, parent, pchild) \
for (pchild = &(parent)->misc_first_child, child = *pchild; \
child; \
/* Check whether the current child was not dropped. */ \
(*pchild == child ? pchild = &(child->next_sibling) : NULL), \
/* Get pointer to next child. */ \
child = *pchild)
static void
hwloc__free_object_contents(hwloc_obj_t obj)
{
@ -654,9 +659,14 @@ hwloc__duplicate_object(struct hwloc_topology *newtopology,
unsigned level_width;
size_t len;
unsigned i;
hwloc_obj_t child;
hwloc_obj_t child, prev;
int err = 0;
/* either we're duplicating to an already allocated new root, which has no newparent,
* or we're duplicating to a non-yet allocated new non-root, which will have a newparent.
*/
assert(!newparent == !!newobj);
if (!newobj) {
newobj = hwloc_alloc_setup_object(newtopology, src->type, src->os_index);
if (!newobj)
@ -737,17 +747,17 @@ hwloc__duplicate_object(struct hwloc_topology *newtopology,
newobj->misc_arity = src->misc_arity;
/* actually insert children now */
for(child = src->first_child; child; child = child->next_sibling) {
for_each_child(child, src) {
err = hwloc__duplicate_object(newtopology, newobj, NULL, child);
if (err < 0)
goto out_with_children;
}
for(child = src->io_first_child; child; child = child->next_sibling) {
for_each_io_child(child, src) {
err = hwloc__duplicate_object(newtopology, newobj, NULL, child);
if (err < 0)
goto out_with_children;
}
for(child = src->misc_first_child; child; child = child->next_sibling) {
for_each_misc_child(child, src) {
err = hwloc__duplicate_object(newtopology, newobj, NULL, child);
if (err < 0)
goto out_with_children;
@ -755,13 +765,35 @@ hwloc__duplicate_object(struct hwloc_topology *newtopology,
out_with_children:
/* link some children if all of them where inserted */
if (!err && newobj->arity) {
newobj->children[0]->prev_sibling = NULL;
for(i=1; i<newobj->arity; i++)
newobj->children[i]->prev_sibling = newobj->children[i-1];
newobj->first_child = newobj->children[0];
newobj->last_child = newobj->children[newobj->arity-1];
/* link children if all of them where inserted */
if (!err) {
/* only next_sibling is set by insert_by_parent().
* sibling_rank was set above.
*/
if (newobj->arity) {
newobj->children[0]->prev_sibling = NULL;
for(i=1; i<newobj->arity; i++)
newobj->children[i]->prev_sibling = newobj->children[i-1];
newobj->last_child = newobj->children[newobj->arity-1];
}
if (newobj->io_arity) {
child = newobj->io_first_child;
prev = NULL;
while (child) {
child->prev_sibling = prev;
prev = child;
child = child->next_sibling;
}
}
if (newobj->misc_arity) {
child = newobj->misc_first_child;
prev = NULL;
while (child) {
child->prev_sibling = prev;
prev = child;
child = child->next_sibling;
}
}
}
/* some children insertion may have failed, but some children may have been inserted below us already.
@ -919,6 +951,7 @@ static const unsigned obj_type_order[] = {
/* next entry is HWLOC_OBJ_OS_DEVICE */ 16
};
#ifndef NDEBUG /* only used in debug check assert if !NDEBUG */
static const hwloc_obj_type_t obj_order_type[] = {
HWLOC_OBJ_SYSTEM,
HWLOC_OBJ_MACHINE,
@ -940,6 +973,7 @@ static const hwloc_obj_type_t obj_order_type[] = {
HWLOC_OBJ_PU,
HWLOC_OBJ_MISC, /* Misc is always a leaf */
};
#endif
/***** Make sure you update obj_type_priority[] below as well. *****/
/* priority to be used when merging identical parent/children object
@ -1551,14 +1585,12 @@ hwloc_get_highest_obj_covering_complete_cpuset (hwloc_topology_t topology, hwloc
recurse:
/* find the right child */
child = current->first_child;
while (child) {
for_each_child(child, current) {
if (hwloc_bitmap_isequal(set, child->complete_cpuset))
/* child puset is exactly what we want, no need to look at children, we want the highest */
return child;
if (!hwloc_bitmap_iszero(child->complete_cpuset) && hwloc_bitmap_isincluded(set, child->complete_cpuset))
break;
child = child->next_sibling;
}
if (child) {
@ -1627,14 +1659,14 @@ static int hwloc_memory_page_type_compare(const void *_a, const void *_b)
static void
propagate_total_memory(hwloc_obj_t obj)
{
hwloc_obj_t *temp, child;
hwloc_obj_t child;
unsigned i;
/* reset total before counting local and children memory */
obj->memory.total_memory = 0;
/* Propagate memory up. */
for_each_child_safe(child, obj, temp) {
for_each_child(child, obj) {
propagate_total_memory(child);
obj->memory.total_memory += child->memory.total_memory;
}
@ -1657,7 +1689,7 @@ propagate_total_memory(hwloc_obj_t obj)
static void
collect_proc_cpuset(hwloc_obj_t obj, hwloc_obj_t sys)
{
hwloc_obj_t child, *temp;
hwloc_obj_t child;
if (sys) {
/* We are already given a pointer to a system object */
@ -1672,7 +1704,7 @@ collect_proc_cpuset(hwloc_obj_t obj, hwloc_obj_t sys)
}
}
for_each_child_safe(child, obj, temp)
for_each_child(child, obj)
collect_proc_cpuset(child, sys);
/* No PU under I/O or Misc */
}
@ -1682,7 +1714,7 @@ collect_proc_cpuset(hwloc_obj_t obj, hwloc_obj_t sys)
static void
propagate_unused_cpuset(hwloc_obj_t obj, hwloc_obj_t sys)
{
hwloc_obj_t child, *temp;
hwloc_obj_t child;
if (obj->cpuset) {
if (sys) {
@ -1733,7 +1765,7 @@ propagate_unused_cpuset(hwloc_obj_t obj, hwloc_obj_t sys)
}
}
for_each_child_safe(child, obj, temp)
for_each_child(child, obj)
propagate_unused_cpuset(child, sys);
/* No PU under I/O or Misc */
}
@ -1762,11 +1794,9 @@ hwloc_obj_add_children_sets(hwloc_obj_t obj)
{
hwloc_obj_t child;
assert(obj->cpuset != NULL);
child = obj->first_child;
while (child) {
for_each_child(child, obj) {
assert(child->cpuset != NULL);
hwloc_obj_add_other_obj_sets(obj, child);
child = child->next_sibling;
}
/* No need to look at Misc children, they contain no PU. */
return 0;
@ -1776,7 +1806,7 @@ hwloc_obj_add_children_sets(hwloc_obj_t obj)
static void
propagate_nodeset(hwloc_obj_t obj, hwloc_obj_t sys)
{
hwloc_obj_t child, *temp;
hwloc_obj_t child;
hwloc_bitmap_t parent_nodeset = NULL;
int parent_weight = 0;
@ -1797,7 +1827,7 @@ propagate_nodeset(hwloc_obj_t obj, hwloc_obj_t sys)
obj->nodeset = hwloc_bitmap_alloc();
}
for_each_child_safe(child, obj, temp) {
for_each_child(child, obj) {
/* Propagate singleton nodesets down */
if (parent_weight == 1) {
if (!child->nodeset)
@ -1824,9 +1854,9 @@ static void
propagate_nodesets(hwloc_obj_t obj)
{
hwloc_bitmap_t mask = hwloc_bitmap_alloc();
hwloc_obj_t child, *temp;
hwloc_obj_t child;
for_each_child_safe(child, obj, temp) {
for_each_child(child, obj) {
if (obj->nodeset) {
/* Update complete nodesets down */
if (child->complete_nodeset) {
@ -1875,7 +1905,7 @@ propagate_nodesets(hwloc_obj_t obj)
static void
remove_unused_sets(hwloc_obj_t obj)
{
hwloc_obj_t child, *temp;
hwloc_obj_t child;
if (obj->cpuset) {
hwloc_bitmap_and(obj->cpuset, obj->cpuset, obj->allowed_cpuset);
@ -1893,7 +1923,7 @@ remove_unused_sets(hwloc_obj_t obj)
obj->memory.page_types[i].count = 0;
}
for_each_child_safe(child, obj, temp)
for_each_child(child, obj)
remove_unused_sets(child);
/* No cpuset under I/O or Misc */
}
@ -2160,7 +2190,7 @@ hwloc_propagate_symmetric_subtree(hwloc_topology_t topology, hwloc_obj_t root)
* return if any child is not symmetric.
*/
ok = 1;
for(child = root->first_child; child; child = child->next_sibling) {
for_each_child(child, root) {
hwloc_propagate_symmetric_subtree(topology, child);
if (!child->symmetric_subtree)
ok = 0;
@ -2302,7 +2332,7 @@ find_same_type(hwloc_obj_t root, hwloc_obj_t obj)
if (hwloc_type_cmp(root, obj) == HWLOC_OBJ_EQUAL)
return 1;
for (child = root->first_child; child; child = child->next_sibling)
for_each_child (child, root)
if (find_same_type(child, obj))
return 1;
@ -2392,7 +2422,7 @@ hwloc_append_special_object(struct hwloc_special_level_s *level, hwloc_obj_t obj
static void
hwloc_list_io_misc_objects(hwloc_topology_t topology, hwloc_obj_t obj)
{
hwloc_obj_t child, *temp;
hwloc_obj_t child;
if (obj->type == HWLOC_OBJ_MISC) {
obj->next_cousin = NULL;
@ -2400,7 +2430,7 @@ hwloc_list_io_misc_objects(hwloc_topology_t topology, hwloc_obj_t obj)
/* Insert the main Misc list */
hwloc_append_special_object(&topology->slevels[HWLOC_SLEVEL_MISC], obj);
/* Recurse, Misc only have Misc children */
for_each_misc_child_safe(child, obj, temp)
for_each_misc_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
} else if (hwloc_obj_type_is_io(obj->type)) {
@ -2422,18 +2452,18 @@ hwloc_list_io_misc_objects(hwloc_topology_t topology, hwloc_obj_t obj)
hwloc_append_special_object(&topology->slevels[HWLOC_SLEVEL_OSDEV], obj);
}
/* Recurse, I/O only have I/O and Misc children */
for_each_io_child_safe(child, obj, temp)
for_each_io_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
for_each_misc_child_safe(child, obj, temp)
for_each_misc_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
} else {
/* Recurse */
for_each_child_safe(child, obj, temp)
for_each_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
for_each_io_child_safe(child, obj, temp)
for_each_io_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
for_each_misc_child_safe(child, obj, temp)
for_each_misc_child(child, obj)
hwloc_list_io_misc_objects(topology, child);
}
}
@ -3442,6 +3472,34 @@ void * hwloc_topology_get_userdata(struct hwloc_topology * topology)
* Debug Checks *
****************/
#ifndef NDEBUG /* assert only enabled if !NDEBUG */
static void
hwloc__check_child_siblings(hwloc_obj_t parent, hwloc_obj_t *array,
unsigned arity, unsigned i,
hwloc_obj_t child, hwloc_obj_t prev)
{
assert(child->parent == parent);
assert(child->sibling_rank == i);
if (array)
assert(child == array[i]);
if (prev)
assert(prev->next_sibling == child);
assert(child->prev_sibling == prev);
if (!i)
assert(child->prev_sibling == NULL);
else
assert(child->prev_sibling != NULL);
if (i == arity-1)
assert(child->next_sibling == NULL);
else
assert(child->next_sibling != NULL);
}
static void
hwloc__check_object(hwloc_topology_t topology, hwloc_obj_t obj);
@ -3449,6 +3507,7 @@ hwloc__check_object(hwloc_topology_t topology, hwloc_obj_t obj);
static void
hwloc__check_children(hwloc_topology_t topology, hwloc_obj_t parent)
{
hwloc_obj_t child, prev;
unsigned j;
if (!parent->arity) {
@ -3464,22 +3523,18 @@ hwloc__check_children(hwloc_topology_t topology, hwloc_obj_t parent)
assert(parent->last_child);
/* sibling checks */
for(j=0; j<parent->arity; j++) {
hwloc_obj_t child = parent->children[j];
assert(child->parent == parent);
assert(child->sibling_rank == j);
if (j)
assert(child->prev_sibling == parent->children[j-1]);
else
assert(!child->prev_sibling);
if (j == parent->arity-1)
assert(!child->next_sibling);
else
assert(child->next_sibling == parent->children[j+1]);
for(prev = NULL, child = parent->first_child, j = 0;
child;
prev = child, child = child->next_sibling, j++) {
assert(child->depth > parent->depth);
/* check siblings */
hwloc__check_child_siblings(parent, parent->children, parent->arity, j, child, prev);
/* recurse */
hwloc__check_object(topology, child);
}
/* check arity */
assert(j == parent->arity);
assert(parent->first_child == parent->children[0]);
assert(parent->last_child == parent->children[parent->arity-1]);
@ -3565,16 +3620,8 @@ hwloc__check_io_children(hwloc_topology_t topology, hwloc_obj_t parent)
prev = child, child = child->next_sibling, j++) {
/* all children must be I/O */
assert(hwloc_obj_type_is_io(child->type));
/* check siblings */
assert(child->parent == parent);
assert(child->sibling_rank == j);
if (prev)
assert(prev->next_sibling == child);
assert(child->prev_sibling == prev);
if (j == parent->io_arity-1)
assert(child->next_sibling == NULL);
hwloc__check_child_siblings(parent, NULL, parent->io_arity, j, child, prev);
/* only I/O and Misc children, recurse */
assert(!child->first_child);
hwloc__check_object(topology, child);
@ -3602,16 +3649,8 @@ hwloc__check_misc_children(hwloc_topology_t topology, hwloc_obj_t parent)
prev = child, child = child->next_sibling, j++) {
/* all children must be Misc */
assert(child->type == HWLOC_OBJ_MISC);
/* check siblings */
assert(child->parent == parent);
assert(child->sibling_rank == j);
if (prev)
assert(prev->next_sibling == child);
assert(child->prev_sibling == prev);
if (j == parent->misc_arity-1)
assert(child->next_sibling == NULL);
hwloc__check_child_siblings(parent, NULL, parent->misc_arity, j, child, prev);
/* only Misc children, recurse */
assert(!child->first_child);
assert(!child->io_first_child);
@ -3666,6 +3705,16 @@ hwloc__check_object(hwloc_topology_t topology, hwloc_obj_t obj)
}
/* check cache type/depth vs type */
if (hwloc_obj_type_is_cache(obj->type)) {
if (hwloc_obj_type_is_icache(obj->type))
assert(obj->attr->cache.type == HWLOC_OBJ_CACHE_INSTRUCTION);
else if (hwloc_obj_type_is_dcache(obj->type))
assert(obj->attr->cache.type == HWLOC_OBJ_CACHE_DATA
|| obj->attr->cache.type == HWLOC_OBJ_CACHE_UNIFIED);
else
assert(0);
assert(hwloc_cache_type_by_depth_type(obj->attr->cache.depth, obj->attr->cache.type) == obj->type);
}
/* check children */
hwloc__check_children(topology, obj);
@ -3817,3 +3866,12 @@ hwloc_topology_check(struct hwloc_topology *topology)
* Should only occur if XML is invalid.
*/
}
#else /* NDEBUG */
void
hwloc_topology_check(struct hwloc_topology *topology __hwloc_attribute_unused)
{
}
#endif /* NDEBUG */

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

@ -80,7 +80,14 @@ extern "C" {
* @{
*/
/** \brief Indicate at build time which hwloc API version is being used. */
/** \brief Indicate at build time which hwloc API version is being used.
*
* This number is updated to (X>>16)+(Y>>8)+Z when a new release X.Y.Z
* actually modifies the API.
*
* Users may check for available features at build time using this number
* (see \ref faq_upgrade).
*/
#define HWLOC_API_VERSION 0x00020000
/** \brief Indicate at runtime which hwloc API version was used at build time.

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

@ -40,7 +40,11 @@ extern "C" {
*/
struct hwloc_distances_s {
unsigned nbobjs; /**< \brief Number of objects described by the distance matrix. */
hwloc_obj_t *objs; /**< \brief Array of objects described by the distance matrix. */
hwloc_obj_t *objs; /**< \brief Array of objects described by the distance matrix.
* These objects are not in any particular order,
* see hwloc_distances_obj_index() and hwloc_distances_obj_pair_values()
* for easy ways to find objects in this array and their corresponding values.
*/
unsigned long kind; /**< \brief OR'ed set of ::hwloc_distances_kind_e. */
hwloc_uint64_t *values; /**< \brief Matrix of distances between objects, stored as a one-dimension array.
*
@ -147,22 +151,65 @@ hwloc_distances_release(hwloc_topology_t topology, struct hwloc_distances_s *dis
/** \defgroup hwlocality_distances_consult Helpers for consulting distances structures
* @{
*/
/** \brief Find the index of an object in a distances structure.
*
* \return -1 if object \p obj is not involved in structure \p distances.
*/
static __hwloc_inline int
hwloc_distances_obj_index(struct hwloc_distances_s *distances, hwloc_obj_t obj)
{
unsigned i;
for(i=0; i<distances->nbobjs; i++)
if (distances->objs[i] == obj)
return (int)i;
return -1;
}
/** \brief Find the values between two objects in a distances structure.
*
* The distance from \p obj1 to \p obj2 is stored in the value pointed by
* \p value1to2 and reciprocally.
*
* \return -1 if object \p obj1 or \p obj2 is not involved in structure \p distances.
*/
static __hwloc_inline int
hwloc_distances_obj_pair_values(struct hwloc_distances_s *distances,
hwloc_obj_t obj1, hwloc_obj_t obj2,
hwloc_uint64_t *value1to2, hwloc_uint64_t *value2to1)
{
int i1 = hwloc_distances_obj_index(distances, obj1);
int i2 = hwloc_distances_obj_index(distances, obj2);
if (i1 < 0 || i2 < 0)
return -1;
*value1to2 = distances->values[i1 * distances->nbobjs + i2];
*value2to1 = distances->values[i2 * distances->nbobjs + i1];
return 0;
}
/** @} */
/** \defgroup hwlocality_distances_add Add or remove distances between objects
* @{
*/
/** \brief Flags for adding a new distances to a topology. */
enum hwloc_distances_flag_e {
enum hwloc_distances_add_flag_e {
/** \brief Try to group objects based on the newly provided distance information.
* \hideinitializer
*/
HWLOC_DISTANCES_FLAG_GROUP = (1UL<<0),
HWLOC_DISTANCES_ADD_FLAG_GROUP = (1UL<<0),
/** \brief If grouping, consider the distance values as inaccurate and relax the
* comparisons during the grouping algorithms. The actual accuracy may be modified
* through the HWLOC_GROUPING_ACCURACY environment variable (see \ref envvar).
* \hideinitializer
*/
HWLOC_DISTANCES_FLAG_GROUP_INACCURATE = (1UL<<1)
HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE = (1UL<<1)
};
/** \brief Provide a distance matrix.
@ -175,7 +222,7 @@ enum hwloc_distances_flag_e {
* \p kind specifies the kind of distance as a OR'ed set of ::hwloc_distances_kind_e.
*
* \p flags configures the behavior of the function using an optional OR'ed set of
* ::hwloc_distances_flag_e.
* ::hwloc_distances_add_flag_e.
*
* Objects must be of the same type. They cannot be of type Group.
*/

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

@ -1,5 +1,5 @@
/*
* Copyright © 2013-2016 Inria. All rights reserved.
* Copyright © 2013-2017 Inria. All rights reserved.
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -440,7 +440,7 @@ hwloc_filter_check_keep_object(hwloc_topology_t topology, hwloc_obj_t obj)
/** \defgroup hwlocality_components_pci_funcs Components and Plugins: PCI functions to be used by components
/** \defgroup hwlocality_components_pcidisc Components and Plugins: helpers for PCI discovery
* @{
*/
@ -448,20 +448,20 @@ hwloc_filter_check_keep_object(hwloc_topology_t topology, hwloc_obj_t obj)
*
* This function requires a 256-bytes config space. Unknown/unavailable bytes should be set to 0xff.
*/
HWLOC_DECLSPEC unsigned hwloc_pci_find_cap(const unsigned char *config, unsigned cap);
HWLOC_DECLSPEC unsigned hwloc_pcidisc_find_cap(const unsigned char *config, unsigned cap);
/** \brief Fill linkspeed by reading the PCI config space where PCI_CAP_ID_EXP is at position offset.
*
* Needs 20 bytes of EXP capability block starting at offset in the config space
* for registers up to link status.
*/
HWLOC_DECLSPEC int hwloc_pci_find_linkspeed(const unsigned char *config, unsigned offset, float *linkspeed);
HWLOC_DECLSPEC int hwloc_pcidisc_find_linkspeed(const unsigned char *config, unsigned offset, float *linkspeed);
/** \brief Return the hwloc object type (PCI device or Bridge) for the given class and configuration space.
*
* This function requires 16 bytes of common configuration header at the beginning of config.
*/
HWLOC_DECLSPEC hwloc_obj_type_t hwloc_pci_check_bridge_type(unsigned device_class, const unsigned char *config);
HWLOC_DECLSPEC hwloc_obj_type_t hwloc_pcidisc_check_bridge_type(unsigned device_class, const unsigned char *config);
/** \brief Fills the attributes of the given PCI bridge using the given PCI config space.
*
@ -469,38 +469,47 @@ HWLOC_DECLSPEC hwloc_obj_type_t hwloc_pci_check_bridge_type(unsigned device_clas
*
* Returns -1 and destroys /p obj if bridge fields are invalid.
*/
HWLOC_DECLSPEC int hwloc_pci_setup_bridge_attr(hwloc_obj_t obj, const unsigned char *config);
HWLOC_DECLSPEC int hwloc_pcidisc_setup_bridge_attr(hwloc_obj_t obj, const unsigned char *config);
/** \brief Insert a PCI object in the given PCI tree by looking at PCI bus IDs.
*
* If \p treep points to \c NULL, the new object is inserted there.
*/
HWLOC_DECLSPEC void hwloc_pci_tree_insert_by_busid(struct hwloc_obj **treep, struct hwloc_obj *obj);
HWLOC_DECLSPEC void hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep, struct hwloc_obj *obj);
/** \brief Add some hostbridges on top of the given tree of PCI objects and attach them to the root of the topology.
/** \brief Add some hostbridges on top of the given tree of PCI objects and attach them to the topology.
*
* The core will move them to their actual PCI locality using hwloc_pci_belowroot_apply_locality()
* at the end of the discovery.
* In the meantime, other backends will easily lookup PCI objects (for instance to attach OS devices)
* by using hwloc_pci_belowroot_find_by_busid() or by manually looking at the topology root object
* io_first_child pointer.
* For now, they will be attached to the root object. The core will move them to their actual PCI
* locality using hwloc_pci_belowroot_apply_locality() at the end of the discovery.
*
* In the meantime, other backends lookup PCI objects or localities (for instance to attach OS devices)
* by using hwloc_pcidisc_find_by_busid() or hwloc_pcidisc_find_busid_parent().
*/
HWLOC_DECLSPEC int hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *tree);
/** @} */
/** \defgroup hwlocality_components_pcifind Components and Plugins: finding PCI objects during other discoveries
* @{
*/
HWLOC_DECLSPEC int hwloc_pci_tree_attach_belowroot(struct hwloc_topology *topology, struct hwloc_obj *tree);
/** \brief Find the PCI object that matches the bus ID.
*
* To be used after a PCI backend added PCI devices with hwloc_pci_tree_attach_belowroot()
* To be used after a PCI backend added PCI devices with hwloc_pcidisc_tree_attach()
* and before the core moves them to their actual location with hwloc_pci_belowroot_apply_locality().
*
* If no exactly matching object is found, return the container bridge if any, or NULL.
*
* On failure, it may be possible to find the PCI locality (instead of the PCI device)
* by calling hwloc_pci_find_busid_parent().
* by calling hwloc_pcidisc_find_busid_parent().
*
* \note This is semantically identical to hwloc_get_pcidev_by_busid() which only works
* after the topology is fully loaded.
*/
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pci_belowroot_find_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pcidisc_find_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
/** \brief Find the normal parent of a PCI bus ID.
*
@ -508,11 +517,11 @@ HWLOC_DECLSPEC struct hwloc_obj * hwloc_pci_belowroot_find_by_busid(struct hwloc
*
* This function should be used to attach an I/O device directly under a normal
* (non-I/O) object, instead of below a PCI object.
* It is usually used by backends when hwloc_pci_belowroot_find_by_busid() failed
* It is usually used by backends when hwloc_pcidisc_find_by_busid() failed
* to find the hwloc object corresponding to this bus ID, for instance because
* PCI discovery is not supported on this platform.
*/
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pci_find_busid_parent(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pcidisc_find_busid_parent(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
/** @} */

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

@ -376,10 +376,12 @@ extern "C" {
#define hwloc_distances_get_by_depth HWLOC_NAME(distances_get_by_depth)
#define hwloc_distances_get_by_type HWLOC_NAME(distances_get_by_type)
#define hwloc_distances_release HWLOC_NAME(distances_release)
#define hwloc_distances_obj_index HWLOC_NAME(distances_obj_index)
#define hwloc_distances_obj_pair_values HWLOC_NAME(distances_pair_values)
#define hwloc_distances_flag_e HWLOC_NAME(distances_flag_e)
#define HWLOC_DISTANCES_FLAG_GROUP HWLOC_NAME_CAPS(DISTANCES_FLAG_GROUP)
#define HWLOC_DISTANCES_FLAG_GROUP_INACCURATE HWLOC_NAME_CAPS(DISTANCES_FLAG_GROUP_INACCURATE)
#define hwloc_distances_add_flag_e HWLOC_NAME(distances_add_flag_e)
#define HWLOC_DISTANCES_ADD_FLAG_GROUP HWLOC_NAME_CAPS(DISTANCES_ADD_FLAG_GROUP)
#define HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE HWLOC_NAME_CAPS(DISTANCES_ADD_FLAG_GROUP_INACCURATE)
#define hwloc_distances_add HWLOC_NAME(distances_add)
#define hwloc_distances_remove HWLOC_NAME(distances_remove)
@ -531,14 +533,15 @@ extern "C" {
#define hwloc_filter_check_keep_object_type HWLOC_NAME(filter_check_keep_object_type)
#define hwloc_filter_check_keep_object HWLOC_NAME(filter_check_keep_object)
#define hwloc_pci_find_cap HWLOC_NAME(pci_find_cap)
#define hwloc_pci_find_linkspeed HWLOC_NAME(pci_find_linkspeed)
#define hwloc_pci_check_bridge_type HWLOC_NAME(pci_check_bridge_type)
#define hwloc_pci_setup_bridge_attr HWLOC_NAME(pci_setup_bridge_attr)
#define hwloc_pci_tree_insert_by_busid HWLOC_NAME(pci_tree_insert_by_busid)
#define hwloc_pci_tree_attach_belowroot HWLOC_NAME(pci_tree_attach_belowroot)
#define hwloc_pci_belowroot_find_by_busid HWLOC_NAME(pci_belowroot_find_by_busid)
#define hwloc_pci_find_busid_parent HWLOC_NAME(pci_find_busid_parent)
#define hwloc_pcidisc_find_cap HWLOC_NAME(pcidisc_find_cap)
#define hwloc_pcidisc_find_linkspeed HWLOC_NAME(pcidisc_find_linkspeed)
#define hwloc_pcidisc_check_bridge_type HWLOC_NAME(pcidisc_check_bridge_type)
#define hwloc_pcidisc_setup_bridge_attr HWLOC_NAME(pcidisc_setup_bridge_attr)
#define hwloc_pcidisc_tree_insert_by_busid HWLOC_NAME(pcidisc_tree_insert_by_busid)
#define hwloc_pcidisc_tree_attach HWLOC_NAME(pcidisc_tree_attach)
#define hwloc_pcidisc_find_by_busid HWLOC_NAME(pcidisc_find_by_busid)
#define hwloc_pcidisc_find_busid_parent HWLOC_NAME(pcidisc_find_busid_parent)
/* hwloc/deprecated.h */

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

@ -45,8 +45,8 @@ extern "C" {
/** \brief Get the required shared memory length for storing a topology.
*
* This length must be used in hwloc_shmem_topology_write() and
* hwloc_shmem_topology_adopt() later.
* This length (in bytes) must be used in hwloc_shmem_topology_write()
* and hwloc_shmem_topology_adopt() later.
*
* \note Flags \p flags are currently unused, must be 0.
*/
@ -57,21 +57,27 @@ HWLOC_DECLSPEC int hwloc_shmem_topology_get_length(hwloc_topology_t topology,
/** \brief Duplicate a topology to a shared memory file.
*
* Temporarily map a file in virtual memory and duplicate the
* topology \p topology by allocating duplicates there.
* topology \p topology by allocating duplicates in there.
*
* The segment of the file pointed by descriptor \p fd,
* starting at offset \p fileoffset, and of length \p length,
* will be temporarily mapped at virtual address \p mmap_address.
* starting at offset \p fileoffset, and of length \p length (in bytes),
* will be temporarily mapped at virtual address \p mmap_address
* during the duplication.
*
* The mapping length \p length must have been previously obtained with
* hwloc_shmem_topology_get_length()
* and the topology must not have been modified in the meantime.
*
* \return -1 with errno set to EBUSY is the requested memory mapping isn't available.
* \return -1 with errno set to EINVAL if fileoffset, mmap_address or length
* aren't page-aligned.
*
* \note Flags \p flags are currently unused, must be 0.
*
* \note The object userdata pointer is duplicated but the pointed buffer
* is not. However the caller may also allocate it manually in shared memory
* to share it as well.
*
* \return -1 with errno set to EBUSY if the virtual memory mapping defined
* by \p mmap_address and \p length isn't available in the process.
* \return -1 with errno set to EINVAL if \p fileoffset, \p mmap_address
* or \p length aren't page-aligned.
*/
HWLOC_DECLSPEC int hwloc_shmem_topology_write(hwloc_topology_t topology,
int fd, hwloc_uint64_t fileoffset,
@ -86,19 +92,28 @@ HWLOC_DECLSPEC int hwloc_shmem_topology_write(hwloc_topology_t topology,
* The returned adopted topology in \p topologyp can be used just like any
* topology. And it must be destroyed with hwloc_topology_destroy() as usual.
*
* However the topology is read-only.
* For instance, it cannot be modified with hwloc_topology_restrict()
* and object userdata pointers cannot be changed.
*
* The segment of the file pointed by descriptor \p fd,
* starting at offset \p fileoffset, and of length \p length,
* starting at offset \p fileoffset, and of length \p length (in bytes),
* will be mapped at virtual address \p mmap_address.
*
* The file pointed by descriptor \p fd, the offset \p fileoffset,
* the requested mapping virtual address \p mmap_address and the length \p length
* must be identical to what was given to hwloc_shmem_topology_write() earlier.
*
* \return -1 with errno set to EBUSY is the requested memory mapping isn't available.
* \return -1 with errno set to EINVAL if fileoffset, mmap_address or length
* aren't page-aligned.
*
* \note Flags \p flags are currently unused, must be 0.
*
* \note The object userdata pointer should not be used unless the process
* that created the shared topology also placed userdata-pointed buffers
* in shared memory.
*
* \return -1 with errno set to EBUSY if the virtual memory mapping defined
* by \p mmap_address and \p length isn't available in the process.
* \return -1 with errno set to EINVAL if \p fileoffset, \p mmap_address
* or \p length aren't page-aligned.
*/
HWLOC_DECLSPEC int hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
int fd, hwloc_uint64_t fileoffset,

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

@ -4,7 +4,6 @@
* All rights reserved.
* Copyright © 2015-2016 Inria. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -1,7 +1,6 @@
/*
* Copyright © 2016 Inria. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -4,7 +4,6 @@
*
* Copyright © 2009, 2011, 2012 CNRS, inria., Université Bordeaux All rights reserved.
* Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -231,6 +230,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
/* Define to 1 if you have the <mpi.h> header file. */
#undef HAVE_MPI_H

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

@ -4,7 +4,6 @@
* All rights reserved.
* Copyright © 2015-2017 Inria. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -134,6 +134,7 @@ struct hwloc_topology {
*/
unsigned long kind;
/* objects are currently stored in physical_index order */
hwloc_obj_t *objs; /* array of objects */
int objs_are_valid; /* set to 1 if the array objs is still valid, 0 if needs refresh */

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

@ -1,7 +1,6 @@
/*
* Copyright © 2009-2010 Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow

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

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: netloc
Description: Network locality detection and management library
Version: master-201707200234-3db801d
Version: shmem-20170815.1857.git2478ce8
Cflags: -I${includedir}
Libs: -L${libdir} -lnetloc -lhwloc
Libs.private:

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

@ -56,7 +56,9 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
[opal_pmix_pmix2x_args="--disable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
AS_IF([test "$with_devel_headers" = "yes"],
[opal_pmix_pmix2x_args="--with-devel-headers --with-pmix-extra-lib=$OPAL_TOP_BUILDDIR/opal/lib${OPAL_LIB_PREFIX}open-pal.la $opal_pmix_pmix2x_args"])
[AS_IF([test "$enable_dlopen" = "yes"],
[opal_pmix_pmix2x_args="--with-pmix-extra-lib=$OPAL_TOP_BUILDDIR/opal/lib${OPAL_LIB_PREFIX}open-pal.la $opal_pmix_pmix2x_args"])
opal_pmix_pmix2x_args="--with-devel-headers $opal_pmix_pmix2x_args"])
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix2x_basedir/pmix],

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

@ -253,7 +253,8 @@ static pmix_status_t dstore_store(const pmix_proc_t *proc,
pmix_kval_t *kv);
static pmix_status_t _dstore_fetch(const char *nspace,
pmix_rank_t rank, const char *key, pmix_value_t **kvs);
pmix_rank_t rank,
const char *key, pmix_value_t **kvs);
static pmix_status_t dstore_fetch(const pmix_proc_t *proc,
pmix_scope_t scope, bool copy,
@ -1411,7 +1412,8 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo)
PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output,
"%s:%d:%s: nspace %s, add rank %lu offset %lu count %lu meta info",
__FILE__, __LINE__, __func__,
ns_info->ns_map.name, rinfo->rank, rinfo->offset, rinfo->count));
ns_info->ns_map.name, (unsigned long)rinfo->rank,
(unsigned long)rinfo->offset, (unsigned long)rinfo->count));
tmp = ns_info->meta_seg;
if (1 == _direct_mode) {
@ -1577,7 +1579,7 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
* warn a user about it and fail. */
offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */
pmix_output(0, "PLEASE set NS_DATA_SEG_SIZE to value which is larger when %lu.",
sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + size + EXT_SLOT_SIZE());
(unsigned long)(sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + size + EXT_SLOT_SIZE()));
return offset;
}
@ -1618,7 +1620,11 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg,
memcpy(addr, &data_ended, sizeof(size_t));
PMIX_OUTPUT_VERBOSE((1, pmix_gds_base_framework.framework_output,
"%s:%d:%s: key %s, rel start offset %lu, rel end offset %lu, abs shift %lu size %lu",
__FILE__, __LINE__, __func__, key, offset, data_ended, id * _data_segment_size, size));
__FILE__, __LINE__, __func__,
key, (unsigned long)offset,
(unsigned long)data_ended,
(unsigned long)(id * _data_segment_size),
(unsigned long)size));
return global_offset;
}
@ -1703,8 +1709,10 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
memcpy(&offset, ESH_DATA_PTR(addr), sizeof(size_t));
if (0 < offset) {
PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output,
"%s:%d:%s: for rank %u, replace flag %d %s is filled with %lu value",
__FILE__, __LINE__, __func__, rank, data_exist, ESH_REGION_EXTENSION, offset));
"%s:%d:%s: for rank %lu, replace flag %d %s is filled with %lu value",
__FILE__, __LINE__, __func__,
(unsigned long)rank, data_exist,
ESH_REGION_EXTENSION, (unsigned long)offset));
/* go to next item, updating address */
addr = _get_data_region_by_offset(datadesc, offset);
if (NULL == addr) {
@ -2260,7 +2268,8 @@ static pmix_status_t dstore_store(const pmix_proc_t *proc,
return rc;
}
inline pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, const char *key, pmix_value_t **kvs)
static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank,
const char *key, pmix_value_t **kvs)
{
ns_seg_info_t *ns_info = NULL;
pmix_status_t rc = PMIX_ERROR, lock_rc;