mirror of
https://github.com/xmrig/xmrig.git
synced 2026-06-19 02:42:39 -04:00
Merge branch 'feature-hwloc' into evo
This commit is contained in:
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
project(xmrig)
|
project(xmrig)
|
||||||
|
|
||||||
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
||||||
|
option(WITH_HWLOC "Use hwloc" ON)
|
||||||
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
|
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
|
||||||
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
|
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
|
||||||
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
|
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
|
||||||
@@ -11,9 +12,15 @@ option(WITH_HTTP "HTTP protocol support (client/server)" ON)
|
|||||||
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
||||||
option(WITH_TLS "Enable OpenSSL support" ON)
|
option(WITH_TLS "Enable OpenSSL support" ON)
|
||||||
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
||||||
|
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
||||||
|
|
||||||
option(BUILD_STATIC "Build static binary" OFF)
|
option(BUILD_STATIC "Build static binary" OFF)
|
||||||
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
||||||
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF)
|
||||||
|
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
|
||||||
include (CheckIncludeFile)
|
include (CheckIncludeFile)
|
||||||
include (cmake/cpu.cmake)
|
include (cmake/cpu.cmake)
|
||||||
@@ -100,6 +107,7 @@ set(SOURCES_CRYPTO
|
|||||||
src/crypto/common/Algorithm.cpp
|
src/crypto/common/Algorithm.cpp
|
||||||
src/crypto/common/keccak.cpp
|
src/crypto/common/keccak.cpp
|
||||||
src/crypto/common/Nonce.cpp
|
src/crypto/common/Nonce.cpp
|
||||||
|
src/crypto/common/VirtualMemory.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
@@ -142,8 +150,6 @@ endif()
|
|||||||
add_definitions(/D__STDC_FORMAT_MACROS)
|
add_definitions(/D__STDC_FORMAT_MACROS)
|
||||||
add_definitions(/DUNICODE)
|
add_definitions(/DUNICODE)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
|
||||||
|
|
||||||
find_package(UV REQUIRED)
|
find_package(UV REQUIRED)
|
||||||
|
|
||||||
if (WITH_RANDOMX)
|
if (WITH_RANDOMX)
|
||||||
@@ -176,6 +182,8 @@ if (WITH_RANDOMX)
|
|||||||
src/crypto/rx/RxAlgo.h
|
src/crypto/rx/RxAlgo.h
|
||||||
src/crypto/rx/RxCache.cpp
|
src/crypto/rx/RxCache.cpp
|
||||||
src/crypto/rx/RxCache.h
|
src/crypto/rx/RxCache.h
|
||||||
|
src/crypto/rx/RxConfig.cpp
|
||||||
|
src/crypto/rx/RxConfig.h
|
||||||
src/crypto/rx/RxDataset.cpp
|
src/crypto/rx/RxDataset.cpp
|
||||||
src/crypto/rx/RxDataset.h
|
src/crypto/rx/RxDataset.h
|
||||||
src/crypto/rx/RxVm.cpp
|
src/crypto/rx/RxVm.cpp
|
||||||
|
|||||||
25
cmake/FindHWLOC.cmake
Normal file
25
cmake/FindHWLOC.cmake
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
find_path(
|
||||||
|
HWLOC_INCLUDE_DIR
|
||||||
|
NAMES hwloc.h
|
||||||
|
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||||
|
PATH_SUFFIXES "include"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(HWLOC_INCLUDE_DIR NAMES hwloc.h)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
HWLOC_LIBRARY
|
||||||
|
NAMES hwloc.a hwloc libhwloc
|
||||||
|
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||||
|
PATH_SUFFIXES "lib"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(HWLOC_LIBRARY NAMES hwloc.a hwloc libhwloc)
|
||||||
|
|
||||||
|
set(HWLOC_LIBRARIES ${HWLOC_LIBRARY})
|
||||||
|
set(HWLOC_INCLUDE_DIRS ${HWLOC_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(HWLOC DEFAULT_MSG HWLOC_LIBRARY HWLOC_INCLUDE_DIR)
|
||||||
44
src/3rdparty/hwloc/AUTHORS
vendored
Normal file
44
src/3rdparty/hwloc/AUTHORS
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
hwloc Authors
|
||||||
|
=============
|
||||||
|
|
||||||
|
The following cumulative list contains the names of most individuals
|
||||||
|
who have committed code to the hwloc repository
|
||||||
|
(either directly or through a third party).
|
||||||
|
|
||||||
|
Name Affiliation(s)
|
||||||
|
--------------------------- --------------------
|
||||||
|
Grzegorz Andrejczuk Intel
|
||||||
|
Cédric Augonnet University of Bordeaux
|
||||||
|
Guillaume Beauchamp Inria
|
||||||
|
Ahmad Boissetri Binzagr Inria
|
||||||
|
Cyril Bordage Inria
|
||||||
|
Nicholas Buroker UWL
|
||||||
|
Christopher M. Cantalupo Intel
|
||||||
|
Jérôme Clet-Ortega University of Bordeaux
|
||||||
|
Ludovic Courtès Inria
|
||||||
|
Clément Foyer Inria
|
||||||
|
Nathalie Furmento CNRS
|
||||||
|
Bryon Gloden
|
||||||
|
Brice Goglin Inria
|
||||||
|
Gilles Gouaillardet RIST
|
||||||
|
Joshua Hursey UWL
|
||||||
|
Alexey Kardashevskiy IBM
|
||||||
|
Rob Latham ANL
|
||||||
|
Douglas MacFarland UWL
|
||||||
|
Marc Marí BSC
|
||||||
|
Jonathan L Peyton Intel
|
||||||
|
Piotr Luc Intel
|
||||||
|
Antoine Rougier intern from University of Bordeaux
|
||||||
|
Jeff Squyres Cisco
|
||||||
|
Samuel Thibault University of Bordeaux
|
||||||
|
Jean-Yves VET DDN
|
||||||
|
Benjamin Worpitz
|
||||||
|
Jeff Zhao Zhaoxin
|
||||||
|
|
||||||
|
Affiliaion abbreviations:
|
||||||
|
-------------------------
|
||||||
|
ANL = Argonne National Lab
|
||||||
|
BSC = Barcelona Supercomputing Center
|
||||||
|
Cisco = Cisco Systems, Inc.
|
||||||
|
CNRS = Centre national de la recherche scientifique (France)
|
||||||
|
UWL = University of Wisconsin-La Crosse
|
||||||
38
src/3rdparty/hwloc/CMakeLists.txt
vendored
Normal file
38
src/3rdparty/hwloc/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
project (hwloc C)
|
||||||
|
|
||||||
|
include_directories(include)
|
||||||
|
include_directories(src)
|
||||||
|
|
||||||
|
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
include/hwloc.h
|
||||||
|
src/static-components.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
src/base64.c
|
||||||
|
src/bind.c
|
||||||
|
src/bitmap.c
|
||||||
|
src/components.c
|
||||||
|
src/diff.c
|
||||||
|
src/distances.c
|
||||||
|
src/misc.c
|
||||||
|
src/pci-common.c
|
||||||
|
src/shmem.c
|
||||||
|
src/topology.c
|
||||||
|
src/topology-noos.c
|
||||||
|
src/topology-synthetic.c
|
||||||
|
src/topology-windows.c
|
||||||
|
src/topology-x86.c
|
||||||
|
src/topology-xml.c
|
||||||
|
src/topology-xml-nolibxml.c
|
||||||
|
src/traversal.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(hwloc STATIC
|
||||||
|
${HEADERS}
|
||||||
|
${SOURCES}
|
||||||
|
)
|
||||||
39
src/3rdparty/hwloc/COPYING
vendored
Normal file
39
src/3rdparty/hwloc/COPYING
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
Copyright © 2004-2006 The Trustees of Indiana University and Indiana University Research and Technology Corporation. All rights reserved.
|
||||||
|
Copyright © 2004-2005 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved.
|
||||||
|
Copyright © 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved.
|
||||||
|
Copyright © 2004-2005 The Regents of the University of California. All rights reserved.
|
||||||
|
Copyright © 2009 CNRS
|
||||||
|
Copyright © 2009-2016 Inria. All rights reserved.
|
||||||
|
Copyright © 2009-2015 Université Bordeaux
|
||||||
|
Copyright © 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
|
Copyright © 2009-2012 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
Copyright © 2010 IBM
|
||||||
|
Copyright © 2010 Jirka Hladky
|
||||||
|
Copyright © 2012 Aleksej Saushev, The NetBSD Foundation
|
||||||
|
Copyright © 2012 Blue Brain Project, EPFL. All rights reserved.
|
||||||
|
Copyright © 2013-2014 University of Wisconsin-La Crosse. All rights reserved.
|
||||||
|
Copyright © 2015 Research Organization for Information Science and Technology (RIST). All rights reserved.
|
||||||
|
Copyright © 2015-2016 Intel, Inc. All rights reserved.
|
||||||
|
See COPYING in top-level directory.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
1599
src/3rdparty/hwloc/NEWS
vendored
Normal file
1599
src/3rdparty/hwloc/NEWS
vendored
Normal file
File diff suppressed because it is too large
Load Diff
85
src/3rdparty/hwloc/README
vendored
Normal file
85
src/3rdparty/hwloc/README
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
Introduction
|
||||||
|
|
||||||
|
The Hardware Locality (hwloc) software project aims at easing the process of
|
||||||
|
discovering hardware resources in parallel architectures. It offers
|
||||||
|
command-line tools and a C API for consulting these resources, their locality,
|
||||||
|
attributes, and interconnection. hwloc primarily aims at helping
|
||||||
|
high-performance computing (HPC) applications, but is also applicable to any
|
||||||
|
project seeking to exploit code and/or data locality on modern computing
|
||||||
|
platforms.
|
||||||
|
|
||||||
|
hwloc is actually made of two subprojects distributed together:
|
||||||
|
|
||||||
|
* The original hwloc project for describing the internals of computing nodes.
|
||||||
|
It is described in details starting at section Hardware Locality (hwloc)
|
||||||
|
Introduction.
|
||||||
|
* The network-oriented companion called netloc (Network Locality), described
|
||||||
|
in details starting with section Network Locality (netloc).
|
||||||
|
|
||||||
|
See also the Related pages tab above for links to other sections.
|
||||||
|
|
||||||
|
Netloc may be disabled, but the original hwloc cannot. Both hwloc and netloc
|
||||||
|
APIs are documented after these sections.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
|
||||||
|
hwloc (http://www.open-mpi.org/projects/hwloc/) is available under the BSD
|
||||||
|
license. It is hosted as a sub-project of the overall Open MPI project (http://
|
||||||
|
www.open-mpi.org/). Note that hwloc does not require any functionality from
|
||||||
|
Open MPI -- it is a wholly separate (and much smaller!) project and code base.
|
||||||
|
It just happens to be hosted as part of the overall Open MPI project.
|
||||||
|
|
||||||
|
Basic Installation
|
||||||
|
|
||||||
|
Installation is the fairly common GNU-based process:
|
||||||
|
|
||||||
|
shell$ ./configure --prefix=...
|
||||||
|
shell$ make
|
||||||
|
shell$ make install
|
||||||
|
|
||||||
|
hwloc- and netloc-specific configure options and requirements are documented in
|
||||||
|
sections hwloc Installation and Netloc Installation respectively.
|
||||||
|
|
||||||
|
Also note that if you install supplemental libraries in non-standard locations,
|
||||||
|
hwloc's configure script may not be able to find them without some help. You
|
||||||
|
may need to specify additional CPPFLAGS, LDFLAGS, or PKG_CONFIG_PATH values on
|
||||||
|
the configure command line.
|
||||||
|
|
||||||
|
For example, if libpciaccess was installed into /opt/pciaccess, hwloc's
|
||||||
|
configure script may not find it be default. Try adding PKG_CONFIG_PATH to the
|
||||||
|
./configure command line, like this:
|
||||||
|
|
||||||
|
./configure PKG_CONFIG_PATH=/opt/pciaccess/lib/pkgconfig ...
|
||||||
|
|
||||||
|
Running the "lstopo" tool is a good way to check as a graphical output whether
|
||||||
|
hwloc properly detected the architecture of your node. Netloc command-line
|
||||||
|
tools can be used to display the network topology interconnecting your nodes.
|
||||||
|
|
||||||
|
Installing from a Git clone
|
||||||
|
|
||||||
|
Additionally, the code can be directly cloned from Git:
|
||||||
|
|
||||||
|
shell$ git clone https://github.com/open-mpi/hwloc.git
|
||||||
|
shell$ cd hwloc
|
||||||
|
shell$ ./autogen.sh
|
||||||
|
|
||||||
|
Note that GNU Autoconf >=2.63, Automake >=1.11 and Libtool >=2.2.6 are required
|
||||||
|
when building from a Git clone.
|
||||||
|
|
||||||
|
Nightly development snapshots are available on the web site, they can be
|
||||||
|
configured and built without any need for Git or GNU Autotools.
|
||||||
|
|
||||||
|
Questions and Bugs
|
||||||
|
|
||||||
|
Bugs should be reported in the tracker (https://github.com/open-mpi/hwloc/
|
||||||
|
issues). Opening a new issue automatically displays lots of hints about how to
|
||||||
|
debug and report issues.
|
||||||
|
|
||||||
|
Questions may be sent to the users or developers mailing lists (http://
|
||||||
|
www.open-mpi.org/community/lists/hwloc.php).
|
||||||
|
|
||||||
|
There is also a #hwloc IRC channel on Freenode (irc.freenode.net).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
See https://www.open-mpi.org/projects/hwloc/doc/ for more hwloc documentation.
|
||||||
47
src/3rdparty/hwloc/VERSION
vendored
Normal file
47
src/3rdparty/hwloc/VERSION
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# This is the VERSION file for hwloc, describing the precise version
|
||||||
|
# of hwloc in this distribution. The various components of the version
|
||||||
|
# number below are combined to form a single version number string.
|
||||||
|
|
||||||
|
# major, minor, and release are generally combined in the form
|
||||||
|
# <major>.<minor>.<release>. If release is zero, then it is omitted.
|
||||||
|
|
||||||
|
# Please update HWLOC_VERSION* in contrib/windows/hwloc_config.h too.
|
||||||
|
|
||||||
|
major=2
|
||||||
|
minor=0
|
||||||
|
release=4
|
||||||
|
|
||||||
|
# greek is used for alpha or beta release tags. If it is non-empty,
|
||||||
|
# it will be appended to the version number. It does not have to be
|
||||||
|
# numeric. Common examples include a1 (alpha release 1), b1 (beta
|
||||||
|
# release 1), sc2005 (Super Computing 2005 release). The only
|
||||||
|
# requirement is that it must be entirely printable ASCII characters
|
||||||
|
# and have no white space.
|
||||||
|
|
||||||
|
greek=
|
||||||
|
|
||||||
|
# The date when this release was created
|
||||||
|
|
||||||
|
date="Jun 03, 2019"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# The shared library version of hwloc's public library. This version
|
||||||
|
# is maintained in accordance with the "Library Interface Versions"
|
||||||
|
# chapter from the GNU Libtool documentation. Notes:
|
||||||
|
|
||||||
|
# 1. Since version numbers are associated with *releases*, the version
|
||||||
|
# number maintained on the hwloc git master (and developer branches)
|
||||||
|
# is always 0:0:0.
|
||||||
|
|
||||||
|
# 2. Version numbers are described in the Libtool current:revision:age
|
||||||
|
# format.
|
||||||
|
|
||||||
|
libhwloc_so_version=15:3:0
|
||||||
|
libnetloc_so_version=0:0:0
|
||||||
|
|
||||||
|
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj
|
||||||
2270
src/3rdparty/hwloc/include/hwloc.h
vendored
Normal file
2270
src/3rdparty/hwloc/include/hwloc.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
59
src/3rdparty/hwloc/include/hwloc/autogen/config.h
vendored
Normal file
59
src/3rdparty/hwloc/include/hwloc/autogen/config.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2012 Université Bordeaux
|
||||||
|
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The configuration file */
|
||||||
|
|
||||||
|
#ifndef HWLOC_CONFIG_H
|
||||||
|
#define HWLOC_CONFIG_H
|
||||||
|
|
||||||
|
#define HWLOC_VERSION "2.0.4"
|
||||||
|
#define HWLOC_VERSION_MAJOR 2
|
||||||
|
#define HWLOC_VERSION_MINOR 0
|
||||||
|
#define HWLOC_VERSION_RELEASE 4
|
||||||
|
#define HWLOC_VERSION_GREEK ""
|
||||||
|
|
||||||
|
#define __hwloc_restrict
|
||||||
|
#define __hwloc_inline __inline
|
||||||
|
|
||||||
|
#define __hwloc_attribute_unused
|
||||||
|
#define __hwloc_attribute_malloc
|
||||||
|
#define __hwloc_attribute_const
|
||||||
|
#define __hwloc_attribute_pure
|
||||||
|
#define __hwloc_attribute_deprecated
|
||||||
|
#define __hwloc_attribute_may_alias
|
||||||
|
#define __hwloc_attribute_warn_unused_result
|
||||||
|
|
||||||
|
/* Defined to 1 if you have the `windows.h' header. */
|
||||||
|
#define HWLOC_HAVE_WINDOWS_H 1
|
||||||
|
#define hwloc_pid_t HANDLE
|
||||||
|
#define hwloc_thread_t HANDLE
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
typedef DWORDLONG hwloc_uint64_t;
|
||||||
|
|
||||||
|
#if defined( _USRDLL ) /* dynamic linkage */
|
||||||
|
#if defined( DECLSPEC_EXPORTS )
|
||||||
|
#define HWLOC_DECLSPEC __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define HWLOC_DECLSPEC __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#else /* static linkage */
|
||||||
|
#define HWLOC_DECLSPEC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Whether we need to re-define all the hwloc public symbols or not */
|
||||||
|
#define HWLOC_SYM_TRANSFORM 0
|
||||||
|
|
||||||
|
/* The hwloc symbol prefix */
|
||||||
|
#define HWLOC_SYM_PREFIX hwloc_
|
||||||
|
|
||||||
|
/* The hwloc symbol prefix in all caps */
|
||||||
|
#define HWLOC_SYM_PREFIX_CAPS HWLOC_
|
||||||
|
|
||||||
|
#endif /* HWLOC_CONFIG_H */
|
||||||
467
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
Normal file
467
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
Normal file
@@ -0,0 +1,467 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2012 Université Bordeaux
|
||||||
|
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief The bitmap API, for use in hwloc itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_BITMAP_H
|
||||||
|
#define HWLOC_BITMAP_H
|
||||||
|
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_bitmap The bitmap API
|
||||||
|
*
|
||||||
|
* The ::hwloc_bitmap_t type represents a set of integers (positive or null).
|
||||||
|
* A bitmap may be of infinite size (all bits are set after some point).
|
||||||
|
* A bitmap may even be full if all bits are set.
|
||||||
|
*
|
||||||
|
* Bitmaps are used by hwloc for sets of OS processors
|
||||||
|
* (which may actually be hardware threads) as by ::hwloc_cpuset_t
|
||||||
|
* (a typedef for ::hwloc_bitmap_t), or sets of NUMA memory nodes
|
||||||
|
* as ::hwloc_nodeset_t (also a typedef for ::hwloc_bitmap_t).
|
||||||
|
* Those are used for cpuset and nodeset fields in the ::hwloc_obj structure,
|
||||||
|
* see \ref hwlocality_object_sets.
|
||||||
|
*
|
||||||
|
* <em>Both CPU and node sets are always indexed by OS physical number.</em>
|
||||||
|
* However users should usually not build CPU and node sets manually
|
||||||
|
* (e.g. with hwloc_bitmap_set()).
|
||||||
|
* One should rather use existing object sets and combine them with
|
||||||
|
* hwloc_bitmap_or(), etc.
|
||||||
|
* For instance, binding the current thread on a pair of cores may be performed with:
|
||||||
|
* \code
|
||||||
|
* hwloc_obj_t core1 = ... , core2 = ... ;
|
||||||
|
* hwloc_bitmap_t set = hwloc_bitmap_alloc();
|
||||||
|
* hwloc_bitmap_or(set, core1->cpuset, core2->cpuset);
|
||||||
|
* hwloc_set_cpubind(topology, set, HWLOC_CPUBIND_THREAD);
|
||||||
|
* hwloc_bitmap_free(set);
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* \note Most functions below return an int that may be negative in case of
|
||||||
|
* error. The usual error case would be an internal failure to realloc/extend
|
||||||
|
* the storage of the bitmap (\p errno would be set to \c ENOMEM).
|
||||||
|
*
|
||||||
|
* \note Several examples of using the bitmap API are available under the
|
||||||
|
* doc/examples/ directory in the source tree.
|
||||||
|
* Regression tests such as tests/hwloc/hwloc_bitmap*.c also make intensive use
|
||||||
|
* of this API.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief
|
||||||
|
* Set of bits represented as an opaque pointer to an internal bitmap.
|
||||||
|
*/
|
||||||
|
typedef struct hwloc_bitmap_s * hwloc_bitmap_t;
|
||||||
|
/** \brief a non-modifiable ::hwloc_bitmap_t */
|
||||||
|
typedef const struct hwloc_bitmap_s * hwloc_const_bitmap_t;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitmap allocation, freeing and copying.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Allocate a new empty bitmap.
|
||||||
|
*
|
||||||
|
* \returns A valid bitmap or \c NULL.
|
||||||
|
*
|
||||||
|
* The bitmap should be freed by a corresponding call to
|
||||||
|
* hwloc_bitmap_free().
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc(void) __hwloc_attribute_malloc;
|
||||||
|
|
||||||
|
/** \brief Allocate a new full bitmap. */
|
||||||
|
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc_full(void) __hwloc_attribute_malloc;
|
||||||
|
|
||||||
|
/** \brief Free bitmap \p bitmap.
|
||||||
|
*
|
||||||
|
* If \p bitmap is \c NULL, no operation is performed.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC void hwloc_bitmap_free(hwloc_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Duplicate bitmap \p bitmap by allocating a new bitmap and copying \p bitmap contents.
|
||||||
|
*
|
||||||
|
* If \p bitmap is \c NULL, \c NULL is returned.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap) __hwloc_attribute_malloc;
|
||||||
|
|
||||||
|
/** \brief Copy the contents of bitmap \p src into the already allocated bitmap \p dst */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitmap/String Conversion
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap.
|
||||||
|
*
|
||||||
|
* Up to \p buflen characters may be written in buffer \p buf.
|
||||||
|
*
|
||||||
|
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||||
|
*
|
||||||
|
* \return the number of character that were actually written if not truncating,
|
||||||
|
* or that would have been written (not including the ending \\0).
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap into a newly allocated string.
|
||||||
|
*
|
||||||
|
* \return -1 on error.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Parse a bitmap string and stores it in bitmap \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap in the list format.
|
||||||
|
*
|
||||||
|
* Lists are comma-separated indexes or ranges.
|
||||||
|
* Ranges are dash separated indexes.
|
||||||
|
* The last range may not have an ending indexes if the bitmap is infinitely set.
|
||||||
|
*
|
||||||
|
* Up to \p buflen characters may be written in buffer \p buf.
|
||||||
|
*
|
||||||
|
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||||
|
*
|
||||||
|
* \return the number of character that were actually written if not truncating,
|
||||||
|
* or that would have been written (not including the ending \\0).
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap into a newly allocated list string.
|
||||||
|
*
|
||||||
|
* \return -1 on error.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_list_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Parse a list string and stores it in bitmap \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap in the taskset-specific format.
|
||||||
|
*
|
||||||
|
* The taskset command manipulates bitmap strings that contain a single
|
||||||
|
* (possible very long) hexadecimal number starting with 0x.
|
||||||
|
*
|
||||||
|
* Up to \p buflen characters may be written in buffer \p buf.
|
||||||
|
*
|
||||||
|
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||||
|
*
|
||||||
|
* \return the number of character that were actually written if not truncating,
|
||||||
|
* or that would have been written (not including the ending \\0).
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Stringify a bitmap into a newly allocated taskset-specific string.
|
||||||
|
*
|
||||||
|
* \return -1 on error.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_taskset_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Parse a taskset-specific bitmap string and stores it in bitmap \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_taskset_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Building bitmaps.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Empty the bitmap \p bitmap */
|
||||||
|
HWLOC_DECLSPEC void hwloc_bitmap_zero(hwloc_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Fill bitmap \p bitmap with all possible indexes (even if those objects don't exist or are otherwise unavailable) */
|
||||||
|
HWLOC_DECLSPEC void hwloc_bitmap_fill(hwloc_bitmap_t bitmap);
|
||||||
|
|
||||||
|
/** \brief Empty the bitmap \p bitmap and add bit \p id */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_only(hwloc_bitmap_t bitmap, unsigned id);
|
||||||
|
|
||||||
|
/** \brief Fill the bitmap \p and clear the index \p id */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_allbut(hwloc_bitmap_t bitmap, unsigned id);
|
||||||
|
|
||||||
|
/** \brief Setup bitmap \p bitmap from unsigned long \p mask */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask);
|
||||||
|
|
||||||
|
/** \brief Setup bitmap \p bitmap from unsigned long \p mask used as \p i -th subset */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modifying bitmaps.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Add index \p id in bitmap \p bitmap */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id);
|
||||||
|
|
||||||
|
/** \brief Add indexes from \p begin to \p end in bitmap \p bitmap.
|
||||||
|
*
|
||||||
|
* If \p end is \c -1, the range is infinite.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_set_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
|
||||||
|
|
||||||
|
/** \brief Replace \p i -th subset of bitmap \p bitmap with unsigned long \p mask */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
|
||||||
|
|
||||||
|
/** \brief Remove index \p id from bitmap \p bitmap */
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_clr(hwloc_bitmap_t bitmap, unsigned id);
|
||||||
|
|
||||||
|
/** \brief Remove indexes from \p begin to \p end in bitmap \p bitmap.
|
||||||
|
*
|
||||||
|
* If \p end is \c -1, the range is infinite.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_clr_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
|
||||||
|
|
||||||
|
/** \brief Keep a single index among those set in bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* May be useful before binding so that the process does not
|
||||||
|
* have a chance of migrating between multiple logical CPUs
|
||||||
|
* in the original mask.
|
||||||
|
* Instead of running the task on any PU inside the given CPU set,
|
||||||
|
* the operating system scheduler will be forced to run it on a single
|
||||||
|
* of these PUs.
|
||||||
|
* It avoids a migration overhead and cache-line ping-pongs between PUs.
|
||||||
|
*
|
||||||
|
* \note This function is NOT meant to distribute multiple processes
|
||||||
|
* within a single CPU set. It always return the same single bit when
|
||||||
|
* called multiple times on the same input set. hwloc_distrib() may
|
||||||
|
* be used for generating CPU sets to distribute multiple tasks below
|
||||||
|
* a single multi-PU object.
|
||||||
|
*
|
||||||
|
* \note This function cannot be applied to an object set directly. It
|
||||||
|
* should be applied to a copy (which may be obtained with hwloc_bitmap_dup()).
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_singlify(hwloc_bitmap_t bitmap);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Consulting bitmaps.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Convert the beginning part of bitmap \p bitmap into unsigned long \p mask */
|
||||||
|
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Convert the \p i -th subset of bitmap \p bitmap into unsigned long mask */
|
||||||
|
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Test whether index \p id is part of bitmap \p bitmap.
|
||||||
|
*
|
||||||
|
* \return 1 if the bit at index \p id is set in bitmap \p bitmap, 0 otherwise.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Test whether bitmap \p bitmap is empty
|
||||||
|
*
|
||||||
|
* \return 1 if bitmap is empty, 0 otherwise.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Test whether bitmap \p bitmap is completely full
|
||||||
|
*
|
||||||
|
* \return 1 if bitmap is full, 0 otherwise.
|
||||||
|
*
|
||||||
|
* \note A full bitmap is always infinitely set.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the first index (least significant bit) in bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* \return -1 if no index is set in \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the next index in bitmap \p bitmap which is after index \p prev
|
||||||
|
*
|
||||||
|
* If \p prev is -1, the first index is returned.
|
||||||
|
*
|
||||||
|
* \return -1 if no index with higher index is set in \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the last index (most significant bit) in bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* \return -1 if no index is set in \p bitmap, or if \p bitmap is infinitely set.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the "weight" of bitmap \p bitmap (i.e., number of
|
||||||
|
* indexes that are in the bitmap).
|
||||||
|
*
|
||||||
|
* \return the number of indexes that are in the bitmap.
|
||||||
|
*
|
||||||
|
* \return -1 if \p bitmap is infinitely set.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the first unset index (least significant bit) in bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* \return -1 if no index is unset in \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_first_unset(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the next unset index in bitmap \p bitmap which is after index \p prev
|
||||||
|
*
|
||||||
|
* If \p prev is -1, the first unset index is returned.
|
||||||
|
*
|
||||||
|
* \return -1 if no index with higher index is unset in \p bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_next_unset(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compute the last unset index (most significant bit) in bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* \return -1 if no index is unset in \p bitmap, or if \p bitmap is infinitely set.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_last_unset(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Loop macro iterating on bitmap \p bitmap
|
||||||
|
*
|
||||||
|
* The loop must start with hwloc_bitmap_foreach_begin() and end
|
||||||
|
* with hwloc_bitmap_foreach_end() followed by a terminating ';'.
|
||||||
|
*
|
||||||
|
* \p index is the loop variable; it should be an unsigned int. The
|
||||||
|
* first iteration will set \p index to the lowest index in the bitmap.
|
||||||
|
* Successive iterations will iterate through, in order, all remaining
|
||||||
|
* indexes set in the bitmap. To be specific: each iteration will return a
|
||||||
|
* value for \p index such that hwloc_bitmap_isset(bitmap, index) is true.
|
||||||
|
*
|
||||||
|
* The assert prevents the loop from being infinite if the bitmap is infinitely set.
|
||||||
|
*
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
#define hwloc_bitmap_foreach_begin(id, bitmap) \
|
||||||
|
do { \
|
||||||
|
assert(hwloc_bitmap_weight(bitmap) != -1); \
|
||||||
|
for (id = hwloc_bitmap_first(bitmap); \
|
||||||
|
(unsigned) id != (unsigned) -1; \
|
||||||
|
id = hwloc_bitmap_next(bitmap, id)) {
|
||||||
|
|
||||||
|
/** \brief End of loop macro iterating on a bitmap.
|
||||||
|
*
|
||||||
|
* Needs a terminating ';'.
|
||||||
|
*
|
||||||
|
* \sa hwloc_bitmap_foreach_begin()
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
#define hwloc_bitmap_foreach_end() \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Combining bitmaps.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Or bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||||
|
*
|
||||||
|
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_or (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||||
|
|
||||||
|
/** \brief And bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||||
|
*
|
||||||
|
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_and (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||||
|
|
||||||
|
/** \brief And bitmap \p bitmap1 and the negation of \p bitmap2 and store the result in bitmap \p res
|
||||||
|
*
|
||||||
|
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_andnot (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||||
|
|
||||||
|
/** \brief Xor bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||||
|
*
|
||||||
|
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_xor (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||||
|
|
||||||
|
/** \brief Negate bitmap \p bitmap and store the result in bitmap \p res
|
||||||
|
*
|
||||||
|
* \p res can be the same as \p bitmap
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Comparing bitmaps.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Test whether bitmaps \p bitmap1 and \p bitmap2 intersects.
|
||||||
|
*
|
||||||
|
* \return 1 if bitmaps intersect, 0 otherwise.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_intersects (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Test whether bitmap \p sub_bitmap is part of bitmap \p super_bitmap.
|
||||||
|
*
|
||||||
|
* \return 1 if \p sub_bitmap is included in \p super_bitmap, 0 otherwise.
|
||||||
|
*
|
||||||
|
* \note The empty bitmap is considered included in any other bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_isincluded (hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Test whether bitmap \p bitmap1 is equal to bitmap \p bitmap2.
|
||||||
|
*
|
||||||
|
* \return 1 if bitmaps are equal, 0 otherwise.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_isequal (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compare bitmaps \p bitmap1 and \p bitmap2 using their lowest index.
|
||||||
|
*
|
||||||
|
* A bitmap is considered smaller if its least significant bit is smaller.
|
||||||
|
* The empty bitmap is considered higher than anything (because its least significant bit does not exist).
|
||||||
|
*
|
||||||
|
* \return -1 if \p bitmap1 is considered smaller than \p bitmap2.
|
||||||
|
* \return 1 if \p bitmap1 is considered larger than \p bitmap2.
|
||||||
|
*
|
||||||
|
* For instance comparing binary bitmaps 0011 and 0110 returns -1
|
||||||
|
* (hence 0011 is considered smaller than 0110)
|
||||||
|
* because least significant bit of 0011 (0001) is smaller than least significant bit of 0110 (0010).
|
||||||
|
* Comparing 01001 and 00110 would also return -1 for the same reason.
|
||||||
|
*
|
||||||
|
* \return 0 if bitmaps are considered equal, even if they are not strictly equal.
|
||||||
|
* They just need to have the same least significant bit.
|
||||||
|
* For instance, comparing binary bitmaps 0010 and 0110 returns 0 because they have the same least significant bit.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** \brief Compare bitmaps \p bitmap1 and \p bitmap2 in lexicographic order.
|
||||||
|
*
|
||||||
|
* Lexicographic comparison of bitmaps, starting for their highest indexes.
|
||||||
|
* Compare last indexes first, then second, etc.
|
||||||
|
* The empty bitmap is considered lower than anything.
|
||||||
|
*
|
||||||
|
* \return -1 if \p bitmap1 is considered smaller than \p bitmap2.
|
||||||
|
* \return 1 if \p bitmap1 is considered larger than \p bitmap2.
|
||||||
|
* \return 0 if bitmaps are equal (contrary to hwloc_bitmap_compare_first()).
|
||||||
|
*
|
||||||
|
* For instance comparing binary bitmaps 0011 and 0110 returns -1
|
||||||
|
* (hence 0011 is considered smaller than 0110).
|
||||||
|
* Comparing 00101 and 01010 returns -1 too.
|
||||||
|
*
|
||||||
|
* \note This is different from the non-existing hwloc_bitmap_compare_last()
|
||||||
|
* which would only compare the highest index of each bitmap.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_bitmap_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_BITMAP_H */
|
||||||
220
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
Normal file
220
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2010-2017 Inria. All rights reserved.
|
||||||
|
* Copyright © 2010-2011 Université Bordeaux
|
||||||
|
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and the CUDA Driver API.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and the CUDA Driver API may want to
|
||||||
|
* include this file so as to get topology information for CUDA devices.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_CUDA_H
|
||||||
|
#define HWLOC_CUDA_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cuda.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_cuda Interoperability with the CUDA Driver API
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* CUDA devices when using the CUDA Driver API.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Return the domain, bus and device IDs of the CUDA device \p cudevice.
|
||||||
|
*
|
||||||
|
* Device \p cudevice must match the local machine.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cuda_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
CUdevice cudevice, int *domain, int *bus, int *dev)
|
||||||
|
{
|
||||||
|
CUresult cres;
|
||||||
|
|
||||||
|
#if CUDA_VERSION >= 4000
|
||||||
|
cres = cuDeviceGetAttribute(domain, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cudevice);
|
||||||
|
if (cres != CUDA_SUCCESS) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
*domain = 0;
|
||||||
|
#endif
|
||||||
|
cres = cuDeviceGetAttribute(bus, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cudevice);
|
||||||
|
if (cres != CUDA_SUCCESS) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
cres = cuDeviceGetAttribute(dev, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cudevice);
|
||||||
|
if (cres != CUDA_SUCCESS) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to device \p cudevice.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the CUDA device \p cudevice.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p cudevice must match the local machine.
|
||||||
|
* I/O devices detection and the CUDA component are not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_cuda_get_device_osdev()
|
||||||
|
* and hwloc_cuda_get_device_osdev_by_index().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux; other systems will simply get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
CUdevice cudevice, hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||||
|
#define HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX];
|
||||||
|
int domainid, busid, deviceid;
|
||||||
|
|
||||||
|
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domainid, &busid, &deviceid))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domainid, busid, deviceid);
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#else
|
||||||
|
/* Non-Linux systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc PCI device object corresponding to the
|
||||||
|
* CUDA device \p cudevice.
|
||||||
|
*
|
||||||
|
* Return the PCI device object describing the CUDA device \p cudevice.
|
||||||
|
* Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p cudevice must match the local machine.
|
||||||
|
* I/O devices detection must be enabled in topology \p topology.
|
||||||
|
* The CUDA component is not needed in the topology.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_cuda_get_device_pcidev(hwloc_topology_t topology, CUdevice cudevice)
|
||||||
|
{
|
||||||
|
int domain, bus, dev;
|
||||||
|
|
||||||
|
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domain, &bus, &dev))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to CUDA device \p cudevice.
|
||||||
|
*
|
||||||
|
* Return the hwloc OS device object that describes the given
|
||||||
|
* CUDA device \p cudevice. Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p cudevice must match the local machine.
|
||||||
|
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||||
|
* If not, the locality of the object may still be found using
|
||||||
|
* hwloc_cuda_get_device_cpuset().
|
||||||
|
*
|
||||||
|
* \note This function cannot work if PCI devices are filtered out.
|
||||||
|
*
|
||||||
|
* \note The corresponding hwloc PCI device may be found by looking
|
||||||
|
* at the result parent pointer (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_cuda_get_device_osdev(hwloc_topology_t topology, CUdevice cudevice)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
int domain, bus, dev;
|
||||||
|
|
||||||
|
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domain, &bus, &dev))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
hwloc_obj_t pcidev = osdev->parent;
|
||||||
|
if (strncmp(osdev->name, "cuda", 4))
|
||||||
|
continue;
|
||||||
|
if (pcidev
|
||||||
|
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||||
|
&& (int) pcidev->attr->pcidev.domain == domain
|
||||||
|
&& (int) pcidev->attr->pcidev.bus == bus
|
||||||
|
&& (int) pcidev->attr->pcidev.dev == dev
|
||||||
|
&& pcidev->attr->pcidev.func == 0)
|
||||||
|
return osdev;
|
||||||
|
/* if PCI are filtered out, we need a info attr to match on */
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* CUDA device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the CUDA device whose
|
||||||
|
* index is \p idx. Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*
|
||||||
|
* \note This function is identical to hwloc_cudart_get_device_osdev_by_index().
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_cuda_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& !strncmp("cuda", osdev->name, 4)
|
||||||
|
&& atoi(osdev->name + 4) == (int) idx)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_CUDA_H */
|
||||||
177
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
Normal file
177
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2010-2017 Inria. All rights reserved.
|
||||||
|
* Copyright © 2010-2011 Université Bordeaux
|
||||||
|
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and the CUDA Runtime API.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and the CUDA Runtime API may want to
|
||||||
|
* include this file so as to get topology information for CUDA devices.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_CUDART_H
|
||||||
|
#define HWLOC_CUDART_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cuda.h> /* for CUDA_VERSION */
|
||||||
|
#include <cuda_runtime_api.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_cudart Interoperability with the CUDA Runtime API
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* CUDA devices when using the CUDA Runtime API.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Return the domain, bus and device IDs of the CUDA device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Device index \p idx must match the local machine.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cudart_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
int idx, int *domain, int *bus, int *dev)
|
||||||
|
{
|
||||||
|
cudaError_t cerr;
|
||||||
|
struct cudaDeviceProp prop;
|
||||||
|
|
||||||
|
cerr = cudaGetDeviceProperties(&prop, idx);
|
||||||
|
if (cerr) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CUDA_VERSION >= 4000
|
||||||
|
*domain = prop.pciDomainID;
|
||||||
|
#else
|
||||||
|
*domain = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*bus = prop.pciBusID;
|
||||||
|
*dev = prop.pciDeviceID;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to device \p idx.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the CUDA device
|
||||||
|
* whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p idx must match the local machine.
|
||||||
|
* I/O devices detection and the CUDA component are not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_cudart_get_device_osdev_by_index().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux; other systems will simply get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
int idx, hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||||
|
#define HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX];
|
||||||
|
int domain, bus, dev;
|
||||||
|
|
||||||
|
if (hwloc_cudart_get_device_pci_ids(topology, idx, &domain, &bus, &dev))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", (unsigned) domain, (unsigned) bus, (unsigned) dev);
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#else
|
||||||
|
/* Non-Linux systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc PCI device object corresponding to the
|
||||||
|
* CUDA device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Return the PCI device object describing the CUDA device whose
|
||||||
|
* index is \p idx. Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p idx must match the local machine.
|
||||||
|
* I/O devices detection must be enabled in topology \p topology.
|
||||||
|
* The CUDA component is not needed in the topology.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_cudart_get_device_pcidev(hwloc_topology_t topology, int idx)
|
||||||
|
{
|
||||||
|
int domain, bus, dev;
|
||||||
|
|
||||||
|
if (hwloc_cudart_get_device_pci_ids(topology, idx, &domain, &bus, &dev))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* CUDA device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the CUDA device whose
|
||||||
|
* index is \p idx. Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||||
|
* If not, the locality of the object may still be found using
|
||||||
|
* hwloc_cudart_get_device_cpuset().
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*
|
||||||
|
* \note This function is identical to hwloc_cuda_get_device_osdev_by_index().
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_cudart_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& !strncmp("cuda", osdev->name, 4)
|
||||||
|
&& atoi(osdev->name + 4) == (int) idx)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_CUDART_H */
|
||||||
206
src/3rdparty/hwloc/include/hwloc/deprecated.h
vendored
Normal file
206
src/3rdparty/hwloc/include/hwloc/deprecated.h
vendored
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2012 Université Bordeaux
|
||||||
|
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains the inline code of functions declared in hwloc.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_DEPRECATED_H
|
||||||
|
#define HWLOC_DEPRECATED_H
|
||||||
|
|
||||||
|
#ifndef HWLOC_H
|
||||||
|
#error Please include the main hwloc.h instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* backward compat with v1.11 before System removal */
|
||||||
|
#define HWLOC_OBJ_SYSTEM HWLOC_OBJ_MACHINE
|
||||||
|
/* backward compat with v1.10 before Socket->Package renaming */
|
||||||
|
#define HWLOC_OBJ_SOCKET HWLOC_OBJ_PACKAGE
|
||||||
|
/* backward compat with v1.10 before Node->NUMANode clarification */
|
||||||
|
#define HWLOC_OBJ_NODE HWLOC_OBJ_NUMANODE
|
||||||
|
|
||||||
|
/** \brief Insert a misc object by parent.
|
||||||
|
*
|
||||||
|
* Identical to hwloc_topology_insert_misc_object().
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name)
|
||||||
|
{
|
||||||
|
return hwloc_topology_insert_misc_object(topology, parent, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Stringify the cpuset containing a set of objects.
|
||||||
|
*
|
||||||
|
* If \p size is 0, \p string may safely be \c NULL.
|
||||||
|
*
|
||||||
|
* \return the number of character that were actually written if not truncating,
|
||||||
|
* or that would have been written (not including the ending \\0).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs)
|
||||||
|
{
|
||||||
|
hwloc_bitmap_t set = hwloc_bitmap_alloc();
|
||||||
|
int res;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
hwloc_bitmap_zero(set);
|
||||||
|
for(i=0; i<nobj; i++)
|
||||||
|
if (objs[i]->cpuset)
|
||||||
|
hwloc_bitmap_or(set, set, objs[i]->cpuset);
|
||||||
|
|
||||||
|
res = hwloc_bitmap_snprintf(str, size, set);
|
||||||
|
hwloc_bitmap_free(set);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert a type string into a type and some attributes.
|
||||||
|
*
|
||||||
|
* Deprecated by hwloc_type_sscanf()
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize)
|
||||||
|
{
|
||||||
|
union hwloc_obj_attr_u attr;
|
||||||
|
int err = hwloc_type_sscanf(string, typep, &attr, sizeof(attr));
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
if (hwloc_obj_type_is_cache(*typep)) {
|
||||||
|
if (depthattrp)
|
||||||
|
*depthattrp = (int) attr.cache.depth;
|
||||||
|
if (typeattrp && typeattrsize >= sizeof(hwloc_obj_cache_type_t))
|
||||||
|
memcpy(typeattrp, &attr.cache.type, sizeof(hwloc_obj_cache_type_t));
|
||||||
|
} else if (*typep == HWLOC_OBJ_GROUP) {
|
||||||
|
if (depthattrp)
|
||||||
|
*depthattrp = (int) attr.group.depth;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Set the default memory binding policy of the current
|
||||||
|
* process or thread to prefer the NUMA node(s) specified by physical \p nodeset
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_set_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Query the default memory binding policy and physical locality of the
|
||||||
|
* current process or thread.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_get_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Set the default memory binding policy of the specified
|
||||||
|
* process to prefer the NUMA node(s) specified by physical \p nodeset
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_set_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Query the default memory binding policy and physical locality of the
|
||||||
|
* specified process.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_get_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Bind the already-allocated memory identified by (addr, len)
|
||||||
|
* to the NUMA node(s) in physical \p nodeset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_set_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Query the physical NUMA node(s) and binding policy of the memory
|
||||||
|
* identified by (\p addr, \p len ).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_get_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Allocate some memory on the given physical nodeset \p nodeset
|
||||||
|
*/
|
||||||
|
static __hwloc_inline void *
|
||||||
|
hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline void *
|
||||||
|
hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_alloc_membind(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Allocate some memory on the given nodeset \p nodeset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline void *
|
||||||
|
hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline void *
|
||||||
|
hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
return hwloc_alloc_membind_policy(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert a CPU set into a NUMA node set and handle non-NUMA cases
|
||||||
|
*/
|
||||||
|
static __hwloc_inline void
|
||||||
|
hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline void
|
||||||
|
hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
|
||||||
|
{
|
||||||
|
hwloc_cpuset_to_nodeset(topology, _cpuset, nodeset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert a NUMA node set into a CPU set and handle non-NUMA cases
|
||||||
|
*/
|
||||||
|
static __hwloc_inline void
|
||||||
|
hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset) __hwloc_attribute_deprecated;
|
||||||
|
static __hwloc_inline void
|
||||||
|
hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
|
||||||
|
{
|
||||||
|
hwloc_cpuset_from_nodeset(topology, _cpuset, nodeset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_DEPRECATED_H */
|
||||||
289
src/3rdparty/hwloc/include/hwloc/diff.h
vendored
Normal file
289
src/3rdparty/hwloc/include/hwloc/diff.h
vendored
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2013-2018 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Topology differences.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_DIFF_H
|
||||||
|
#define HWLOC_DIFF_H
|
||||||
|
|
||||||
|
#ifndef HWLOC_H
|
||||||
|
#error Please include the main hwloc.h instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#elif 0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_diff Topology differences
|
||||||
|
*
|
||||||
|
* Applications that manipulate many similar topologies, for instance
|
||||||
|
* one for each node of a homogeneous cluster, may want to compress
|
||||||
|
* topologies to reduce the memory footprint.
|
||||||
|
*
|
||||||
|
* This file offers a way to manipulate the difference between topologies
|
||||||
|
* and export/import it to/from XML.
|
||||||
|
* Compression may therefore be achieved by storing one topology
|
||||||
|
* entirely while the others are only described by their differences
|
||||||
|
* with the former.
|
||||||
|
* The actual topology can be reconstructed when actually needed by
|
||||||
|
* applying the precomputed difference to the reference topology.
|
||||||
|
*
|
||||||
|
* This interface targets very similar nodes.
|
||||||
|
* Only very simple differences between topologies are actually
|
||||||
|
* supported, for instance a change in the memory size, the name
|
||||||
|
* of the object, or some info attribute.
|
||||||
|
* More complex differences such as adding or removing objects cannot
|
||||||
|
* be represented in the difference structures and therefore return
|
||||||
|
* errors.
|
||||||
|
* Differences between object sets or topology-wide allowed sets,
|
||||||
|
* cannot be represented either.
|
||||||
|
*
|
||||||
|
* It means that there is no need to apply the difference when
|
||||||
|
* looking at the tree organization (how many levels, how many
|
||||||
|
* objects per level, what kind of objects, CPU and node sets, etc)
|
||||||
|
* and when binding to objects.
|
||||||
|
* However the difference must be applied when looking at object
|
||||||
|
* attributes such as the name, the memory size or info attributes.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Type of one object attribute difference.
|
||||||
|
*/
|
||||||
|
typedef enum hwloc_topology_diff_obj_attr_type_e {
|
||||||
|
/** \brief The object local memory is modified.
|
||||||
|
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s
|
||||||
|
* (and the index field is ignored).
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE,
|
||||||
|
|
||||||
|
/** \brief The object name is modified.
|
||||||
|
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s
|
||||||
|
* (and the name field is ignored).
|
||||||
|
*/
|
||||||
|
|
||||||
|
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME,
|
||||||
|
/** \brief the value of an info attribute is modified.
|
||||||
|
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s.
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO
|
||||||
|
} hwloc_topology_diff_obj_attr_type_t;
|
||||||
|
|
||||||
|
/** \brief One object attribute difference.
|
||||||
|
*/
|
||||||
|
union hwloc_topology_diff_obj_attr_u {
|
||||||
|
struct hwloc_topology_diff_obj_attr_generic_s {
|
||||||
|
/* each part of the union must start with these */
|
||||||
|
hwloc_topology_diff_obj_attr_type_t type;
|
||||||
|
} generic;
|
||||||
|
|
||||||
|
/** \brief Integer attribute modification with an optional index. */
|
||||||
|
struct hwloc_topology_diff_obj_attr_uint64_s {
|
||||||
|
/* used for storing integer attributes */
|
||||||
|
hwloc_topology_diff_obj_attr_type_t type;
|
||||||
|
hwloc_uint64_t index; /* not used for SIZE */
|
||||||
|
hwloc_uint64_t oldvalue;
|
||||||
|
hwloc_uint64_t newvalue;
|
||||||
|
} uint64;
|
||||||
|
|
||||||
|
/** \brief String attribute modification with an optional name */
|
||||||
|
struct hwloc_topology_diff_obj_attr_string_s {
|
||||||
|
/* used for storing name and info pairs */
|
||||||
|
hwloc_topology_diff_obj_attr_type_t type;
|
||||||
|
char *name; /* not used for NAME */
|
||||||
|
char *oldvalue;
|
||||||
|
char *newvalue;
|
||||||
|
} string;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Type of one element of a difference list.
|
||||||
|
*/
|
||||||
|
typedef enum hwloc_topology_diff_type_e {
|
||||||
|
/** \brief An object attribute was changed.
|
||||||
|
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_s.
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR,
|
||||||
|
|
||||||
|
/** \brief The difference is too complex,
|
||||||
|
* it cannot be represented. The difference below
|
||||||
|
* this object has not been checked.
|
||||||
|
* hwloc_topology_diff_build() will return 1.
|
||||||
|
*
|
||||||
|
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_too_complex_s.
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
|
||||||
|
} hwloc_topology_diff_type_t;
|
||||||
|
|
||||||
|
/** \brief One element of a difference list between two topologies.
|
||||||
|
*/
|
||||||
|
typedef union hwloc_topology_diff_u {
|
||||||
|
struct hwloc_topology_diff_generic_s {
|
||||||
|
/* each part of the union must start with these */
|
||||||
|
hwloc_topology_diff_type_t type;
|
||||||
|
union hwloc_topology_diff_u * next; /* pointer to the next element of the list, or NULL */
|
||||||
|
} generic;
|
||||||
|
|
||||||
|
/* A difference in an object attribute. */
|
||||||
|
struct hwloc_topology_diff_obj_attr_s {
|
||||||
|
hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_OBJ_ATTR */
|
||||||
|
union hwloc_topology_diff_u * next;
|
||||||
|
/* List of attribute differences for a single object */
|
||||||
|
int obj_depth;
|
||||||
|
unsigned obj_index;
|
||||||
|
union hwloc_topology_diff_obj_attr_u diff;
|
||||||
|
} obj_attr;
|
||||||
|
|
||||||
|
/* A difference that is too complex. */
|
||||||
|
struct hwloc_topology_diff_too_complex_s {
|
||||||
|
hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX */
|
||||||
|
union hwloc_topology_diff_u * next;
|
||||||
|
/* Where we had to stop computing the diff in the first topology */
|
||||||
|
int obj_depth;
|
||||||
|
unsigned obj_index;
|
||||||
|
} too_complex;
|
||||||
|
} * hwloc_topology_diff_t;
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Compute the difference between 2 topologies.
|
||||||
|
*
|
||||||
|
* The difference is stored as a list of ::hwloc_topology_diff_t entries
|
||||||
|
* starting at \p diff.
|
||||||
|
* It is computed by doing a depth-first traversal of both topology trees
|
||||||
|
* simultaneously.
|
||||||
|
*
|
||||||
|
* If the difference between 2 objects is too complex to be represented
|
||||||
|
* (for instance if some objects have different types, or different numbers
|
||||||
|
* of children), a special diff entry of type ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
|
||||||
|
* is queued.
|
||||||
|
* The computation of the diff does not continue below these objects.
|
||||||
|
* So each such diff entry means that the difference between two subtrees
|
||||||
|
* could not be computed.
|
||||||
|
*
|
||||||
|
* \return 0 if the difference can be represented properly.
|
||||||
|
*
|
||||||
|
* \return 0 with \p diff pointing to NULL if there is no difference
|
||||||
|
* between the topologies.
|
||||||
|
*
|
||||||
|
* \return 1 if the difference is too complex (see above). Some entries in
|
||||||
|
* the list will be of type ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX.
|
||||||
|
*
|
||||||
|
* \return -1 on any other error.
|
||||||
|
*
|
||||||
|
* \note \p flags is currently not used. It should be 0.
|
||||||
|
*
|
||||||
|
* \note The output diff has to be freed with hwloc_topology_diff_destroy().
|
||||||
|
*
|
||||||
|
* \note The output diff can only be exported to XML or passed to
|
||||||
|
* hwloc_topology_diff_apply() if 0 was returned, i.e. if no entry of type
|
||||||
|
* ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX is listed.
|
||||||
|
*
|
||||||
|
* \note The output diff may be modified by removing some entries from
|
||||||
|
* the list. The removed entries should be freed by passing them to
|
||||||
|
* to hwloc_topology_diff_destroy() (possible as another list).
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_build(hwloc_topology_t topology, hwloc_topology_t newtopology, unsigned long flags, hwloc_topology_diff_t *diff);
|
||||||
|
|
||||||
|
/** \brief Flags to be given to hwloc_topology_diff_apply().
|
||||||
|
*/
|
||||||
|
enum hwloc_topology_diff_apply_flags_e {
|
||||||
|
/** \brief Apply topology diff in reverse direction.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE = (1UL<<0)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Apply a topology diff to an existing topology.
|
||||||
|
*
|
||||||
|
* \p flags is an OR'ed set of ::hwloc_topology_diff_apply_flags_e.
|
||||||
|
*
|
||||||
|
* The new topology is modified in place. hwloc_topology_dup()
|
||||||
|
* may be used to duplicate it before patching.
|
||||||
|
*
|
||||||
|
* If the difference cannot be applied entirely, all previous applied
|
||||||
|
* elements are unapplied before returning.
|
||||||
|
*
|
||||||
|
* \return 0 on success.
|
||||||
|
*
|
||||||
|
* \return -N if applying the difference failed while trying
|
||||||
|
* to apply the N-th part of the difference. For instance -1
|
||||||
|
* is returned if the very first difference element could not
|
||||||
|
* be applied.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_apply(hwloc_topology_t topology, hwloc_topology_diff_t diff, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Destroy a list of topology differences.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff);
|
||||||
|
|
||||||
|
/** \brief Load a list of topology differences from a XML file.
|
||||||
|
*
|
||||||
|
* If not \c NULL, \p refname will be filled with the identifier
|
||||||
|
* string of the reference topology for the difference file,
|
||||||
|
* if any was specified in the XML file.
|
||||||
|
* This identifier is usually the name of the other XML file
|
||||||
|
* that contains the reference topology.
|
||||||
|
*
|
||||||
|
* \note the pointer returned in refname should later be freed
|
||||||
|
* by the caller.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topology_diff_t *diff, char **refname);
|
||||||
|
|
||||||
|
/** \brief Export a list of topology differences to a XML file.
|
||||||
|
*
|
||||||
|
* If not \c NULL, \p refname defines an identifier string
|
||||||
|
* for the reference topology which was used as a base when
|
||||||
|
* computing this difference.
|
||||||
|
* This identifier is usually the name of the other XML file
|
||||||
|
* that contains the reference topology.
|
||||||
|
* This attribute is given back when reading the diff from XML.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath);
|
||||||
|
|
||||||
|
/** \brief Load a list of topology differences from a XML buffer.
|
||||||
|
*
|
||||||
|
* If not \c NULL, \p refname will be filled with the identifier
|
||||||
|
* string of the reference topology for the difference file,
|
||||||
|
* if any was specified in the XML file.
|
||||||
|
* This identifier is usually the name of the other XML file
|
||||||
|
* that contains the reference topology.
|
||||||
|
*
|
||||||
|
* \note the pointer returned in refname should later be freed
|
||||||
|
* by the caller.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_load_xmlbuffer(const char *xmlbuffer, int buflen, hwloc_topology_diff_t *diff, char **refname);
|
||||||
|
|
||||||
|
/** \brief Export a list of topology differences to a XML buffer.
|
||||||
|
*
|
||||||
|
* If not \c NULL, \p refname defines an identifier string
|
||||||
|
* for the reference topology which was used as a base when
|
||||||
|
* computing this difference.
|
||||||
|
* This identifier is usually the name of the other XML file
|
||||||
|
* that contains the reference topology.
|
||||||
|
* This attribute is given back when reading the diff from XML.
|
||||||
|
*
|
||||||
|
* The returned buffer ends with a \0 that is included in the returned
|
||||||
|
* length.
|
||||||
|
*
|
||||||
|
* \note The XML buffer should later be freed with hwloc_free_xmlbuffer().
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_diff_export_xmlbuffer(hwloc_topology_diff_t diff, const char *refname, char **xmlbuffer, int *buflen);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_DIFF_H */
|
||||||
271
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
Normal file
271
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2010-2019 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Object distances.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_DISTANCES_H
|
||||||
|
#define HWLOC_DISTANCES_H
|
||||||
|
|
||||||
|
#ifndef HWLOC_H
|
||||||
|
#error Please include the main hwloc.h instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#elif 0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_distances_get Retrieve distances between objects
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Matrix of distances between a set of objects.
|
||||||
|
*
|
||||||
|
* This matrix often contains latencies between NUMA nodes
|
||||||
|
* (as reported in the System Locality Distance Information Table (SLIT)
|
||||||
|
* in the ACPI specification), which may or may not be physically accurate.
|
||||||
|
* It corresponds to the latency for accessing the memory of one node
|
||||||
|
* from a core in another node.
|
||||||
|
* The corresponding kind is ::HWLOC_DISTANCES_KIND_FROM_OS | ::HWLOC_DISTANCES_KIND_FROM_USER.
|
||||||
|
*
|
||||||
|
* The matrix may also contain bandwidths between random sets of objects,
|
||||||
|
* possibly provided by the user, as specified in the \p kind attribute.
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Distance from i-th to j-th object is stored in slot i*nbobjs+j.
|
||||||
|
* The meaning of the value depends on the \p kind attribute.
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Kinds of distance matrices.
|
||||||
|
*
|
||||||
|
* The \p kind attribute of struct hwloc_distances_s is a OR'ed set
|
||||||
|
* of kinds.
|
||||||
|
*
|
||||||
|
* A kind of format HWLOC_DISTANCES_KIND_FROM_* specifies where the
|
||||||
|
* distance information comes from, if known.
|
||||||
|
*
|
||||||
|
* A kind of format HWLOC_DISTANCES_KIND_MEANS_* specifies whether
|
||||||
|
* values are latencies or bandwidths, if applicable.
|
||||||
|
*/
|
||||||
|
enum hwloc_distances_kind_e {
|
||||||
|
/** \brief These distances were obtained from the operating system or hardware.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_DISTANCES_KIND_FROM_OS = (1UL<<0),
|
||||||
|
/** \brief These distances were provided by the user.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_DISTANCES_KIND_FROM_USER = (1UL<<1),
|
||||||
|
|
||||||
|
/** \brief Distance values are similar to latencies between objects.
|
||||||
|
* Values are smaller for closer objects, hence minimal on the diagonal
|
||||||
|
* of the matrix (distance between an object and itself).
|
||||||
|
* It could also be the number of network hops between objects, etc.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_DISTANCES_KIND_MEANS_LATENCY = (1UL<<2),
|
||||||
|
/** \brief Distance values are similar to bandwidths between objects.
|
||||||
|
* Values are higher for closer objects, hence maximal on the diagonal
|
||||||
|
* of the matrix (distance between an object and itself).
|
||||||
|
* Such values are currently ignored for distance-based grouping.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH = (1UL<<3)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Retrieve distance matrices.
|
||||||
|
*
|
||||||
|
* Retrieve distance matrices from the topology into the \p distances array.
|
||||||
|
*
|
||||||
|
* \p flags is currently unused, should be \c 0.
|
||||||
|
*
|
||||||
|
* \p kind serves as a filter. If \c 0, all distance matrices are returned.
|
||||||
|
* If it contains some HWLOC_DISTANCES_KIND_FROM_*, only distance matrices
|
||||||
|
* whose kind matches one of these are returned.
|
||||||
|
* If it contains some HWLOC_DISTANCES_KIND_MEANS_*, only distance matrices
|
||||||
|
* whose kind matches one of these are returned.
|
||||||
|
*
|
||||||
|
* On input, \p nr points to the number of distance matrices that may be stored
|
||||||
|
* in \p distances.
|
||||||
|
* On output, \p nr points to the number of distance matrices that were actually
|
||||||
|
* found, even if some of them couldn't be stored in \p distances.
|
||||||
|
* Distance matrices that couldn't be stored are ignored, but the function still
|
||||||
|
* returns success (\c 0). The caller may find out by comparing the value pointed
|
||||||
|
* by \p nr before and after the function call.
|
||||||
|
*
|
||||||
|
* Each distance matrix returned in the \p distances array should be released
|
||||||
|
* by the caller using hwloc_distances_release().
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int
|
||||||
|
hwloc_distances_get(hwloc_topology_t topology,
|
||||||
|
unsigned *nr, struct hwloc_distances_s **distances,
|
||||||
|
unsigned long kind, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Retrieve distance matrices for object at a specific depth in the topology.
|
||||||
|
*
|
||||||
|
* Identical to hwloc_distances_get() with the additional \p depth filter.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int
|
||||||
|
hwloc_distances_get_by_depth(hwloc_topology_t topology, int depth,
|
||||||
|
unsigned *nr, struct hwloc_distances_s **distances,
|
||||||
|
unsigned long kind, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Retrieve distance matrices for object of a specific type.
|
||||||
|
*
|
||||||
|
* Identical to hwloc_distances_get() with the additional \p type filter.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_distances_get_by_type(hwloc_topology_t topology, hwloc_obj_type_t type,
|
||||||
|
unsigned *nr, struct hwloc_distances_s **distances,
|
||||||
|
unsigned long kind, unsigned long flags)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE) {
|
||||||
|
*nr = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return hwloc_distances_get_by_depth(topology, depth, nr, distances, kind, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Release a distance matrix structure previously returned by hwloc_distances_get(). */
|
||||||
|
HWLOC_DECLSPEC void
|
||||||
|
hwloc_distances_release(hwloc_topology_t topology, struct hwloc_distances_s *distances);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_distances_consult Helpers for consulting distance matrices
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \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 distance matrices.
|
||||||
|
*
|
||||||
|
* 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_add_flag_e {
|
||||||
|
/** \brief Try to group objects based on the newly provided distance information.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
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_ADD_FLAG_GROUP_INACCURATE = (1UL<<1)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Provide a new distance matrix.
|
||||||
|
*
|
||||||
|
* Provide the matrix of distances between a set of objects given by \p nbobjs
|
||||||
|
* and the \p objs array. \p nbobjs must be at least 2.
|
||||||
|
* The distances are stored as a one-dimension array in \p values.
|
||||||
|
* The distance from object i to object j is in slot i*nbobjs+j.
|
||||||
|
*
|
||||||
|
* \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_add_flag_e.
|
||||||
|
*
|
||||||
|
* Objects must be of the same type. They cannot be of type Group.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_distances_add(hwloc_topology_t topology,
|
||||||
|
unsigned nbobjs, hwloc_obj_t *objs, hwloc_uint64_t *values,
|
||||||
|
unsigned long kind, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Remove all distance matrices from a topology.
|
||||||
|
*
|
||||||
|
* Remove all distance matrices, either provided by the user or
|
||||||
|
* gathered through the OS.
|
||||||
|
*
|
||||||
|
* If these distances were used to group objects, these additional
|
||||||
|
*Group objects are not removed from the topology.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_distances_remove(hwloc_topology_t topology);
|
||||||
|
|
||||||
|
/** \brief Remove distance matrices for objects at a specific depth in the topology.
|
||||||
|
*
|
||||||
|
* Identical to hwloc_distances_remove() but only applies to one level of the topology.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_distances_remove_by_depth(hwloc_topology_t topology, int depth);
|
||||||
|
|
||||||
|
/** \brief Remove distance matrices for objects of a specific type in the topology.
|
||||||
|
*
|
||||||
|
* Identical to hwloc_distances_remove() but only applies to one level of the topology.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_distances_remove_by_type(hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||||
|
return 0;
|
||||||
|
return hwloc_distances_remove_by_depth(topology, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_DISTANCES_H */
|
||||||
278
src/3rdparty/hwloc/include/hwloc/export.h
vendored
Normal file
278
src/3rdparty/hwloc/include/hwloc/export.h
vendored
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2012 Université Bordeaux
|
||||||
|
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Exporting Topologies to XML or to Synthetic strings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_EXPORT_H
|
||||||
|
#define HWLOC_EXPORT_H
|
||||||
|
|
||||||
|
#ifndef HWLOC_H
|
||||||
|
#error Please include the main hwloc.h instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#elif 0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_xmlexport Exporting Topologies to XML
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Flags for exporting XML topologies.
|
||||||
|
*
|
||||||
|
* Flags to be given as a OR'ed set to hwloc_topology_export_xml().
|
||||||
|
*/
|
||||||
|
enum hwloc_topology_export_xml_flags_e {
|
||||||
|
/** \brief Export XML that is loadable by hwloc v1.x.
|
||||||
|
* However, the export may miss some details about the topology.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 = (1UL<<0)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Export the topology into an XML file.
|
||||||
|
*
|
||||||
|
* This file may be loaded later through hwloc_topology_set_xml().
|
||||||
|
*
|
||||||
|
* By default, the latest export format is used, which means older hwloc
|
||||||
|
* releases (e.g. v1.x) will not be able to import it.
|
||||||
|
* Exporting to v1.x specific XML format is possible using flag
|
||||||
|
* ::HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 but it may miss some details
|
||||||
|
* about the topology.
|
||||||
|
* If there is any chance that the exported file may ever be imported
|
||||||
|
* back by a process using hwloc 1.x, one should consider detecting
|
||||||
|
* it at runtime and using the corresponding export format.
|
||||||
|
*
|
||||||
|
* \p flags is a OR'ed set of ::hwloc_topology_export_xml_flags_e.
|
||||||
|
*
|
||||||
|
* \return -1 if a failure occured.
|
||||||
|
*
|
||||||
|
* \note See also hwloc_topology_set_userdata_export_callback()
|
||||||
|
* for exporting application-specific object userdata.
|
||||||
|
*
|
||||||
|
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||||
|
*
|
||||||
|
* \note Only printable characters may be exported to XML string attributes.
|
||||||
|
* Any other character, especially any non-ASCII character, will be silently
|
||||||
|
* dropped.
|
||||||
|
*
|
||||||
|
* \note If \p name is "-", the XML output is sent to the standard output.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_export_xml(hwloc_topology_t topology, const char *xmlpath, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Export the topology into a newly-allocated XML memory buffer.
|
||||||
|
*
|
||||||
|
* \p xmlbuffer is allocated by the callee and should be freed with
|
||||||
|
* hwloc_free_xmlbuffer() later in the caller.
|
||||||
|
*
|
||||||
|
* This memory buffer may be loaded later through hwloc_topology_set_xmlbuffer().
|
||||||
|
*
|
||||||
|
* By default, the latest export format is used, which means older hwloc
|
||||||
|
* releases (e.g. v1.x) will not be able to import it.
|
||||||
|
* Exporting to v1.x specific XML format is possible using flag
|
||||||
|
* ::HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 but it may miss some details
|
||||||
|
* about the topology.
|
||||||
|
* If there is any chance that the exported buffer may ever be imported
|
||||||
|
* back by a process using hwloc 1.x, one should consider detecting
|
||||||
|
* it at runtime and using the corresponding export format.
|
||||||
|
*
|
||||||
|
* The returned buffer ends with a \0 that is included in the returned
|
||||||
|
* length.
|
||||||
|
*
|
||||||
|
* \p flags is a OR'ed set of ::hwloc_topology_export_xml_flags_e.
|
||||||
|
*
|
||||||
|
* \return -1 if a failure occured.
|
||||||
|
*
|
||||||
|
* \note See also hwloc_topology_set_userdata_export_callback()
|
||||||
|
* for exporting application-specific object userdata.
|
||||||
|
*
|
||||||
|
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||||
|
*
|
||||||
|
* \note Only printable characters may be exported to XML string attributes.
|
||||||
|
* Any other character, especially any non-ASCII character, will be silently
|
||||||
|
* dropped.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_export_xmlbuffer(hwloc_topology_t topology, char **xmlbuffer, int *buflen, unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Free a buffer allocated by hwloc_topology_export_xmlbuffer() */
|
||||||
|
HWLOC_DECLSPEC void hwloc_free_xmlbuffer(hwloc_topology_t topology, char *xmlbuffer);
|
||||||
|
|
||||||
|
/** \brief Set the application-specific callback for exporting object userdata
|
||||||
|
*
|
||||||
|
* The object userdata pointer is not exported to XML by default because hwloc
|
||||||
|
* does not know what it contains.
|
||||||
|
*
|
||||||
|
* This function lets applications set \p export_cb to a callback function
|
||||||
|
* that converts this opaque userdata into an exportable string.
|
||||||
|
*
|
||||||
|
* \p export_cb is invoked during XML export for each object whose
|
||||||
|
* \p userdata pointer is not \c NULL.
|
||||||
|
* The callback should use hwloc_export_obj_userdata() or
|
||||||
|
* hwloc_export_obj_userdata_base64() to actually export
|
||||||
|
* something to XML (possibly multiple times per object).
|
||||||
|
*
|
||||||
|
* \p export_cb may be set to \c NULL if userdata should not be exported to XML.
|
||||||
|
*
|
||||||
|
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC void hwloc_topology_set_userdata_export_callback(hwloc_topology_t topology,
|
||||||
|
void (*export_cb)(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj));
|
||||||
|
|
||||||
|
/** \brief Export some object userdata to XML
|
||||||
|
*
|
||||||
|
* This function may only be called from within the export() callback passed
|
||||||
|
* to hwloc_topology_set_userdata_export_callback().
|
||||||
|
* It may be invoked one of multiple times to export some userdata to XML.
|
||||||
|
* The \p buffer content of length \p length is stored with optional name
|
||||||
|
* \p name.
|
||||||
|
*
|
||||||
|
* When importing this XML file, the import() callback (if set) will be
|
||||||
|
* called exactly as many times as hwloc_export_obj_userdata() was called
|
||||||
|
* during export(). It will receive the corresponding \p name, \p buffer
|
||||||
|
* and \p length arguments.
|
||||||
|
*
|
||||||
|
* \p reserved, \p topology and \p obj must be the first three parameters
|
||||||
|
* that were given to the export callback.
|
||||||
|
*
|
||||||
|
* Only printable characters may be exported to XML string attributes.
|
||||||
|
* If a non-printable character is passed in \p name or \p buffer,
|
||||||
|
* the function returns -1 with errno set to EINVAL.
|
||||||
|
*
|
||||||
|
* If exporting binary data, the application should first encode into
|
||||||
|
* printable characters only (or use hwloc_export_obj_userdata_base64()).
|
||||||
|
* It should also take care of portability issues if the export may
|
||||||
|
* be reimported on a different architecture.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_export_obj_userdata(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length);
|
||||||
|
|
||||||
|
/** \brief Encode and export some object userdata to XML
|
||||||
|
*
|
||||||
|
* This function is similar to hwloc_export_obj_userdata() but it encodes
|
||||||
|
* the input buffer into printable characters before exporting.
|
||||||
|
* On import, decoding is automatically performed before the data is given
|
||||||
|
* to the import() callback if any.
|
||||||
|
*
|
||||||
|
* This function may only be called from within the export() callback passed
|
||||||
|
* to hwloc_topology_set_userdata_export_callback().
|
||||||
|
*
|
||||||
|
* The function does not take care of portability issues if the export
|
||||||
|
* may be reimported on a different architecture.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_export_obj_userdata_base64(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length);
|
||||||
|
|
||||||
|
/** \brief Set the application-specific callback for importing userdata
|
||||||
|
*
|
||||||
|
* On XML import, userdata is ignored by default because hwloc does not know
|
||||||
|
* how to store it in memory.
|
||||||
|
*
|
||||||
|
* This function lets applications set \p import_cb to a callback function
|
||||||
|
* that will get the XML-stored userdata and store it in the object as expected
|
||||||
|
* by the application.
|
||||||
|
*
|
||||||
|
* \p import_cb is called during hwloc_topology_load() as many times as
|
||||||
|
* hwloc_export_obj_userdata() was called during export. The topology
|
||||||
|
* is not entirely setup yet. Object attributes are ready to consult,
|
||||||
|
* but links between objects are not.
|
||||||
|
*
|
||||||
|
* \p import_cb may be \c NULL if userdata should be ignored during import.
|
||||||
|
*
|
||||||
|
* \note \p buffer contains \p length characters followed by a null byte ('\0').
|
||||||
|
*
|
||||||
|
* \note This function should be called before hwloc_topology_load().
|
||||||
|
*
|
||||||
|
* \note The topology-specific userdata pointer is ignored when importing from XML.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC void hwloc_topology_set_userdata_import_callback(hwloc_topology_t topology,
|
||||||
|
void (*import_cb)(hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length));
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_syntheticexport Exporting Topologies to Synthetic
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Flags for exporting synthetic topologies.
|
||||||
|
*
|
||||||
|
* Flags to be given as a OR'ed set to hwloc_topology_export_synthetic().
|
||||||
|
*/
|
||||||
|
enum hwloc_topology_export_synthetic_flags_e {
|
||||||
|
/** \brief Export extended types such as L2dcache as basic types such as Cache.
|
||||||
|
*
|
||||||
|
* This is required if loading the synthetic description with hwloc < 1.9.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES = (1UL<<0),
|
||||||
|
|
||||||
|
/** \brief Do not export level attributes.
|
||||||
|
*
|
||||||
|
* Ignore level attributes such as memory/cache sizes or PU indexes.
|
||||||
|
* This is required if loading the synthetic description with hwloc < 1.10.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS = (1UL<<1),
|
||||||
|
|
||||||
|
/** \brief Export the memory hierarchy as expected in hwloc 1.x.
|
||||||
|
*
|
||||||
|
* Instead of attaching memory children to levels, export single NUMA node child
|
||||||
|
* as normal intermediate levels, when possible.
|
||||||
|
* This is required if loading the synthetic description with hwloc 1.x.
|
||||||
|
* However this may fail if some objects have multiple local NUMA nodes.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1 = (1UL<<2),
|
||||||
|
|
||||||
|
/** \brief Do not export memory information.
|
||||||
|
*
|
||||||
|
* Only export the actual hierarchy of normal CPU-side objects and ignore
|
||||||
|
* where memory is attached.
|
||||||
|
* This is useful for when the hierarchy of CPUs is what really matters,
|
||||||
|
* but it behaves as if there was a single machine-wide NUMA node.
|
||||||
|
* \hideinitializer
|
||||||
|
*/
|
||||||
|
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY = (1UL<<3)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Export the topology as a synthetic string.
|
||||||
|
*
|
||||||
|
* At most \p buflen characters will be written in \p buffer,
|
||||||
|
* including the terminating \0.
|
||||||
|
*
|
||||||
|
* This exported string may be given back to hwloc_topology_set_synthetic().
|
||||||
|
*
|
||||||
|
* \p flags is a OR'ed set of ::hwloc_topology_export_synthetic_flags_e.
|
||||||
|
*
|
||||||
|
* \return The number of characters that were written,
|
||||||
|
* not including the terminating \0.
|
||||||
|
*
|
||||||
|
* \return -1 if the topology could not be exported,
|
||||||
|
* for instance if it is not symmetric.
|
||||||
|
*
|
||||||
|
* \note I/O and Misc children are ignored, the synthetic string only
|
||||||
|
* describes normal children.
|
||||||
|
*
|
||||||
|
* \note A 1024-byte buffer should be large enough for exporting
|
||||||
|
* topologies in the vast majority of cases.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_export_synthetic(hwloc_topology_t topology, char *buffer, size_t buflen, unsigned long flags);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_EXPORT_H */
|
||||||
135
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
Normal file
135
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2012 Blue Brain Project, EPFL. All rights reserved.
|
||||||
|
* Copyright © 2012-2013 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and OpenGL displays.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and OpenGL may want to include
|
||||||
|
* this file so as to get topology information for OpenGL displays.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_GL_H
|
||||||
|
#define HWLOC_GL_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_gl Interoperability with OpenGL displays
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* OpenGL displays.
|
||||||
|
*
|
||||||
|
* Only the NVIDIA display locality information is currently available,
|
||||||
|
* using the NV-CONTROL X11 extension and the NVCtrl library.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* OpenGL display given by port and device index.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the OpenGL display
|
||||||
|
* whose port (server) is \p port and device (screen) is \p device.
|
||||||
|
* Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the GL component must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_gl_get_display_osdev_by_port_device(hwloc_topology_t topology,
|
||||||
|
unsigned port, unsigned device)
|
||||||
|
{
|
||||||
|
unsigned x = (unsigned) -1, y = (unsigned) -1;
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& sscanf(osdev->name, ":%u.%u", &x, &y) == 2
|
||||||
|
&& port == x && device == y)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* OpenGL display given by name.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the OpenGL display
|
||||||
|
* whose name is \p name, built as ":port.device" such as ":0.0" .
|
||||||
|
* Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the GL component must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_gl_get_display_osdev_by_name(hwloc_topology_t topology,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& !strcmp(name, osdev->name))
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the OpenGL display port and device corresponding
|
||||||
|
* to the given hwloc OS object.
|
||||||
|
*
|
||||||
|
* Return the OpenGL display port (server) in \p port and device (screen)
|
||||||
|
* in \p screen that correspond to the given hwloc OS device object.
|
||||||
|
* Return \c -1 if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the GL component must be enabled in the topology.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_gl_get_display_by_osdev(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
hwloc_obj_t osdev,
|
||||||
|
unsigned *port, unsigned *device)
|
||||||
|
{
|
||||||
|
unsigned x = -1, y = -1;
|
||||||
|
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||||
|
&& sscanf(osdev->name, ":%u.%u", &x, &y) == 2) {
|
||||||
|
*port = x;
|
||||||
|
*device = y;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_GL_H */
|
||||||
|
|
||||||
125
src/3rdparty/hwloc/include/hwloc/glibc-sched.h
vendored
Normal file
125
src/3rdparty/hwloc/include/hwloc/glibc-sched.h
vendored
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2013 inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2011 Université Bordeaux
|
||||||
|
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and glibc scheduling routines.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and glibc scheduling routines such as
|
||||||
|
* sched_getaffinity() or pthread_attr_setaffinity_np() may want to include
|
||||||
|
* this file so as to ease conversion between their respective types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_GLIBC_SCHED_H
|
||||||
|
#define HWLOC_GLIBC_SCHED_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#if !defined _GNU_SOURCE || !defined _SCHED_H || (!defined CPU_SETSIZE && !defined sched_priority)
|
||||||
|
#error Please make sure to include sched.h before including glibc-sched.h, and define _GNU_SOURCE before any inclusion of sched.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HWLOC_HAVE_CPU_SET
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_glibc_sched Interoperability with glibc sched affinity
|
||||||
|
*
|
||||||
|
* This interface offers ways to convert between hwloc cpusets and glibc cpusets
|
||||||
|
* such as those manipulated by sched_getaffinity() or pthread_attr_setaffinity_np().
|
||||||
|
*
|
||||||
|
* \note Topology \p topology must match the current machine.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Convert hwloc CPU set \p toposet into glibc sched affinity CPU set \p schedset
|
||||||
|
*
|
||||||
|
* This function may be used before calling sched_setaffinity or any other function
|
||||||
|
* that takes a cpu_set_t as input parameter.
|
||||||
|
*
|
||||||
|
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cpuset_to_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t hwlocset,
|
||||||
|
cpu_set_t *schedset, size_t schedsetsize)
|
||||||
|
{
|
||||||
|
#ifdef CPU_ZERO_S
|
||||||
|
unsigned cpu;
|
||||||
|
CPU_ZERO_S(schedsetsize, schedset);
|
||||||
|
hwloc_bitmap_foreach_begin(cpu, hwlocset)
|
||||||
|
CPU_SET_S(cpu, schedsetsize, schedset);
|
||||||
|
hwloc_bitmap_foreach_end();
|
||||||
|
#else /* !CPU_ZERO_S */
|
||||||
|
unsigned cpu;
|
||||||
|
CPU_ZERO(schedset);
|
||||||
|
assert(schedsetsize == sizeof(cpu_set_t));
|
||||||
|
hwloc_bitmap_foreach_begin(cpu, hwlocset)
|
||||||
|
CPU_SET(cpu, schedset);
|
||||||
|
hwloc_bitmap_foreach_end();
|
||||||
|
#endif /* !CPU_ZERO_S */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert glibc sched affinity CPU set \p schedset into hwloc CPU set
|
||||||
|
*
|
||||||
|
* This function may be used before calling sched_setaffinity or any other function
|
||||||
|
* that takes a cpu_set_t as input parameter.
|
||||||
|
*
|
||||||
|
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_cpuset_t hwlocset,
|
||||||
|
const cpu_set_t *schedset, size_t schedsetsize)
|
||||||
|
{
|
||||||
|
int cpu;
|
||||||
|
#ifdef CPU_ZERO_S
|
||||||
|
int count;
|
||||||
|
#endif
|
||||||
|
hwloc_bitmap_zero(hwlocset);
|
||||||
|
#ifdef CPU_ZERO_S
|
||||||
|
count = CPU_COUNT_S(schedsetsize, schedset);
|
||||||
|
cpu = 0;
|
||||||
|
while (count) {
|
||||||
|
if (CPU_ISSET_S(cpu, schedsetsize, schedset)) {
|
||||||
|
hwloc_bitmap_set(hwlocset, cpu);
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
cpu++;
|
||||||
|
}
|
||||||
|
#else /* !CPU_ZERO_S */
|
||||||
|
/* sched.h does not support dynamic cpu_set_t (introduced in glibc 2.7),
|
||||||
|
* assume we have a very old interface without CPU_COUNT (added in 2.6)
|
||||||
|
*/
|
||||||
|
assert(schedsetsize == sizeof(cpu_set_t));
|
||||||
|
for(cpu=0; cpu<CPU_SETSIZE; cpu++)
|
||||||
|
if (CPU_ISSET(cpu, schedset))
|
||||||
|
hwloc_bitmap_set(hwlocset, cpu);
|
||||||
|
#endif /* !CPU_ZERO_S */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CPU_SET */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_GLIBC_SCHED_H */
|
||||||
1160
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
Normal file
1160
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
146
src/3rdparty/hwloc/include/hwloc/inlines.h
vendored
Normal file
146
src/3rdparty/hwloc/include/hwloc/inlines.h
vendored
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2012 Université Bordeaux
|
||||||
|
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains the inline code of functions declared in hwloc.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_INLINES_H
|
||||||
|
#define HWLOC_INLINES_H
|
||||||
|
|
||||||
|
#ifndef HWLOC_H
|
||||||
|
#error Please include the main hwloc.h instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
|
||||||
|
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||||
|
return depth;
|
||||||
|
|
||||||
|
/* find the highest existing level with type order >= */
|
||||||
|
for(depth = hwloc_get_type_depth(topology, HWLOC_OBJ_PU); ; depth--)
|
||||||
|
if (hwloc_compare_types(hwloc_get_depth_type(topology, depth), type) < 0)
|
||||||
|
return depth+1;
|
||||||
|
|
||||||
|
/* Shouldn't ever happen, as there is always a Machine level with lower order and known depth. */
|
||||||
|
/* abort(); */
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
|
||||||
|
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||||
|
return depth;
|
||||||
|
|
||||||
|
/* find the lowest existing level with type order <= */
|
||||||
|
for(depth = 0; ; depth++)
|
||||||
|
if (hwloc_compare_types(hwloc_get_depth_type(topology, depth), type) > 0)
|
||||||
|
return depth-1;
|
||||||
|
|
||||||
|
/* Shouldn't ever happen, as there is always a PU level with higher order and known depth. */
|
||||||
|
/* abort(); */
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||||
|
return 0;
|
||||||
|
if (depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||||
|
return -1; /* FIXME: agregate nbobjs from different levels? */
|
||||||
|
return (int) hwloc_get_nbobjs_by_depth(topology, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
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, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_get_next_obj_by_depth (hwloc_topology_t topology, int depth, hwloc_obj_t prev)
|
||||||
|
{
|
||||||
|
if (!prev)
|
||||||
|
return hwloc_get_obj_by_depth (topology, depth, 0);
|
||||||
|
if (prev->depth != depth)
|
||||||
|
return NULL;
|
||||||
|
return prev->next_cousin;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_get_next_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type,
|
||||||
|
hwloc_obj_t prev)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, type);
|
||||||
|
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||||
|
return NULL;
|
||||||
|
return hwloc_get_next_obj_by_depth (topology, depth, prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_get_root_obj (hwloc_topology_t topology)
|
||||||
|
{
|
||||||
|
return hwloc_get_obj_by_depth (topology, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline const char *
|
||||||
|
hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for(i=0; i<obj->infos_count; i++) {
|
||||||
|
struct hwloc_info_s *info = &obj->infos[i];
|
||||||
|
if (!strcmp(info->name, name))
|
||||||
|
return info->value;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __hwloc_inline void *
|
||||||
|
hwloc_alloc_membind_policy(hwloc_topology_t topology, size_t len, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
|
||||||
|
{
|
||||||
|
void *p = hwloc_alloc_membind(topology, len, set, policy, flags);
|
||||||
|
if (p)
|
||||||
|
return p;
|
||||||
|
|
||||||
|
if (hwloc_set_membind(topology, set, policy, flags) < 0)
|
||||||
|
/* hwloc_set_membind() takes care of ignoring errors if non-STRICT */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
p = hwloc_alloc(topology, len);
|
||||||
|
if (p && policy != HWLOC_MEMBIND_FIRSTTOUCH)
|
||||||
|
/* Enforce the binding by touching the data */
|
||||||
|
memset(p, 0, len);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_INLINES_H */
|
||||||
134
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
Normal file
134
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2013-2016 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and Intel Xeon Phi (MIC).
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and Intel Xeon Phi (MIC) may want to
|
||||||
|
* include this file so as to get topology information for MIC devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_INTEL_MIC_H
|
||||||
|
#define HWLOC_INTEL_MIC_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_intel_mic Interoperability with Intel Xeon Phi (MIC)
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* Intel Xeon Phi (MIC) devices.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to MIC device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the MIC device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device index \p idx must match the local machine.
|
||||||
|
* I/O devices detection is not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_intel_mic_get_device_osdev_by_index().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux; other systems will simply get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_intel_mic_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
int idx __hwloc_attribute_unused,
|
||||||
|
hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||||
|
#define HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX];
|
||||||
|
DIR *sysdir = NULL;
|
||||||
|
struct dirent *dirent;
|
||||||
|
unsigned pcibus, pcidev, pcifunc;
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/class/mic/mic%d", idx);
|
||||||
|
sysdir = opendir(path);
|
||||||
|
if (!sysdir)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
while ((dirent = readdir(sysdir)) != NULL) {
|
||||||
|
if (sscanf(dirent->d_name, "pci_%02x:%02x.%02x", &pcibus, &pcidev, &pcifunc) == 3) {
|
||||||
|
sprintf(path, "/sys/class/mic/mic%d/pci_%02x:%02x.%02x/local_cpus", idx, pcibus, pcidev, pcifunc);
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(sysdir);
|
||||||
|
#else
|
||||||
|
/* Non-Linux systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* MIC device for the given index.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the MIC device whose index is \p idx.
|
||||||
|
* Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_intel_mic_get_device_osdev_by_index(hwloc_topology_t topology,
|
||||||
|
unsigned idx)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& !strncmp("mic", osdev->name, 3)
|
||||||
|
&& atoi(osdev->name + 3) == (int) idx)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_INTEL_MIC_H */
|
||||||
273
src/3rdparty/hwloc/include/hwloc/linux-libnuma.h
vendored
Normal file
273
src/3rdparty/hwloc/include/hwloc/linux-libnuma.h
vendored
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2010, 2012 Université Bordeaux
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and Linux libnuma.
|
||||||
|
*
|
||||||
|
* Applications that use both Linux libnuma and hwloc may want to
|
||||||
|
* include this file so as to ease conversion between their respective types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_LINUX_LIBNUMA_H
|
||||||
|
#define HWLOC_LINUX_LIBNUMA_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <numa.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_linux_libnuma_ulongs Interoperability with Linux libnuma unsigned long masks
|
||||||
|
*
|
||||||
|
* This interface helps converting between Linux libnuma unsigned long masks
|
||||||
|
* and hwloc cpusets and nodesets.
|
||||||
|
*
|
||||||
|
* \note Topology \p topology must match the current machine.
|
||||||
|
*
|
||||||
|
* \note The behavior of libnuma is undefined if the kernel is not NUMA-aware.
|
||||||
|
* (when CONFIG_NUMA is not set in the kernel configuration).
|
||||||
|
* This helper and libnuma may thus not be strictly compatible in this case,
|
||||||
|
* which may be detected by checking whether numa_available() returns -1.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Convert hwloc CPU set \p cpuset into the array of unsigned long \p mask
|
||||||
|
*
|
||||||
|
* \p mask is the array of unsigned long that will be filled.
|
||||||
|
* \p maxnode contains the maximal node number that may be stored in \p mask.
|
||||||
|
* \p maxnode will be set to the maximal node number that was found, plus one.
|
||||||
|
*
|
||||||
|
* This function may be used before calling set_mempolicy, mbind, migrate_pages
|
||||||
|
* or any other function that takes an array of unsigned long and a maximal
|
||||||
|
* node number as input parameter.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cpuset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset,
|
||||||
|
unsigned long *mask, unsigned long *maxnode)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
unsigned long outmaxnode = -1;
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
|
||||||
|
/* round-up to the next ulong and clear all bytes */
|
||||||
|
*maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1);
|
||||||
|
memset(mask, 0, *maxnode/8);
|
||||||
|
|
||||||
|
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL) {
|
||||||
|
if (node->os_index >= *maxnode)
|
||||||
|
continue;
|
||||||
|
mask[node->os_index/sizeof(*mask)/8] |= 1UL << (node->os_index % (sizeof(*mask)*8));
|
||||||
|
if (outmaxnode == (unsigned long) -1 || outmaxnode < node->os_index)
|
||||||
|
outmaxnode = node->os_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
*maxnode = outmaxnode+1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert hwloc NUMA node set \p nodeset into the array of unsigned long \p mask
|
||||||
|
*
|
||||||
|
* \p mask is the array of unsigned long that will be filled.
|
||||||
|
* \p maxnode contains the maximal node number that may be stored in \p mask.
|
||||||
|
* \p maxnode will be set to the maximal node number that was found, plus one.
|
||||||
|
*
|
||||||
|
* This function may be used before calling set_mempolicy, mbind, migrate_pages
|
||||||
|
* or any other function that takes an array of unsigned long and a maximal
|
||||||
|
* node number as input parameter.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_nodeset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset,
|
||||||
|
unsigned long *mask, unsigned long *maxnode)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
unsigned long outmaxnode = -1;
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
|
||||||
|
/* round-up to the next ulong and clear all bytes */
|
||||||
|
*maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1);
|
||||||
|
memset(mask, 0, *maxnode/8);
|
||||||
|
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL) {
|
||||||
|
if (node->os_index >= *maxnode)
|
||||||
|
continue;
|
||||||
|
if (!hwloc_bitmap_isset(nodeset, node->os_index))
|
||||||
|
continue;
|
||||||
|
mask[node->os_index/sizeof(*mask)/8] |= 1UL << (node->os_index % (sizeof(*mask)*8));
|
||||||
|
if (outmaxnode == (unsigned long) -1 || outmaxnode < node->os_index)
|
||||||
|
outmaxnode = node->os_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
*maxnode = outmaxnode+1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert the array of unsigned long \p mask into hwloc CPU set
|
||||||
|
*
|
||||||
|
* \p mask is a array of unsigned long that will be read.
|
||||||
|
* \p maxnode contains the maximal node number that may be read in \p mask.
|
||||||
|
*
|
||||||
|
* This function may be used after calling get_mempolicy or any other function
|
||||||
|
* that takes an array of unsigned long as output parameter (and possibly
|
||||||
|
* a maximal node number as input parameter).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cpuset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
|
||||||
|
const unsigned long *mask, unsigned long maxnode)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
hwloc_bitmap_zero(cpuset);
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||||
|
if (node->os_index < maxnode
|
||||||
|
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
|
||||||
|
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert the array of unsigned long \p mask into hwloc NUMA node set
|
||||||
|
*
|
||||||
|
* \p mask is a array of unsigned long that will be read.
|
||||||
|
* \p maxnode contains the maximal node number that may be read in \p mask.
|
||||||
|
*
|
||||||
|
* This function may be used after calling get_mempolicy or any other function
|
||||||
|
* that takes an array of unsigned long as output parameter (and possibly
|
||||||
|
* a maximal node number as input parameter).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_nodeset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_nodeset_t nodeset,
|
||||||
|
const unsigned long *mask, unsigned long maxnode)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
hwloc_bitmap_zero(nodeset);
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||||
|
if (node->os_index < maxnode
|
||||||
|
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
|
||||||
|
hwloc_bitmap_set(nodeset, node->os_index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_linux_libnuma_bitmask Interoperability with Linux libnuma bitmask
|
||||||
|
*
|
||||||
|
* This interface helps converting between Linux libnuma bitmasks
|
||||||
|
* and hwloc cpusets and nodesets.
|
||||||
|
*
|
||||||
|
* \note Topology \p topology must match the current machine.
|
||||||
|
*
|
||||||
|
* \note The behavior of libnuma is undefined if the kernel is not NUMA-aware.
|
||||||
|
* (when CONFIG_NUMA is not set in the kernel configuration).
|
||||||
|
* This helper and libnuma may thus not be strictly compatible in this case,
|
||||||
|
* which may be detected by checking whether numa_available() returns -1.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Convert hwloc CPU set \p cpuset into the returned libnuma bitmask
|
||||||
|
*
|
||||||
|
* The returned bitmask should later be freed with numa_bitmask_free.
|
||||||
|
*
|
||||||
|
* This function may be used before calling many numa_ functions
|
||||||
|
* that use a struct bitmask as an input parameter.
|
||||||
|
*
|
||||||
|
* \return newly allocated struct bitmask.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline struct bitmask *
|
||||||
|
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset) __hwloc_attribute_malloc;
|
||||||
|
static __hwloc_inline struct bitmask *
|
||||||
|
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
struct bitmask *bitmask = numa_allocate_cpumask();
|
||||||
|
if (!bitmask)
|
||||||
|
return NULL;
|
||||||
|
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL)
|
||||||
|
if (node->attr->numanode.local_memory)
|
||||||
|
numa_bitmask_setbit(bitmask, node->os_index);
|
||||||
|
return bitmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert hwloc NUMA node set \p nodeset into the returned libnuma bitmask
|
||||||
|
*
|
||||||
|
* The returned bitmask should later be freed with numa_bitmask_free.
|
||||||
|
*
|
||||||
|
* This function may be used before calling many numa_ functions
|
||||||
|
* that use a struct bitmask as an input parameter.
|
||||||
|
*
|
||||||
|
* \return newly allocated struct bitmask.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline struct bitmask *
|
||||||
|
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset) __hwloc_attribute_malloc;
|
||||||
|
static __hwloc_inline struct bitmask *
|
||||||
|
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
struct bitmask *bitmask = numa_allocate_cpumask();
|
||||||
|
if (!bitmask)
|
||||||
|
return NULL;
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||||
|
if (hwloc_bitmap_isset(nodeset, node->os_index) && node->attr->numanode.local_memory)
|
||||||
|
numa_bitmask_setbit(bitmask, node->os_index);
|
||||||
|
return bitmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert libnuma bitmask \p bitmask into hwloc CPU set \p cpuset
|
||||||
|
*
|
||||||
|
* This function may be used after calling many numa_ functions
|
||||||
|
* that use a struct bitmask as an output parameter.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_cpuset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
|
||||||
|
const struct bitmask *bitmask)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
hwloc_bitmap_zero(cpuset);
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||||
|
if (numa_bitmask_isbitset(bitmask, node->os_index))
|
||||||
|
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Convert libnuma bitmask \p bitmask into hwloc NUMA node set \p nodeset
|
||||||
|
*
|
||||||
|
* This function may be used after calling many numa_ functions
|
||||||
|
* that use a struct bitmask as an output parameter.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_nodeset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_nodeset_t nodeset,
|
||||||
|
const struct bitmask *bitmask)
|
||||||
|
{
|
||||||
|
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||||
|
hwloc_obj_t node = NULL;
|
||||||
|
hwloc_bitmap_zero(nodeset);
|
||||||
|
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||||
|
if (numa_bitmask_isbitset(bitmask, node->os_index))
|
||||||
|
hwloc_bitmap_set(nodeset, node->os_index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_LINUX_NUMA_H */
|
||||||
79
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
Normal file
79
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2016 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2011 Université Bordeaux
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and Linux.
|
||||||
|
*
|
||||||
|
* Applications that use hwloc on Linux may want to include this file
|
||||||
|
* if using some low-level Linux features.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_LINUX_H
|
||||||
|
#define HWLOC_LINUX_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_linux Linux-specific helpers
|
||||||
|
*
|
||||||
|
* This includes helpers for manipulating Linux kernel cpumap files, and hwloc
|
||||||
|
* equivalents of the Linux sched_setaffinity and sched_getaffinity system calls.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Bind a thread \p tid on cpus given in cpuset \p set
|
||||||
|
*
|
||||||
|
* The behavior is exactly the same as the Linux sched_setaffinity system call,
|
||||||
|
* but uses a hwloc cpuset.
|
||||||
|
*
|
||||||
|
* \note This is equivalent to calling hwloc_set_proc_cpubind() with
|
||||||
|
* HWLOC_CPUBIND_THREAD as flags.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_linux_set_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_const_cpuset_t set);
|
||||||
|
|
||||||
|
/** \brief Get the current binding of thread \p tid
|
||||||
|
*
|
||||||
|
* The behavior is exactly the same as the Linux sched_getaffinity system call,
|
||||||
|
* but uses a hwloc cpuset.
|
||||||
|
*
|
||||||
|
* \note This is equivalent to calling hwloc_get_proc_cpubind() with
|
||||||
|
* ::HWLOC_CPUBIND_THREAD as flags.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_linux_get_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_cpuset_t set);
|
||||||
|
|
||||||
|
/** \brief Get the last physical CPU where thread \p tid ran.
|
||||||
|
*
|
||||||
|
* \note This is equivalent to calling hwloc_get_proc_last_cpu_location() with
|
||||||
|
* ::HWLOC_CPUBIND_THREAD as flags.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_linux_get_tid_last_cpu_location(hwloc_topology_t topology, pid_t tid, hwloc_bitmap_t set);
|
||||||
|
|
||||||
|
/** \brief Convert a linux kernel cpumask file \p path into a hwloc bitmap \p set.
|
||||||
|
*
|
||||||
|
* Might be used when reading CPU set from sysfs attributes such as topology
|
||||||
|
* and caches for processors, or local_cpus for devices.
|
||||||
|
*
|
||||||
|
* \note This function ignores the HWLOC_FSROOT environment variable.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_linux_read_path_as_cpumask(const char *path, hwloc_bitmap_t set);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_LINUX_H */
|
||||||
181
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
Normal file
181
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2012-2016 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and the NVIDIA Management Library.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and the NVIDIA Management Library may want to
|
||||||
|
* include this file so as to get topology information for NVML devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_NVML_H
|
||||||
|
#define HWLOC_NVML_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <nvml.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_nvml Interoperability with the NVIDIA Management Library
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* devices managed by the NVIDIA Management Library (NVML).
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to NVML device \p device.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the NVML device \p device.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p device must match the local machine.
|
||||||
|
* I/O devices detection and the NVML component are not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_nvml_get_device_osdev()
|
||||||
|
* and hwloc_nvml_get_device_osdev_by_index().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux; other systems will simply get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_nvml_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
nvmlDevice_t device, hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||||
|
#define HWLOC_NVML_DEVICE_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_NVML_DEVICE_SYSFS_PATH_MAX];
|
||||||
|
nvmlReturn_t nvres;
|
||||||
|
nvmlPciInfo_t pci;
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvres = nvmlDeviceGetPciInfo(device, &pci);
|
||||||
|
if (NVML_SUCCESS != nvres) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", pci.domain, pci.bus, pci.device);
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#else
|
||||||
|
/* Non-Linux systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* NVML device whose index is \p idx.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the NVML device whose
|
||||||
|
* index is \p idx. Returns NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the NVML component must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_nvml_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& !strncmp("nvml", osdev->name, 4)
|
||||||
|
&& atoi(osdev->name + 4) == (int) idx)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to NVML device \p device.
|
||||||
|
*
|
||||||
|
* Return the hwloc OS device object that describes the given
|
||||||
|
* NVML device \p device. Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p device must match the local machine.
|
||||||
|
* I/O devices detection and the NVML component must be enabled in the topology.
|
||||||
|
* If not, the locality of the object may still be found using
|
||||||
|
* hwloc_nvml_get_device_cpuset().
|
||||||
|
*
|
||||||
|
* \note The corresponding hwloc PCI device may be found by looking
|
||||||
|
* at the result parent pointer (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_nvml_get_device_osdev(hwloc_topology_t topology, nvmlDevice_t device)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev;
|
||||||
|
nvmlReturn_t nvres;
|
||||||
|
nvmlPciInfo_t pci;
|
||||||
|
char uuid[64];
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvres = nvmlDeviceGetPciInfo(device, &pci);
|
||||||
|
if (NVML_SUCCESS != nvres)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
nvres = nvmlDeviceGetUUID(device, uuid, sizeof(uuid));
|
||||||
|
if (NVML_SUCCESS != nvres)
|
||||||
|
uuid[0] = '\0';
|
||||||
|
|
||||||
|
osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
hwloc_obj_t pcidev = osdev->parent;
|
||||||
|
const char *info;
|
||||||
|
|
||||||
|
if (strncmp(osdev->name, "nvml", 4))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pcidev
|
||||||
|
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||||
|
&& pcidev->attr->pcidev.domain == pci.domain
|
||||||
|
&& pcidev->attr->pcidev.bus == pci.bus
|
||||||
|
&& pcidev->attr->pcidev.dev == pci.device
|
||||||
|
&& pcidev->attr->pcidev.func == 0)
|
||||||
|
return osdev;
|
||||||
|
|
||||||
|
info = hwloc_obj_get_info_by_name(osdev, "NVIDIAUUID");
|
||||||
|
if (info && !strcmp(info, uuid))
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_NVML_H */
|
||||||
206
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
Normal file
206
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2012-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2013, 2018 Université Bordeaux. All right reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and the OpenCL interface.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and OpenCL may want to
|
||||||
|
* include this file so as to get topology information for OpenCL devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_OPENCL_H
|
||||||
|
#define HWLOC_OPENCL_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#include <hwloc/helper.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <OpenCL/cl.h>
|
||||||
|
#include <OpenCL/cl_ext.h>
|
||||||
|
#else
|
||||||
|
#include <CL/cl.h>
|
||||||
|
#include <CL/cl_ext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_opencl Interoperability with OpenCL
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* OpenCL devices.
|
||||||
|
*
|
||||||
|
* Only the AMD OpenCL interface currently offers useful locality information
|
||||||
|
* about its devices.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to OpenCL device \p device.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the OpenCL device \p device.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p device must match the local machine.
|
||||||
|
* I/O devices detection and the OpenCL component are not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_opencl_get_device_osdev()
|
||||||
|
* and hwloc_opencl_get_device_osdev_by_index().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux with the AMD OpenCL implementation; other systems will simply
|
||||||
|
* get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_opencl_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
cl_device_id device __hwloc_attribute_unused,
|
||||||
|
hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#if (defined HWLOC_LINUX_SYS) && (defined CL_DEVICE_TOPOLOGY_AMD)
|
||||||
|
/* If we're on Linux + AMD OpenCL, use the AMD extension + the sysfs mechanism to get the local cpus */
|
||||||
|
#define HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX];
|
||||||
|
cl_device_topology_amd amdtopo;
|
||||||
|
cl_int clret;
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
|
||||||
|
if (CL_SUCCESS != clret) {
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/bus/pci/devices/0000:%02x:%02x.%01x/local_cpus",
|
||||||
|
(unsigned) amdtopo.pcie.bus, (unsigned) amdtopo.pcie.device, (unsigned) amdtopo.pcie.function);
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#else
|
||||||
|
/* Non-Linux + AMD OpenCL systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the
|
||||||
|
* OpenCL device for the given indexes.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the OpenCL device
|
||||||
|
* whose platform index is \p platform_index,
|
||||||
|
* and whose device index within this platform if \p device_index.
|
||||||
|
* Return NULL if there is none.
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection and the OpenCL component must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_opencl_get_device_osdev_by_index(hwloc_topology_t topology,
|
||||||
|
unsigned platform_index, unsigned device_index)
|
||||||
|
{
|
||||||
|
unsigned x = (unsigned) -1, y = (unsigned) -1;
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||||
|
&& osdev->name
|
||||||
|
&& sscanf(osdev->name, "opencl%ud%u", &x, &y) == 2
|
||||||
|
&& platform_index == x && device_index == y)
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to OpenCL device \p deviceX.
|
||||||
|
*
|
||||||
|
* Use OpenCL device attributes to find the corresponding hwloc OS device object.
|
||||||
|
* Return NULL if there is none or if useful attributes are not available.
|
||||||
|
*
|
||||||
|
* This function currently only works on AMD OpenCL devices that support
|
||||||
|
* the CL_DEVICE_TOPOLOGY_AMD extension. hwloc_opencl_get_device_osdev_by_index()
|
||||||
|
* should be preferred whenever possible, i.e. when platform and device index
|
||||||
|
* are known.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p device must match the local machine.
|
||||||
|
* I/O devices detection and the OpenCL component must be enabled in the topology.
|
||||||
|
* If not, the locality of the object may still be found using
|
||||||
|
* hwloc_opencl_get_device_cpuset().
|
||||||
|
*
|
||||||
|
* \note This function cannot work if PCI devices are filtered out.
|
||||||
|
*
|
||||||
|
* \note The corresponding hwloc PCI device may be found by looking
|
||||||
|
* at the result parent pointer (unless PCI devices are filtered out).
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_opencl_get_device_osdev(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
cl_device_id device __hwloc_attribute_unused)
|
||||||
|
{
|
||||||
|
#ifdef CL_DEVICE_TOPOLOGY_AMD
|
||||||
|
hwloc_obj_t osdev;
|
||||||
|
cl_device_topology_amd amdtopo;
|
||||||
|
cl_int clret;
|
||||||
|
|
||||||
|
clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
|
||||||
|
if (CL_SUCCESS != clret) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
hwloc_obj_t pcidev = osdev->parent;
|
||||||
|
if (strncmp(osdev->name, "opencl", 6))
|
||||||
|
continue;
|
||||||
|
if (pcidev
|
||||||
|
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||||
|
&& pcidev->attr->pcidev.domain == 0
|
||||||
|
&& pcidev->attr->pcidev.bus == amdtopo.pcie.bus
|
||||||
|
&& pcidev->attr->pcidev.dev == amdtopo.pcie.device
|
||||||
|
&& pcidev->attr->pcidev.func == amdtopo.pcie.function)
|
||||||
|
return osdev;
|
||||||
|
/* if PCI are filtered out, we need a info attr to match on */
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_OPENCL_H */
|
||||||
150
src/3rdparty/hwloc/include/hwloc/openfabrics-verbs.h
vendored
Normal file
150
src/3rdparty/hwloc/include/hwloc/openfabrics-verbs.h
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009 CNRS
|
||||||
|
* Copyright © 2009-2016 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009-2010 Université Bordeaux
|
||||||
|
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Macros to help interaction between hwloc and OpenFabrics
|
||||||
|
* verbs.
|
||||||
|
*
|
||||||
|
* Applications that use both hwloc and OpenFabrics verbs may want to
|
||||||
|
* include this file so as to get topology information for OpenFabrics
|
||||||
|
* hardware (InfiniBand, etc).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_OPENFABRICS_VERBS_H
|
||||||
|
#define HWLOC_OPENFABRICS_VERBS_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
#include <hwloc/linux.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <infiniband/verbs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_openfabrics Interoperability with OpenFabrics
|
||||||
|
*
|
||||||
|
* This interface offers ways to retrieve topology information about
|
||||||
|
* OpenFabrics devices (InfiniBand, Omni-Path, usNIC, etc).
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the CPU set of logical processors that are physically
|
||||||
|
* close to device \p ibdev.
|
||||||
|
*
|
||||||
|
* Return the CPU set describing the locality of the OpenFabrics
|
||||||
|
* device \p ibdev (InfiniBand, etc).
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p ibdev must match the local machine.
|
||||||
|
* I/O devices detection is not needed in the topology.
|
||||||
|
*
|
||||||
|
* The function only returns the locality of the device.
|
||||||
|
* If more information about the device is needed, OS objects should
|
||||||
|
* be used instead, see hwloc_ibv_get_device_osdev()
|
||||||
|
* and hwloc_ibv_get_device_osdev_by_name().
|
||||||
|
*
|
||||||
|
* This function is currently only implemented in a meaningful way for
|
||||||
|
* Linux; other systems will simply get a full cpuset.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||||
|
struct ibv_device *ibdev, hwloc_cpuset_t set)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_LINUX_SYS
|
||||||
|
/* If we're on Linux, use the verbs-provided sysfs mechanism to
|
||||||
|
get the local cpus */
|
||||||
|
#define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
|
||||||
|
char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
|
||||||
|
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
|
||||||
|
ibv_get_device_name(ibdev));
|
||||||
|
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||||
|
|| hwloc_bitmap_iszero(set))
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#else
|
||||||
|
/* Non-Linux systems simply get a full cpuset */
|
||||||
|
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the OpenFabrics
|
||||||
|
* device named \p ibname.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the OpenFabrics device
|
||||||
|
* (InfiniBand, Omni-Path, usNIC, etc) whose name is \p ibname
|
||||||
|
* (mlx5_0, hfi1_0, usnic_0, qib0, etc).
|
||||||
|
* Returns NULL if there is none.
|
||||||
|
* The name \p ibname is usually obtained from ibv_get_device_name().
|
||||||
|
*
|
||||||
|
* The topology \p topology does not necessarily have to match the current
|
||||||
|
* machine. For instance the topology may be an XML import of a remote host.
|
||||||
|
* I/O devices detection must be enabled in the topology.
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_ibv_get_device_osdev_by_name(hwloc_topology_t topology,
|
||||||
|
const char *ibname)
|
||||||
|
{
|
||||||
|
hwloc_obj_t osdev = NULL;
|
||||||
|
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||||
|
if (HWLOC_OBJ_OSDEV_OPENFABRICS == osdev->attr->osdev.type
|
||||||
|
&& osdev->name && !strcmp(ibname, osdev->name))
|
||||||
|
return osdev;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Get the hwloc OS device object corresponding to the OpenFabrics
|
||||||
|
* device \p ibdev.
|
||||||
|
*
|
||||||
|
* Return the OS device object describing the OpenFabrics device \p ibdev
|
||||||
|
* (InfiniBand, etc). Returns NULL if there is none.
|
||||||
|
*
|
||||||
|
* Topology \p topology and device \p ibdev must match the local machine.
|
||||||
|
* I/O devices detection must be enabled in the topology.
|
||||||
|
* If not, the locality of the object may still be found using
|
||||||
|
* hwloc_ibv_get_device_cpuset().
|
||||||
|
*
|
||||||
|
* \note The corresponding PCI device object can be obtained by looking
|
||||||
|
* at the OS device parent object.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline hwloc_obj_t
|
||||||
|
hwloc_ibv_get_device_osdev(hwloc_topology_t topology,
|
||||||
|
struct ibv_device *ibdev)
|
||||||
|
{
|
||||||
|
if (!hwloc_topology_is_thissystem(topology)) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return hwloc_ibv_get_device_osdev_by_name(topology, ibv_get_device_name(ibdev));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_OPENFABRICS_VERBS_H */
|
||||||
542
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
Normal file
542
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
Normal file
@@ -0,0 +1,542 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2013-2017 Inria. All rights reserved.
|
||||||
|
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_PLUGINS_H
|
||||||
|
#define HWLOC_PLUGINS_H
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Public interface for building hwloc plugins.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct hwloc_backend;
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
#ifdef HWLOC_INSIDE_PLUGIN
|
||||||
|
/* needed for hwloc_plugin_check_namespace() */
|
||||||
|
#include <ltdl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_disc_components Components and Plugins: Discovery components
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Discovery component type */
|
||||||
|
typedef enum hwloc_disc_component_type_e {
|
||||||
|
/** \brief CPU-only discovery through the OS, or generic no-OS support.
|
||||||
|
* \hideinitializer */
|
||||||
|
HWLOC_DISC_COMPONENT_TYPE_CPU = (1<<0),
|
||||||
|
|
||||||
|
/** \brief xml or synthetic,
|
||||||
|
* platform-specific components such as bgq.
|
||||||
|
* Anything the discovers CPU and everything else.
|
||||||
|
* No misc backend is expected to complement a global component.
|
||||||
|
* \hideinitializer */
|
||||||
|
HWLOC_DISC_COMPONENT_TYPE_GLOBAL = (1<<1),
|
||||||
|
|
||||||
|
/** \brief OpenCL, Cuda, etc.
|
||||||
|
* \hideinitializer */
|
||||||
|
HWLOC_DISC_COMPONENT_TYPE_MISC = (1<<2)
|
||||||
|
} hwloc_disc_component_type_t;
|
||||||
|
|
||||||
|
/** \brief Discovery component structure
|
||||||
|
*
|
||||||
|
* This is the major kind of components, taking care of the discovery.
|
||||||
|
* They are registered by generic components, either statically-built or as plugins.
|
||||||
|
*/
|
||||||
|
struct hwloc_disc_component {
|
||||||
|
/** \brief Discovery component type */
|
||||||
|
hwloc_disc_component_type_t type;
|
||||||
|
|
||||||
|
/** \brief Name.
|
||||||
|
* If this component is built as a plugin, this name does not have to match the plugin filename.
|
||||||
|
*/
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
/** \brief Component types to exclude, as an OR'ed set of ::hwloc_disc_component_type_e.
|
||||||
|
*
|
||||||
|
* For a GLOBAL component, this usually includes all other types (~0).
|
||||||
|
*
|
||||||
|
* Other components only exclude types that may bring conflicting
|
||||||
|
* topology information. MISC components should likely not be excluded
|
||||||
|
* since they usually bring non-primary additional information.
|
||||||
|
*/
|
||||||
|
unsigned excludes;
|
||||||
|
|
||||||
|
/** \brief Instantiate callback to create a backend from the component.
|
||||||
|
* Parameters data1, data2, data3 are NULL except for components
|
||||||
|
* that have special enabling routines such as hwloc_topology_set_xml(). */
|
||||||
|
struct hwloc_backend * (*instantiate)(struct hwloc_disc_component *component, const void *data1, const void *data2, const void *data3);
|
||||||
|
|
||||||
|
/** \brief Component priority.
|
||||||
|
* Used to sort topology->components, higher priority first.
|
||||||
|
* Also used to decide between two components with the same name.
|
||||||
|
*
|
||||||
|
* Usual values are
|
||||||
|
* 50 for native OS (or platform) components,
|
||||||
|
* 45 for x86,
|
||||||
|
* 40 for no-OS fallback,
|
||||||
|
* 30 for global components (xml, synthetic),
|
||||||
|
* 20 for pci,
|
||||||
|
* 10 for other misc components (opencl etc.).
|
||||||
|
*/
|
||||||
|
unsigned priority;
|
||||||
|
|
||||||
|
/** \brief Enabled by default.
|
||||||
|
* If unset, if will be disabled unless explicitly requested.
|
||||||
|
*/
|
||||||
|
unsigned enabled_by_default;
|
||||||
|
|
||||||
|
/** \private Used internally to list components by priority on topology->components
|
||||||
|
* (the component structure is usually read-only,
|
||||||
|
* the core copies it before using this field for queueing)
|
||||||
|
*/
|
||||||
|
struct hwloc_disc_component * next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_disc_backends Components and Plugins: Discovery backends
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Discovery backend structure
|
||||||
|
*
|
||||||
|
* A backend is the instantiation of a discovery component.
|
||||||
|
* When a component gets enabled for a topology,
|
||||||
|
* its instantiate() callback creates a backend.
|
||||||
|
*
|
||||||
|
* hwloc_backend_alloc() initializes all fields to default values
|
||||||
|
* that the component may change (except "component" and "next")
|
||||||
|
* before enabling the backend with hwloc_backend_enable().
|
||||||
|
*/
|
||||||
|
struct hwloc_backend {
|
||||||
|
/** \private Reserved for the core, set by hwloc_backend_alloc() */
|
||||||
|
struct hwloc_disc_component * component;
|
||||||
|
/** \private Reserved for the core, set by hwloc_backend_enable() */
|
||||||
|
struct hwloc_topology * topology;
|
||||||
|
/** \private Reserved for the core. Set to 1 if forced through envvar, 0 otherwise. */
|
||||||
|
int envvar_forced;
|
||||||
|
/** \private Reserved for the core. Used internally to list backends topology->backends. */
|
||||||
|
struct hwloc_backend * next;
|
||||||
|
|
||||||
|
/** \brief Backend flags, currently always 0. */
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
/** \brief Backend-specific 'is_thissystem' property.
|
||||||
|
* Set to 0 or 1 if the backend should enforce the thissystem flag when it gets enabled.
|
||||||
|
* Set to -1 if the backend doesn't care (default). */
|
||||||
|
int is_thissystem;
|
||||||
|
|
||||||
|
/** \brief Backend private data, or NULL if none. */
|
||||||
|
void * private_data;
|
||||||
|
/** \brief Callback for freeing the private_data.
|
||||||
|
* May be NULL.
|
||||||
|
*/
|
||||||
|
void (*disable)(struct hwloc_backend *backend);
|
||||||
|
|
||||||
|
/** \brief Main discovery callback.
|
||||||
|
* returns -1 on error, either because it couldn't add its objects ot the existing topology,
|
||||||
|
* or because of an actual discovery/gathering failure.
|
||||||
|
* May be NULL.
|
||||||
|
*/
|
||||||
|
int (*discover)(struct hwloc_backend *backend);
|
||||||
|
|
||||||
|
/** \brief Callback used by the PCI backend to retrieve the locality of a PCI object from the OS/cpu backend.
|
||||||
|
* May be NULL. */
|
||||||
|
int (*get_pci_busid_cpuset)(struct hwloc_backend *backend, struct hwloc_pcidev_attr_s *busid, hwloc_bitmap_t cpuset);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Allocate a backend structure, set good default values, initialize backend->component and topology, etc.
|
||||||
|
* The caller will then modify whatever needed, and call hwloc_backend_enable().
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC struct hwloc_backend * hwloc_backend_alloc(struct hwloc_disc_component *component);
|
||||||
|
|
||||||
|
/** \brief Enable a previously allocated and setup backend. */
|
||||||
|
HWLOC_DECLSPEC int hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *backend);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_generic_components Components and Plugins: Generic components
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Generic component type */
|
||||||
|
typedef enum hwloc_component_type_e {
|
||||||
|
/** \brief The data field must point to a struct hwloc_disc_component. */
|
||||||
|
HWLOC_COMPONENT_TYPE_DISC,
|
||||||
|
|
||||||
|
/** \brief The data field must point to a struct hwloc_xml_component. */
|
||||||
|
HWLOC_COMPONENT_TYPE_XML
|
||||||
|
} hwloc_component_type_t;
|
||||||
|
|
||||||
|
/** \brief Generic component structure
|
||||||
|
*
|
||||||
|
* Generic components structure, either statically listed by configure in static-components.h
|
||||||
|
* or dynamically loaded as a plugin.
|
||||||
|
*/
|
||||||
|
struct hwloc_component {
|
||||||
|
/** \brief Component ABI version, set to ::HWLOC_COMPONENT_ABI */
|
||||||
|
unsigned abi;
|
||||||
|
|
||||||
|
/** \brief Process-wide component initialization callback.
|
||||||
|
*
|
||||||
|
* This optional callback is called when the component is registered
|
||||||
|
* to the hwloc core (after loading the plugin).
|
||||||
|
*
|
||||||
|
* When the component is built as a plugin, this callback
|
||||||
|
* should call hwloc_check_plugin_namespace()
|
||||||
|
* and return an negative error code on error.
|
||||||
|
*
|
||||||
|
* \p flags is always 0 for now.
|
||||||
|
*
|
||||||
|
* \return 0 on success, or a negative code on error.
|
||||||
|
*
|
||||||
|
* \note If the component uses ltdl for loading its own plugins,
|
||||||
|
* it should load/unload them only in init() and finalize(),
|
||||||
|
* to avoid race conditions with hwloc's use of ltdl.
|
||||||
|
*/
|
||||||
|
int (*init)(unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Process-wide component termination callback.
|
||||||
|
*
|
||||||
|
* This optional callback is called after unregistering the component
|
||||||
|
* from the hwloc core (before unloading the plugin).
|
||||||
|
*
|
||||||
|
* \p flags is always 0 for now.
|
||||||
|
*
|
||||||
|
* \note If the component uses ltdl for loading its own plugins,
|
||||||
|
* it should load/unload them only in init() and finalize(),
|
||||||
|
* to avoid race conditions with hwloc's use of ltdl.
|
||||||
|
*/
|
||||||
|
void (*finalize)(unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Component type */
|
||||||
|
hwloc_component_type_t type;
|
||||||
|
|
||||||
|
/** \brief Component flags, unused for now */
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
/** \brief Component data, pointing to a struct hwloc_disc_component or struct hwloc_xml_component. */
|
||||||
|
void * data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_components_core_funcs Components and Plugins: Core functions to be used by components
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Add an object to the topology.
|
||||||
|
*
|
||||||
|
* It is sorted along the tree of other objects according to the inclusion of
|
||||||
|
* cpusets, to eventually be added as a child of the smallest object including
|
||||||
|
* this object.
|
||||||
|
*
|
||||||
|
* If the cpuset is empty, the type of the object (and maybe some attributes)
|
||||||
|
* must be enough to find where to insert the object. This is especially true
|
||||||
|
* for NUMA nodes with memory and no CPUs.
|
||||||
|
*
|
||||||
|
* The given object should not have children.
|
||||||
|
*
|
||||||
|
* This shall only be called before levels are built.
|
||||||
|
*
|
||||||
|
* In case of error, hwloc_report_os_error() is called.
|
||||||
|
*
|
||||||
|
* The caller should check whether the object type is filtered-out before calling this function.
|
||||||
|
*
|
||||||
|
* The topology cpuset/nodesets will be enlarged to include the object sets.
|
||||||
|
*
|
||||||
|
* Returns the object on success.
|
||||||
|
* Returns NULL and frees obj on error.
|
||||||
|
* Returns another object and frees obj if it was merged with an identical pre-existing object.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC struct hwloc_obj *hwloc_insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj);
|
||||||
|
|
||||||
|
/** \brief Type of error callbacks during object insertion */
|
||||||
|
typedef void (*hwloc_report_error_t)(const char * msg, int line);
|
||||||
|
/** \brief Report an insertion error from a backend */
|
||||||
|
HWLOC_DECLSPEC void hwloc_report_os_error(const char * msg, int line);
|
||||||
|
/** \brief Check whether insertion errors are hidden */
|
||||||
|
HWLOC_DECLSPEC int hwloc_hide_errors(void);
|
||||||
|
|
||||||
|
/** \brief Add an object to the topology and specify which error callback to use.
|
||||||
|
*
|
||||||
|
* This function is similar to hwloc_insert_object_by_cpuset() but it allows specifying
|
||||||
|
* where to start insertion from (if \p root is NULL, the topology root object is used),
|
||||||
|
* and specifying the error callback.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC struct hwloc_obj *hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t root, hwloc_obj_t obj, hwloc_report_error_t report_error);
|
||||||
|
|
||||||
|
/** \brief Insert an object somewhere in the topology.
|
||||||
|
*
|
||||||
|
* It is added as the last child of the given parent.
|
||||||
|
* The cpuset is completely ignored, so strange objects such as I/O devices should
|
||||||
|
* preferably be inserted with this.
|
||||||
|
*
|
||||||
|
* When used for "normal" children with cpusets (when importing from XML
|
||||||
|
* when duplicating a topology), the caller should make sure that:
|
||||||
|
* - children are inserted in order,
|
||||||
|
* - children cpusets do not intersect.
|
||||||
|
*
|
||||||
|
* The given object may have normal, I/O or Misc children, as long as they are in order as well.
|
||||||
|
* These children must have valid parent and next_sibling pointers.
|
||||||
|
*
|
||||||
|
* The caller should check whether the object type is filtered-out before calling this function.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC void hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t parent, hwloc_obj_t obj);
|
||||||
|
|
||||||
|
/** \brief Allocate and initialize an object of the given type and physical index.
|
||||||
|
*
|
||||||
|
* If \p os_index is unknown or irrelevant, use \c HWLOC_UNKNOWN_INDEX.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC hwloc_obj_t hwloc_alloc_setup_object(hwloc_topology_t topology, hwloc_obj_type_t type, unsigned os_index);
|
||||||
|
|
||||||
|
/** \brief Setup object cpusets/nodesets by OR'ing its children.
|
||||||
|
*
|
||||||
|
* Used when adding an object late in the topology.
|
||||||
|
* Will update the new object by OR'ing all its new children sets.
|
||||||
|
*
|
||||||
|
* Used when PCI backend adds a hostbridge parent, when distances
|
||||||
|
* add a new Group, etc.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_obj_add_children_sets(hwloc_obj_t obj);
|
||||||
|
|
||||||
|
/** \brief Request a reconnection of children and levels in the topology.
|
||||||
|
*
|
||||||
|
* May be used by backends during discovery if they need arrays or lists
|
||||||
|
* of object within levels or children to be fully connected.
|
||||||
|
*
|
||||||
|
* \p flags is currently unused, must 0.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_topology_reconnect(hwloc_topology_t topology, unsigned long flags __hwloc_attribute_unused);
|
||||||
|
|
||||||
|
/** \brief Make sure that plugins can lookup core symbols.
|
||||||
|
*
|
||||||
|
* This is a sanity check to avoid lazy-lookup failures when libhwloc
|
||||||
|
* is loaded within a plugin, and later tries to load its own plugins.
|
||||||
|
* This may fail (and abort the program) if libhwloc symbols are in a
|
||||||
|
* private namespace.
|
||||||
|
*
|
||||||
|
* \return 0 on success.
|
||||||
|
* \return -1 if the plugin cannot be successfully loaded. The caller
|
||||||
|
* plugin init() callback should return a negative error code as well.
|
||||||
|
*
|
||||||
|
* Plugins should call this function in their init() callback to avoid
|
||||||
|
* later crashes if lazy symbol resolution is used by the upper layer that
|
||||||
|
* loaded hwloc (e.g. OpenCL implementations using dlopen with RTLD_LAZY).
|
||||||
|
*
|
||||||
|
* \note The build system must define HWLOC_INSIDE_PLUGIN if and only if
|
||||||
|
* building the caller as a plugin.
|
||||||
|
*
|
||||||
|
* \note This function should remain inline so plugins can call it even
|
||||||
|
* when they cannot find libhwloc symbols.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_plugin_check_namespace(const char *pluginname __hwloc_attribute_unused, const char *symbol __hwloc_attribute_unused)
|
||||||
|
{
|
||||||
|
#ifdef HWLOC_INSIDE_PLUGIN
|
||||||
|
lt_dlhandle handle;
|
||||||
|
void *sym;
|
||||||
|
handle = lt_dlopen(NULL);
|
||||||
|
if (!handle)
|
||||||
|
/* cannot check, assume things will work */
|
||||||
|
return 0;
|
||||||
|
sym = lt_dlsym(handle, symbol);
|
||||||
|
lt_dlclose(handle);
|
||||||
|
if (!sym) {
|
||||||
|
static int verboseenv_checked = 0;
|
||||||
|
static int verboseenv_value = 0;
|
||||||
|
if (!verboseenv_checked) {
|
||||||
|
const char *verboseenv = getenv("HWLOC_PLUGINS_VERBOSE");
|
||||||
|
verboseenv_value = verboseenv ? atoi(verboseenv) : 0;
|
||||||
|
verboseenv_checked = 1;
|
||||||
|
}
|
||||||
|
if (verboseenv_value)
|
||||||
|
fprintf(stderr, "Plugin `%s' disabling itself because it cannot find the `%s' core symbol.\n",
|
||||||
|
pluginname, symbol);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* HWLOC_INSIDE_PLUGIN */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_components_filtering Components and Plugins: Filtering objects
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Check whether the given PCI device classid is important.
|
||||||
|
*
|
||||||
|
* \return 1 if important, 0 otherwise.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_filter_check_pcidev_subtype_important(unsigned classid)
|
||||||
|
{
|
||||||
|
unsigned baseclass = classid >> 8;
|
||||||
|
return (baseclass == 0x03 /* PCI_BASE_CLASS_DISPLAY */
|
||||||
|
|| baseclass == 0x02 /* PCI_BASE_CLASS_NETWORK */
|
||||||
|
|| baseclass == 0x01 /* PCI_BASE_CLASS_STORAGE */
|
||||||
|
|| baseclass == 0x0b /* PCI_BASE_CLASS_PROCESSOR */
|
||||||
|
|| classid == 0x0c04 /* PCI_CLASS_SERIAL_FIBER */
|
||||||
|
|| classid == 0x0c06 /* PCI_CLASS_SERIAL_INFINIBAND */
|
||||||
|
|| baseclass == 0x12 /* Processing Accelerators */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Check whether the given OS device subtype is important.
|
||||||
|
*
|
||||||
|
* \return 1 if important, 0 otherwise.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_filter_check_osdev_subtype_important(hwloc_obj_osdev_type_t subtype)
|
||||||
|
{
|
||||||
|
return (subtype != HWLOC_OBJ_OSDEV_DMA);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Check whether a non-I/O object type should be filtered-out.
|
||||||
|
*
|
||||||
|
* Cannot be used for I/O objects.
|
||||||
|
*
|
||||||
|
* \return 1 if the object type should be kept, 0 otherwise.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_filter_check_keep_object_type(hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||||
|
{
|
||||||
|
enum hwloc_type_filter_e filter = HWLOC_TYPE_FILTER_KEEP_NONE;
|
||||||
|
hwloc_topology_get_type_filter(topology, type, &filter);
|
||||||
|
assert(filter != HWLOC_TYPE_FILTER_KEEP_IMPORTANT); /* IMPORTANT only used for I/O */
|
||||||
|
return filter == HWLOC_TYPE_FILTER_KEEP_NONE ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Check whether the given object should be filtered-out.
|
||||||
|
*
|
||||||
|
* \return 1 if the object type should be kept, 0 otherwise.
|
||||||
|
*/
|
||||||
|
static __hwloc_inline int
|
||||||
|
hwloc_filter_check_keep_object(hwloc_topology_t topology, hwloc_obj_t obj)
|
||||||
|
{
|
||||||
|
hwloc_obj_type_t type = obj->type;
|
||||||
|
enum hwloc_type_filter_e filter = HWLOC_TYPE_FILTER_KEEP_NONE;
|
||||||
|
hwloc_topology_get_type_filter(topology, type, &filter);
|
||||||
|
if (filter == HWLOC_TYPE_FILTER_KEEP_NONE)
|
||||||
|
return 0;
|
||||||
|
if (filter == HWLOC_TYPE_FILTER_KEEP_IMPORTANT) {
|
||||||
|
if (type == HWLOC_OBJ_PCI_DEVICE)
|
||||||
|
return hwloc_filter_check_pcidev_subtype_important(obj->attr->pcidev.class_id);
|
||||||
|
if (type == HWLOC_OBJ_OS_DEVICE)
|
||||||
|
return hwloc_filter_check_osdev_subtype_important(obj->attr->osdev.type);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_components_pcidisc Components and Plugins: helpers for PCI discovery
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Return the offset of the given capability in the PCI config space buffer
|
||||||
|
*
|
||||||
|
* This function requires a 256-bytes config space. Unknown/unavailable bytes should be set to 0xff.
|
||||||
|
*/
|
||||||
|
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_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_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.
|
||||||
|
*
|
||||||
|
* This function requires 32 bytes of common configuration header at the beginning of config.
|
||||||
|
*
|
||||||
|
* Returns -1 and destroys /p obj if bridge fields are invalid.
|
||||||
|
*/
|
||||||
|
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_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 topology.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Find the PCI object that matches the bus ID.
|
||||||
|
*
|
||||||
|
* 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_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_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.
|
||||||
|
*
|
||||||
|
* Look at PCI affinity to find out where the given PCI bus ID should be attached.
|
||||||
|
*
|
||||||
|
* 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_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_pcidisc_find_busid_parent(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_PLUGINS_H */
|
||||||
765
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
Normal file
765
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
Normal file
@@ -0,0 +1,765 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* Copyright © 2010-2018 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_RENAME_H
|
||||||
|
#define HWLOC_RENAME_H
|
||||||
|
|
||||||
|
#include <hwloc/autogen/config.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Only enact these defines if we're actually renaming the symbols
|
||||||
|
(i.e., avoid trying to have no-op defines if we're *not*
|
||||||
|
renaming). */
|
||||||
|
|
||||||
|
#if HWLOC_SYM_TRANSFORM
|
||||||
|
|
||||||
|
/* Use a preprocessor two-step in order to get the prefixing right.
|
||||||
|
Make 2 macros: HWLOC_NAME and HWLOC_NAME_CAPS for renaming
|
||||||
|
things. */
|
||||||
|
|
||||||
|
#define HWLOC_MUNGE_NAME(a, b) HWLOC_MUNGE_NAME2(a, b)
|
||||||
|
#define HWLOC_MUNGE_NAME2(a, b) a ## b
|
||||||
|
#define HWLOC_NAME(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX, hwloc_ ## name)
|
||||||
|
#define HWLOC_NAME_CAPS(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX_CAPS, hwloc_ ## name)
|
||||||
|
|
||||||
|
/* Now define all the "real" names to be the prefixed names. This
|
||||||
|
allows us to use the real names throughout the code base (i.e.,
|
||||||
|
"hwloc_<foo>"); the preprocessor will adjust to have the prefixed
|
||||||
|
name under the covers. */
|
||||||
|
|
||||||
|
/* Names from hwloc.h */
|
||||||
|
|
||||||
|
#define hwloc_get_api_version HWLOC_NAME(get_api_version)
|
||||||
|
|
||||||
|
#define hwloc_topology HWLOC_NAME(topology)
|
||||||
|
#define hwloc_topology_t HWLOC_NAME(topology_t)
|
||||||
|
|
||||||
|
#define hwloc_cpuset_t HWLOC_NAME(cpuset_t)
|
||||||
|
#define hwloc_const_cpuset_t HWLOC_NAME(const_cpuset_t)
|
||||||
|
#define hwloc_nodeset_t HWLOC_NAME(nodeset_t)
|
||||||
|
#define hwloc_const_nodeset_t HWLOC_NAME(const_nodeset_t)
|
||||||
|
|
||||||
|
#define HWLOC_OBJ_MACHINE HWLOC_NAME_CAPS(OBJ_MACHINE)
|
||||||
|
#define HWLOC_OBJ_NUMANODE HWLOC_NAME_CAPS(OBJ_NUMANODE)
|
||||||
|
#define HWLOC_OBJ_PACKAGE HWLOC_NAME_CAPS(OBJ_PACKAGE)
|
||||||
|
#define HWLOC_OBJ_CORE HWLOC_NAME_CAPS(OBJ_CORE)
|
||||||
|
#define HWLOC_OBJ_PU HWLOC_NAME_CAPS(OBJ_PU)
|
||||||
|
#define HWLOC_OBJ_L1CACHE HWLOC_NAME_CAPS(OBJ_L1CACHE)
|
||||||
|
#define HWLOC_OBJ_L2CACHE HWLOC_NAME_CAPS(OBJ_L2CACHE)
|
||||||
|
#define HWLOC_OBJ_L3CACHE HWLOC_NAME_CAPS(OBJ_L3CACHE)
|
||||||
|
#define HWLOC_OBJ_L4CACHE HWLOC_NAME_CAPS(OBJ_L4CACHE)
|
||||||
|
#define HWLOC_OBJ_L5CACHE HWLOC_NAME_CAPS(OBJ_L5CACHE)
|
||||||
|
#define HWLOC_OBJ_L1ICACHE HWLOC_NAME_CAPS(OBJ_L1ICACHE)
|
||||||
|
#define HWLOC_OBJ_L2ICACHE HWLOC_NAME_CAPS(OBJ_L2ICACHE)
|
||||||
|
#define HWLOC_OBJ_L3ICACHE HWLOC_NAME_CAPS(OBJ_L3ICACHE)
|
||||||
|
#define HWLOC_OBJ_MISC HWLOC_NAME_CAPS(OBJ_MISC)
|
||||||
|
#define HWLOC_OBJ_GROUP HWLOC_NAME_CAPS(OBJ_GROUP)
|
||||||
|
#define HWLOC_OBJ_BRIDGE HWLOC_NAME_CAPS(OBJ_BRIDGE)
|
||||||
|
#define HWLOC_OBJ_PCI_DEVICE HWLOC_NAME_CAPS(OBJ_PCI_DEVICE)
|
||||||
|
#define HWLOC_OBJ_OS_DEVICE HWLOC_NAME_CAPS(OBJ_OS_DEVICE)
|
||||||
|
#define HWLOC_OBJ_TYPE_MAX HWLOC_NAME_CAPS(OBJ_TYPE_MAX)
|
||||||
|
#define hwloc_obj_type_t HWLOC_NAME(obj_type_t)
|
||||||
|
|
||||||
|
#define hwloc_obj_cache_type_e HWLOC_NAME(obj_cache_type_e)
|
||||||
|
#define hwloc_obj_cache_type_t HWLOC_NAME(obj_cache_type_t)
|
||||||
|
#define HWLOC_OBJ_CACHE_UNIFIED HWLOC_NAME_CAPS(OBJ_CACHE_UNIFIED)
|
||||||
|
#define HWLOC_OBJ_CACHE_DATA HWLOC_NAME_CAPS(OBJ_CACHE_DATA)
|
||||||
|
#define HWLOC_OBJ_CACHE_INSTRUCTION HWLOC_NAME_CAPS(OBJ_CACHE_INSTRUCTION)
|
||||||
|
|
||||||
|
#define hwloc_obj_bridge_type_e HWLOC_NAME(obj_bridge_type_e)
|
||||||
|
#define hwloc_obj_bridge_type_t HWLOC_NAME(obj_bridge_type_t)
|
||||||
|
#define HWLOC_OBJ_BRIDGE_HOST HWLOC_NAME_CAPS(OBJ_BRIDGE_HOST)
|
||||||
|
#define HWLOC_OBJ_BRIDGE_PCI HWLOC_NAME_CAPS(OBJ_BRIDGE_PCI)
|
||||||
|
|
||||||
|
#define hwloc_obj_osdev_type_e HWLOC_NAME(obj_osdev_type_e)
|
||||||
|
#define hwloc_obj_osdev_type_t HWLOC_NAME(obj_osdev_type_t)
|
||||||
|
#define HWLOC_OBJ_OSDEV_BLOCK HWLOC_NAME_CAPS(OBJ_OSDEV_BLOCK)
|
||||||
|
#define HWLOC_OBJ_OSDEV_GPU HWLOC_NAME_CAPS(OBJ_OSDEV_GPU)
|
||||||
|
#define HWLOC_OBJ_OSDEV_NETWORK HWLOC_NAME_CAPS(OBJ_OSDEV_NETWORK)
|
||||||
|
#define HWLOC_OBJ_OSDEV_OPENFABRICS HWLOC_NAME_CAPS(OBJ_OSDEV_OPENFABRICS)
|
||||||
|
#define HWLOC_OBJ_OSDEV_DMA HWLOC_NAME_CAPS(OBJ_OSDEV_DMA)
|
||||||
|
#define HWLOC_OBJ_OSDEV_COPROC HWLOC_NAME_CAPS(OBJ_OSDEV_COPROC)
|
||||||
|
|
||||||
|
#define hwloc_compare_types HWLOC_NAME(compare_types)
|
||||||
|
|
||||||
|
#define hwloc_compare_types_e HWLOC_NAME(compare_types_e)
|
||||||
|
#define HWLOC_TYPE_UNORDERED HWLOC_NAME_CAPS(TYPE_UNORDERED)
|
||||||
|
|
||||||
|
#define hwloc_obj HWLOC_NAME(obj)
|
||||||
|
#define hwloc_obj_t HWLOC_NAME(obj_t)
|
||||||
|
|
||||||
|
#define hwloc_info_s HWLOC_NAME(info_s)
|
||||||
|
|
||||||
|
#define hwloc_obj_attr_u HWLOC_NAME(obj_attr_u)
|
||||||
|
#define hwloc_numanode_attr_s HWLOC_NAME(numanode_attr_s)
|
||||||
|
#define hwloc_memory_page_type_s HWLOC_NAME(memory_page_type_s)
|
||||||
|
#define hwloc_cache_attr_s HWLOC_NAME(cache_attr_s)
|
||||||
|
#define hwloc_group_attr_s HWLOC_NAME(group_attr_s)
|
||||||
|
#define hwloc_pcidev_attr_s HWLOC_NAME(pcidev_attr_s)
|
||||||
|
#define hwloc_bridge_attr_s HWLOC_NAME(bridge_attr_s)
|
||||||
|
#define hwloc_osdev_attr_s HWLOC_NAME(osdev_attr_s)
|
||||||
|
|
||||||
|
#define hwloc_topology_init HWLOC_NAME(topology_init)
|
||||||
|
#define hwloc_topology_load HWLOC_NAME(topology_load)
|
||||||
|
#define hwloc_topology_destroy HWLOC_NAME(topology_destroy)
|
||||||
|
#define hwloc_topology_dup HWLOC_NAME(topology_dup)
|
||||||
|
#define hwloc_topology_abi_check HWLOC_NAME(topology_abi_check)
|
||||||
|
#define hwloc_topology_check HWLOC_NAME(topology_check)
|
||||||
|
|
||||||
|
#define hwloc_topology_flags_e HWLOC_NAME(topology_flags_e)
|
||||||
|
|
||||||
|
#define HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM HWLOC_NAME_CAPS(TOPOLOGY_FLAG_WHOLE_SYSTEM)
|
||||||
|
#define HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM HWLOC_NAME_CAPS(TOPOLOGY_FLAG_IS_THISSYSTEM)
|
||||||
|
#define HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES)
|
||||||
|
|
||||||
|
#define hwloc_topology_set_pid HWLOC_NAME(topology_set_pid)
|
||||||
|
#define hwloc_topology_set_synthetic HWLOC_NAME(topology_set_synthetic)
|
||||||
|
#define hwloc_topology_set_xml HWLOC_NAME(topology_set_xml)
|
||||||
|
#define hwloc_topology_set_xmlbuffer HWLOC_NAME(topology_set_xmlbuffer)
|
||||||
|
|
||||||
|
#define hwloc_topology_set_flags HWLOC_NAME(topology_set_flags)
|
||||||
|
#define hwloc_topology_is_thissystem HWLOC_NAME(topology_is_thissystem)
|
||||||
|
#define hwloc_topology_get_flags HWLOC_NAME(topology_get_flags)
|
||||||
|
#define hwloc_topology_discovery_support HWLOC_NAME(topology_discovery_support)
|
||||||
|
#define hwloc_topology_cpubind_support HWLOC_NAME(topology_cpubind_support)
|
||||||
|
#define hwloc_topology_membind_support HWLOC_NAME(topology_membind_support)
|
||||||
|
#define hwloc_topology_support HWLOC_NAME(topology_support)
|
||||||
|
#define hwloc_topology_get_support HWLOC_NAME(topology_get_support)
|
||||||
|
|
||||||
|
#define hwloc_type_filter_e HWLOC_NAME(type_filter_e)
|
||||||
|
#define HWLOC_TYPE_FILTER_KEEP_ALL HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_ALL)
|
||||||
|
#define HWLOC_TYPE_FILTER_KEEP_NONE HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_NONE)
|
||||||
|
#define HWLOC_TYPE_FILTER_KEEP_STRUCTURE HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_STRUCTURE)
|
||||||
|
#define HWLOC_TYPE_FILTER_KEEP_IMPORTANT HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_IMPORTANT)
|
||||||
|
#define hwloc_topology_set_type_filter HWLOC_NAME(topology_set_type_filter)
|
||||||
|
#define hwloc_topology_get_type_filter HWLOC_NAME(topology_get_type_filter)
|
||||||
|
#define hwloc_topology_set_all_types_filter HWLOC_NAME(topology_set_all_types_filter)
|
||||||
|
#define hwloc_topology_set_cache_types_filter HWLOC_NAME(topology_set_cache_types_filter)
|
||||||
|
#define hwloc_topology_set_icache_types_filter HWLOC_NAME(topology_set_icache_types_filter)
|
||||||
|
#define hwloc_topology_set_io_types_filter HWLOC_NAME(topology_set_io_types_filter)
|
||||||
|
|
||||||
|
#define hwloc_topology_set_userdata HWLOC_NAME(topology_set_userdata)
|
||||||
|
#define hwloc_topology_get_userdata HWLOC_NAME(topology_get_userdata)
|
||||||
|
|
||||||
|
#define hwloc_restrict_flags_e HWLOC_NAME(restrict_flags_e)
|
||||||
|
#define HWLOC_RESTRICT_FLAG_REMOVE_CPULESS HWLOC_NAME_CAPS(RESTRICT_FLAG_REMOVE_CPULESS)
|
||||||
|
#define HWLOC_RESTRICT_FLAG_ADAPT_MISC HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_MISC)
|
||||||
|
#define HWLOC_RESTRICT_FLAG_ADAPT_IO HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_IO)
|
||||||
|
#define hwloc_topology_restrict HWLOC_NAME(topology_restrict)
|
||||||
|
|
||||||
|
#define hwloc_topology_insert_misc_object HWLOC_NAME(topology_insert_misc_object)
|
||||||
|
#define hwloc_topology_alloc_group_object HWLOC_NAME(topology_alloc_group_object)
|
||||||
|
#define hwloc_topology_insert_group_object HWLOC_NAME(topology_insert_group_object)
|
||||||
|
#define hwloc_obj_add_other_obj_sets HWLOC_NAME(obj_add_other_obj_sets)
|
||||||
|
|
||||||
|
#define hwloc_topology_get_depth HWLOC_NAME(topology_get_depth)
|
||||||
|
#define hwloc_get_type_depth HWLOC_NAME(get_type_depth)
|
||||||
|
#define hwloc_get_memory_parents_depth HWLOC_NAME(get_memory_parents_depth)
|
||||||
|
|
||||||
|
#define hwloc_get_type_depth_e HWLOC_NAME(get_type_depth_e)
|
||||||
|
#define HWLOC_TYPE_DEPTH_UNKNOWN HWLOC_NAME_CAPS(TYPE_DEPTH_UNKNOWN)
|
||||||
|
#define HWLOC_TYPE_DEPTH_MULTIPLE HWLOC_NAME_CAPS(TYPE_DEPTH_MULTIPLE)
|
||||||
|
#define HWLOC_TYPE_DEPTH_BRIDGE HWLOC_NAME_CAPS(TYPE_DEPTH_BRIDGE)
|
||||||
|
#define HWLOC_TYPE_DEPTH_PCI_DEVICE HWLOC_NAME_CAPS(TYPE_DEPTH_PCI_DEVICE)
|
||||||
|
#define HWLOC_TYPE_DEPTH_OS_DEVICE HWLOC_NAME_CAPS(TYPE_DEPTH_OS_DEVICE)
|
||||||
|
#define HWLOC_TYPE_DEPTH_MISC HWLOC_NAME_CAPS(TYPE_DEPTH_MISC)
|
||||||
|
#define HWLOC_TYPE_DEPTH_NUMANODE HWLOC_NAME_CAPS(TYPE_DEPTH_NUMANODE)
|
||||||
|
|
||||||
|
#define hwloc_get_depth_type HWLOC_NAME(get_depth_type)
|
||||||
|
#define hwloc_get_nbobjs_by_depth HWLOC_NAME(get_nbobjs_by_depth)
|
||||||
|
#define hwloc_get_nbobjs_by_type HWLOC_NAME(get_nbobjs_by_type)
|
||||||
|
|
||||||
|
#define hwloc_get_obj_by_depth HWLOC_NAME(get_obj_by_depth )
|
||||||
|
#define hwloc_get_obj_by_type HWLOC_NAME(get_obj_by_type )
|
||||||
|
|
||||||
|
#define hwloc_obj_type_string HWLOC_NAME(obj_type_string )
|
||||||
|
#define hwloc_obj_type_snprintf HWLOC_NAME(obj_type_snprintf )
|
||||||
|
#define hwloc_obj_attr_snprintf HWLOC_NAME(obj_attr_snprintf )
|
||||||
|
#define hwloc_type_sscanf HWLOC_NAME(type_sscanf)
|
||||||
|
#define hwloc_type_sscanf_as_depth HWLOC_NAME(type_sscanf_as_depth)
|
||||||
|
|
||||||
|
#define hwloc_obj_get_info_by_name HWLOC_NAME(obj_get_info_by_name)
|
||||||
|
#define hwloc_obj_add_info HWLOC_NAME(obj_add_info)
|
||||||
|
|
||||||
|
#define HWLOC_CPUBIND_PROCESS HWLOC_NAME_CAPS(CPUBIND_PROCESS)
|
||||||
|
#define HWLOC_CPUBIND_THREAD HWLOC_NAME_CAPS(CPUBIND_THREAD)
|
||||||
|
#define HWLOC_CPUBIND_STRICT HWLOC_NAME_CAPS(CPUBIND_STRICT)
|
||||||
|
#define HWLOC_CPUBIND_NOMEMBIND HWLOC_NAME_CAPS(CPUBIND_NOMEMBIND)
|
||||||
|
|
||||||
|
#define hwloc_cpubind_flags_t HWLOC_NAME(cpubind_flags_t)
|
||||||
|
|
||||||
|
#define hwloc_set_cpubind HWLOC_NAME(set_cpubind)
|
||||||
|
#define hwloc_get_cpubind HWLOC_NAME(get_cpubind)
|
||||||
|
#define hwloc_set_proc_cpubind HWLOC_NAME(set_proc_cpubind)
|
||||||
|
#define hwloc_get_proc_cpubind HWLOC_NAME(get_proc_cpubind)
|
||||||
|
#define hwloc_set_thread_cpubind HWLOC_NAME(set_thread_cpubind)
|
||||||
|
#define hwloc_get_thread_cpubind HWLOC_NAME(get_thread_cpubind)
|
||||||
|
|
||||||
|
#define hwloc_get_last_cpu_location HWLOC_NAME(get_last_cpu_location)
|
||||||
|
#define hwloc_get_proc_last_cpu_location HWLOC_NAME(get_proc_last_cpu_location)
|
||||||
|
|
||||||
|
#define HWLOC_MEMBIND_DEFAULT HWLOC_NAME_CAPS(MEMBIND_DEFAULT)
|
||||||
|
#define HWLOC_MEMBIND_FIRSTTOUCH HWLOC_NAME_CAPS(MEMBIND_FIRSTTOUCH)
|
||||||
|
#define HWLOC_MEMBIND_BIND HWLOC_NAME_CAPS(MEMBIND_BIND)
|
||||||
|
#define HWLOC_MEMBIND_INTERLEAVE HWLOC_NAME_CAPS(MEMBIND_INTERLEAVE)
|
||||||
|
#define HWLOC_MEMBIND_NEXTTOUCH HWLOC_NAME_CAPS(MEMBIND_NEXTTOUCH)
|
||||||
|
#define HWLOC_MEMBIND_MIXED HWLOC_NAME_CAPS(MEMBIND_MIXED)
|
||||||
|
|
||||||
|
#define hwloc_membind_policy_t HWLOC_NAME(membind_policy_t)
|
||||||
|
|
||||||
|
#define HWLOC_MEMBIND_PROCESS HWLOC_NAME_CAPS(MEMBIND_PROCESS)
|
||||||
|
#define HWLOC_MEMBIND_THREAD HWLOC_NAME_CAPS(MEMBIND_THREAD)
|
||||||
|
#define HWLOC_MEMBIND_STRICT HWLOC_NAME_CAPS(MEMBIND_STRICT)
|
||||||
|
#define HWLOC_MEMBIND_MIGRATE HWLOC_NAME_CAPS(MEMBIND_MIGRATE)
|
||||||
|
#define HWLOC_MEMBIND_NOCPUBIND HWLOC_NAME_CAPS(MEMBIND_NOCPUBIND)
|
||||||
|
#define HWLOC_MEMBIND_BYNODESET HWLOC_NAME_CAPS(MEMBIND_BYNODESET)
|
||||||
|
|
||||||
|
#define hwloc_membind_flags_t HWLOC_NAME(membind_flags_t)
|
||||||
|
|
||||||
|
#define hwloc_set_membind HWLOC_NAME(set_membind)
|
||||||
|
#define hwloc_get_membind HWLOC_NAME(get_membind)
|
||||||
|
#define hwloc_set_proc_membind HWLOC_NAME(set_proc_membind)
|
||||||
|
#define hwloc_get_proc_membind HWLOC_NAME(get_proc_membind)
|
||||||
|
#define hwloc_set_area_membind HWLOC_NAME(set_area_membind)
|
||||||
|
#define hwloc_get_area_membind HWLOC_NAME(get_area_membind)
|
||||||
|
#define hwloc_get_area_memlocation HWLOC_NAME(get_area_memlocation)
|
||||||
|
#define hwloc_alloc_membind HWLOC_NAME(alloc_membind)
|
||||||
|
#define hwloc_alloc HWLOC_NAME(alloc)
|
||||||
|
#define hwloc_free HWLOC_NAME(free)
|
||||||
|
|
||||||
|
#define hwloc_get_non_io_ancestor_obj HWLOC_NAME(get_non_io_ancestor_obj)
|
||||||
|
#define hwloc_get_next_pcidev HWLOC_NAME(get_next_pcidev)
|
||||||
|
#define hwloc_get_pcidev_by_busid HWLOC_NAME(get_pcidev_by_busid)
|
||||||
|
#define hwloc_get_pcidev_by_busidstring HWLOC_NAME(get_pcidev_by_busidstring)
|
||||||
|
#define hwloc_get_next_osdev HWLOC_NAME(get_next_osdev)
|
||||||
|
#define hwloc_get_next_bridge HWLOC_NAME(get_next_bridge)
|
||||||
|
#define hwloc_bridge_covers_pcibus HWLOC_NAME(bridge_covers_pcibus)
|
||||||
|
|
||||||
|
/* hwloc/bitmap.h */
|
||||||
|
|
||||||
|
#define hwloc_bitmap_s HWLOC_NAME(bitmap_s)
|
||||||
|
#define hwloc_bitmap_t HWLOC_NAME(bitmap_t)
|
||||||
|
#define hwloc_const_bitmap_t HWLOC_NAME(const_bitmap_t)
|
||||||
|
|
||||||
|
#define hwloc_bitmap_alloc HWLOC_NAME(bitmap_alloc)
|
||||||
|
#define hwloc_bitmap_alloc_full HWLOC_NAME(bitmap_alloc_full)
|
||||||
|
#define hwloc_bitmap_free HWLOC_NAME(bitmap_free)
|
||||||
|
#define hwloc_bitmap_dup HWLOC_NAME(bitmap_dup)
|
||||||
|
#define hwloc_bitmap_copy HWLOC_NAME(bitmap_copy)
|
||||||
|
#define hwloc_bitmap_snprintf HWLOC_NAME(bitmap_snprintf)
|
||||||
|
#define hwloc_bitmap_asprintf HWLOC_NAME(bitmap_asprintf)
|
||||||
|
#define hwloc_bitmap_sscanf HWLOC_NAME(bitmap_sscanf)
|
||||||
|
#define hwloc_bitmap_list_snprintf HWLOC_NAME(bitmap_list_snprintf)
|
||||||
|
#define hwloc_bitmap_list_asprintf HWLOC_NAME(bitmap_list_asprintf)
|
||||||
|
#define hwloc_bitmap_list_sscanf HWLOC_NAME(bitmap_list_sscanf)
|
||||||
|
#define hwloc_bitmap_taskset_snprintf HWLOC_NAME(bitmap_taskset_snprintf)
|
||||||
|
#define hwloc_bitmap_taskset_asprintf HWLOC_NAME(bitmap_taskset_asprintf)
|
||||||
|
#define hwloc_bitmap_taskset_sscanf HWLOC_NAME(bitmap_taskset_sscanf)
|
||||||
|
#define hwloc_bitmap_zero HWLOC_NAME(bitmap_zero)
|
||||||
|
#define hwloc_bitmap_fill HWLOC_NAME(bitmap_fill)
|
||||||
|
#define hwloc_bitmap_from_ulong HWLOC_NAME(bitmap_from_ulong)
|
||||||
|
|
||||||
|
#define hwloc_bitmap_from_ith_ulong HWLOC_NAME(bitmap_from_ith_ulong)
|
||||||
|
#define hwloc_bitmap_to_ulong HWLOC_NAME(bitmap_to_ulong)
|
||||||
|
#define hwloc_bitmap_to_ith_ulong HWLOC_NAME(bitmap_to_ith_ulong)
|
||||||
|
#define hwloc_bitmap_only HWLOC_NAME(bitmap_only)
|
||||||
|
#define hwloc_bitmap_allbut HWLOC_NAME(bitmap_allbut)
|
||||||
|
#define hwloc_bitmap_set HWLOC_NAME(bitmap_set)
|
||||||
|
#define hwloc_bitmap_set_range HWLOC_NAME(bitmap_set_range)
|
||||||
|
#define hwloc_bitmap_set_ith_ulong HWLOC_NAME(bitmap_set_ith_ulong)
|
||||||
|
#define hwloc_bitmap_clr HWLOC_NAME(bitmap_clr)
|
||||||
|
#define hwloc_bitmap_clr_range HWLOC_NAME(bitmap_clr_range)
|
||||||
|
#define hwloc_bitmap_isset HWLOC_NAME(bitmap_isset)
|
||||||
|
#define hwloc_bitmap_iszero HWLOC_NAME(bitmap_iszero)
|
||||||
|
#define hwloc_bitmap_isfull HWLOC_NAME(bitmap_isfull)
|
||||||
|
#define hwloc_bitmap_isequal HWLOC_NAME(bitmap_isequal)
|
||||||
|
#define hwloc_bitmap_intersects HWLOC_NAME(bitmap_intersects)
|
||||||
|
#define hwloc_bitmap_isincluded HWLOC_NAME(bitmap_isincluded)
|
||||||
|
#define hwloc_bitmap_or HWLOC_NAME(bitmap_or)
|
||||||
|
#define hwloc_bitmap_and HWLOC_NAME(bitmap_and)
|
||||||
|
#define hwloc_bitmap_andnot HWLOC_NAME(bitmap_andnot)
|
||||||
|
#define hwloc_bitmap_xor HWLOC_NAME(bitmap_xor)
|
||||||
|
#define hwloc_bitmap_not HWLOC_NAME(bitmap_not)
|
||||||
|
#define hwloc_bitmap_first HWLOC_NAME(bitmap_first)
|
||||||
|
#define hwloc_bitmap_last HWLOC_NAME(bitmap_last)
|
||||||
|
#define hwloc_bitmap_next HWLOC_NAME(bitmap_next)
|
||||||
|
#define hwloc_bitmap_first_unset HWLOC_NAME(bitmap_first_unset)
|
||||||
|
#define hwloc_bitmap_last_unset HWLOC_NAME(bitmap_last_unset)
|
||||||
|
#define hwloc_bitmap_next_unset HWLOC_NAME(bitmap_next_unset)
|
||||||
|
#define hwloc_bitmap_singlify HWLOC_NAME(bitmap_singlify)
|
||||||
|
#define hwloc_bitmap_compare_first HWLOC_NAME(bitmap_compare_first)
|
||||||
|
#define hwloc_bitmap_compare HWLOC_NAME(bitmap_compare)
|
||||||
|
#define hwloc_bitmap_weight HWLOC_NAME(bitmap_weight)
|
||||||
|
|
||||||
|
/* hwloc/helper.h */
|
||||||
|
|
||||||
|
#define hwloc_get_type_or_below_depth HWLOC_NAME(get_type_or_below_depth)
|
||||||
|
#define hwloc_get_type_or_above_depth HWLOC_NAME(get_type_or_above_depth)
|
||||||
|
#define hwloc_get_root_obj HWLOC_NAME(get_root_obj)
|
||||||
|
#define hwloc_get_ancestor_obj_by_depth HWLOC_NAME(get_ancestor_obj_by_depth)
|
||||||
|
#define hwloc_get_ancestor_obj_by_type HWLOC_NAME(get_ancestor_obj_by_type)
|
||||||
|
#define hwloc_get_next_obj_by_depth HWLOC_NAME(get_next_obj_by_depth)
|
||||||
|
#define hwloc_get_next_obj_by_type HWLOC_NAME(get_next_obj_by_type)
|
||||||
|
#define hwloc_get_pu_obj_by_os_index HWLOC_NAME(get_pu_obj_by_os_index)
|
||||||
|
#define hwloc_get_numanode_obj_by_os_index HWLOC_NAME(get_numanode_obj_by_os_index)
|
||||||
|
#define hwloc_get_next_child HWLOC_NAME(get_next_child)
|
||||||
|
#define hwloc_get_common_ancestor_obj HWLOC_NAME(get_common_ancestor_obj)
|
||||||
|
#define hwloc_obj_is_in_subtree HWLOC_NAME(obj_is_in_subtree)
|
||||||
|
#define hwloc_get_first_largest_obj_inside_cpuset HWLOC_NAME(get_first_largest_obj_inside_cpuset)
|
||||||
|
#define hwloc_get_largest_objs_inside_cpuset HWLOC_NAME(get_largest_objs_inside_cpuset)
|
||||||
|
#define hwloc_get_next_obj_inside_cpuset_by_depth HWLOC_NAME(get_next_obj_inside_cpuset_by_depth)
|
||||||
|
#define hwloc_get_next_obj_inside_cpuset_by_type HWLOC_NAME(get_next_obj_inside_cpuset_by_type)
|
||||||
|
#define hwloc_get_obj_inside_cpuset_by_depth HWLOC_NAME(get_obj_inside_cpuset_by_depth)
|
||||||
|
#define hwloc_get_obj_inside_cpuset_by_type HWLOC_NAME(get_obj_inside_cpuset_by_type)
|
||||||
|
#define hwloc_get_nbobjs_inside_cpuset_by_depth HWLOC_NAME(get_nbobjs_inside_cpuset_by_depth)
|
||||||
|
#define hwloc_get_nbobjs_inside_cpuset_by_type HWLOC_NAME(get_nbobjs_inside_cpuset_by_type)
|
||||||
|
#define hwloc_get_obj_index_inside_cpuset HWLOC_NAME(get_obj_index_inside_cpuset)
|
||||||
|
#define hwloc_get_child_covering_cpuset HWLOC_NAME(get_child_covering_cpuset)
|
||||||
|
#define hwloc_get_obj_covering_cpuset HWLOC_NAME(get_obj_covering_cpuset)
|
||||||
|
#define hwloc_get_next_obj_covering_cpuset_by_depth HWLOC_NAME(get_next_obj_covering_cpuset_by_depth)
|
||||||
|
#define hwloc_get_next_obj_covering_cpuset_by_type HWLOC_NAME(get_next_obj_covering_cpuset_by_type)
|
||||||
|
#define hwloc_obj_type_is_normal HWLOC_NAME(obj_type_is_normal)
|
||||||
|
#define hwloc_obj_type_is_memory HWLOC_NAME(obj_type_is_memory)
|
||||||
|
#define hwloc_obj_type_is_io HWLOC_NAME(obj_type_is_io)
|
||||||
|
#define hwloc_obj_type_is_cache HWLOC_NAME(obj_type_is_cache)
|
||||||
|
#define hwloc_obj_type_is_dcache HWLOC_NAME(obj_type_is_dcache)
|
||||||
|
#define hwloc_obj_type_is_icache HWLOC_NAME(obj_type_is_icache)
|
||||||
|
#define hwloc_get_cache_type_depth HWLOC_NAME(get_cache_type_depth)
|
||||||
|
#define hwloc_get_cache_covering_cpuset HWLOC_NAME(get_cache_covering_cpuset)
|
||||||
|
#define hwloc_get_shared_cache_covering_obj HWLOC_NAME(get_shared_cache_covering_obj)
|
||||||
|
#define hwloc_get_closest_objs HWLOC_NAME(get_closest_objs)
|
||||||
|
#define hwloc_get_obj_below_by_type HWLOC_NAME(get_obj_below_by_type)
|
||||||
|
#define hwloc_get_obj_below_array_by_type HWLOC_NAME(get_obj_below_array_by_type)
|
||||||
|
#define hwloc_distrib_flags_e HWLOC_NAME(distrib_flags_e)
|
||||||
|
#define HWLOC_DISTRIB_FLAG_REVERSE HWLOC_NAME_CAPS(DISTRIB_FLAG_REVERSE)
|
||||||
|
#define hwloc_distrib HWLOC_NAME(distrib)
|
||||||
|
#define hwloc_alloc_membind_policy HWLOC_NAME(alloc_membind_policy)
|
||||||
|
#define hwloc_alloc_membind_policy_nodeset HWLOC_NAME(alloc_membind_policy_nodeset)
|
||||||
|
#define hwloc_topology_get_complete_cpuset HWLOC_NAME(topology_get_complete_cpuset)
|
||||||
|
#define hwloc_topology_get_topology_cpuset HWLOC_NAME(topology_get_topology_cpuset)
|
||||||
|
#define hwloc_topology_get_allowed_cpuset HWLOC_NAME(topology_get_allowed_cpuset)
|
||||||
|
#define hwloc_topology_get_complete_nodeset HWLOC_NAME(topology_get_complete_nodeset)
|
||||||
|
#define hwloc_topology_get_topology_nodeset HWLOC_NAME(topology_get_topology_nodeset)
|
||||||
|
#define hwloc_topology_get_allowed_nodeset HWLOC_NAME(topology_get_allowed_nodeset)
|
||||||
|
#define hwloc_cpuset_to_nodeset HWLOC_NAME(cpuset_to_nodeset)
|
||||||
|
#define hwloc_cpuset_from_nodeset HWLOC_NAME(cpuset_from_nodeset)
|
||||||
|
|
||||||
|
/* export.h */
|
||||||
|
|
||||||
|
#define hwloc_topology_export_xml_flags_e HWLOC_NAME(topology_export_xml_flags_e)
|
||||||
|
#define HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_XML_FLAG_V1)
|
||||||
|
#define hwloc_topology_export_xml HWLOC_NAME(topology_export_xml)
|
||||||
|
#define hwloc_topology_export_xmlbuffer HWLOC_NAME(topology_export_xmlbuffer)
|
||||||
|
#define hwloc_free_xmlbuffer HWLOC_NAME(free_xmlbuffer)
|
||||||
|
#define hwloc_topology_set_userdata_export_callback HWLOC_NAME(topology_set_userdata_export_callback)
|
||||||
|
#define hwloc_export_obj_userdata HWLOC_NAME(export_obj_userdata)
|
||||||
|
#define hwloc_export_obj_userdata_base64 HWLOC_NAME(export_obj_userdata_base64)
|
||||||
|
#define hwloc_topology_set_userdata_import_callback HWLOC_NAME(topology_set_userdata_import_callback)
|
||||||
|
|
||||||
|
#define hwloc_topology_export_synthetic_flags_e HWLOC_NAME(topology_export_synthetic_flags_e)
|
||||||
|
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES)
|
||||||
|
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS)
|
||||||
|
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1 HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1)
|
||||||
|
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY)
|
||||||
|
#define hwloc_topology_export_synthetic HWLOC_NAME(topology_export_synthetic)
|
||||||
|
|
||||||
|
/* distances.h */
|
||||||
|
|
||||||
|
#define hwloc_distances_s HWLOC_NAME(distances_s)
|
||||||
|
|
||||||
|
#define hwloc_distances_kind_e HWLOC_NAME(distances_kind_e)
|
||||||
|
#define HWLOC_DISTANCES_KIND_FROM_OS HWLOC_NAME_CAPS(DISTANCES_KIND_FROM_OS)
|
||||||
|
#define HWLOC_DISTANCES_KIND_FROM_USER HWLOC_NAME_CAPS(DISTANCES_KIND_FROM_USER)
|
||||||
|
#define HWLOC_DISTANCES_KIND_MEANS_LATENCY HWLOC_NAME_CAPS(DISTANCES_KIND_MEANS_LATENCY)
|
||||||
|
#define HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH HWLOC_NAME_CAPS(DISTANCES_KIND_MEANS_BANDWIDTH)
|
||||||
|
|
||||||
|
#define hwloc_distances_get HWLOC_NAME(distances_get)
|
||||||
|
#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_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)
|
||||||
|
#define hwloc_distances_remove_by_depth HWLOC_NAME(distances_remove_by_depth)
|
||||||
|
#define hwloc_distances_remove_by_type HWLOC_NAME(distances_remove_by_type)
|
||||||
|
|
||||||
|
/* diff.h */
|
||||||
|
|
||||||
|
#define hwloc_topology_diff_obj_attr_type_e HWLOC_NAME(topology_diff_obj_attr_type_e)
|
||||||
|
#define hwloc_topology_diff_obj_attr_type_t HWLOC_NAME(topology_diff_obj_attr_type_t)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_SIZE)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_NAME)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_INFO)
|
||||||
|
#define hwloc_topology_diff_obj_attr_u HWLOC_NAME(topology_diff_obj_attr_u)
|
||||||
|
#define hwloc_topology_diff_obj_attr_generic_s HWLOC_NAME(topology_diff_obj_attr_generic_s)
|
||||||
|
#define hwloc_topology_diff_obj_attr_uint64_s HWLOC_NAME(topology_diff_obj_attr_uint64_s)
|
||||||
|
#define hwloc_topology_diff_obj_attr_string_s HWLOC_NAME(topology_diff_obj_attr_string_s)
|
||||||
|
#define hwloc_topology_diff_type_e HWLOC_NAME(topology_diff_type_e)
|
||||||
|
#define hwloc_topology_diff_type_t HWLOC_NAME(topology_diff_type_t)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX HWLOC_NAME_CAPS(TOPOLOGY_DIFF_TOO_COMPLEX)
|
||||||
|
#define hwloc_topology_diff_u HWLOC_NAME(topology_diff_u)
|
||||||
|
#define hwloc_topology_diff_t HWLOC_NAME(topology_diff_t)
|
||||||
|
#define hwloc_topology_diff_generic_s HWLOC_NAME(topology_diff_generic_s)
|
||||||
|
#define hwloc_topology_diff_obj_attr_s HWLOC_NAME(topology_diff_obj_attr_s)
|
||||||
|
#define hwloc_topology_diff_too_complex_s HWLOC_NAME(topology_diff_too_complex_s)
|
||||||
|
#define hwloc_topology_diff_build HWLOC_NAME(topology_diff_build)
|
||||||
|
#define hwloc_topology_diff_apply_flags_e HWLOC_NAME(topology_diff_apply_flags_e)
|
||||||
|
#define HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE HWLOC_NAME_CAPS(TOPOLOGY_DIFF_APPLY_REVERSE)
|
||||||
|
#define hwloc_topology_diff_apply HWLOC_NAME(topology_diff_apply)
|
||||||
|
#define hwloc_topology_diff_destroy HWLOC_NAME(topology_diff_destroy)
|
||||||
|
#define hwloc_topology_diff_load_xml HWLOC_NAME(topology_diff_load_xml)
|
||||||
|
#define hwloc_topology_diff_export_xml HWLOC_NAME(topology_diff_export_xml)
|
||||||
|
#define hwloc_topology_diff_load_xmlbuffer HWLOC_NAME(topology_diff_load_xmlbuffer)
|
||||||
|
#define hwloc_topology_diff_export_xmlbuffer HWLOC_NAME(topology_diff_export_xmlbuffer)
|
||||||
|
|
||||||
|
/* shmem.h */
|
||||||
|
|
||||||
|
#define hwloc_shmem_topology_get_length HWLOC_NAME(shmem_topology_get_length)
|
||||||
|
#define hwloc_shmem_topology_write HWLOC_NAME(shmem_topology_write)
|
||||||
|
#define hwloc_shmem_topology_adopt HWLOC_NAME(shmem_topology_adopt)
|
||||||
|
|
||||||
|
/* glibc-sched.h */
|
||||||
|
|
||||||
|
#define hwloc_cpuset_to_glibc_sched_affinity HWLOC_NAME(cpuset_to_glibc_sched_affinity)
|
||||||
|
#define hwloc_cpuset_from_glibc_sched_affinity HWLOC_NAME(cpuset_from_glibc_sched_affinity)
|
||||||
|
|
||||||
|
/* linux-libnuma.h */
|
||||||
|
|
||||||
|
#define hwloc_cpuset_to_linux_libnuma_ulongs HWLOC_NAME(cpuset_to_linux_libnuma_ulongs)
|
||||||
|
#define hwloc_nodeset_to_linux_libnuma_ulongs HWLOC_NAME(nodeset_to_linux_libnuma_ulongs)
|
||||||
|
#define hwloc_cpuset_from_linux_libnuma_ulongs HWLOC_NAME(cpuset_from_linux_libnuma_ulongs)
|
||||||
|
#define hwloc_nodeset_from_linux_libnuma_ulongs HWLOC_NAME(nodeset_from_linux_libnuma_ulongs)
|
||||||
|
#define hwloc_cpuset_to_linux_libnuma_bitmask HWLOC_NAME(cpuset_to_linux_libnuma_bitmask)
|
||||||
|
#define hwloc_nodeset_to_linux_libnuma_bitmask HWLOC_NAME(nodeset_to_linux_libnuma_bitmask)
|
||||||
|
#define hwloc_cpuset_from_linux_libnuma_bitmask HWLOC_NAME(cpuset_from_linux_libnuma_bitmask)
|
||||||
|
#define hwloc_nodeset_from_linux_libnuma_bitmask HWLOC_NAME(nodeset_from_linux_libnuma_bitmask)
|
||||||
|
|
||||||
|
/* linux.h */
|
||||||
|
|
||||||
|
#define hwloc_linux_set_tid_cpubind HWLOC_NAME(linux_set_tid_cpubind)
|
||||||
|
#define hwloc_linux_get_tid_cpubind HWLOC_NAME(linux_get_tid_cpubind)
|
||||||
|
#define hwloc_linux_get_tid_last_cpu_location HWLOC_NAME(linux_get_tid_last_cpu_location)
|
||||||
|
#define hwloc_linux_read_path_as_cpumask HWLOC_NAME(linux_read_file_cpumask)
|
||||||
|
|
||||||
|
/* openfabrics-verbs.h */
|
||||||
|
|
||||||
|
#define hwloc_ibv_get_device_cpuset HWLOC_NAME(ibv_get_device_cpuset)
|
||||||
|
#define hwloc_ibv_get_device_osdev HWLOC_NAME(ibv_get_device_osdev)
|
||||||
|
#define hwloc_ibv_get_device_osdev_by_name HWLOC_NAME(ibv_get_device_osdev_by_name)
|
||||||
|
|
||||||
|
/* intel-mic.h */
|
||||||
|
|
||||||
|
#define hwloc_intel_mic_get_device_cpuset HWLOC_NAME(intel_mic_get_device_cpuset)
|
||||||
|
#define hwloc_intel_mic_get_device_osdev_by_index HWLOC_NAME(intel_mic_get_device_osdev_by_index)
|
||||||
|
|
||||||
|
/* opencl.h */
|
||||||
|
|
||||||
|
#define hwloc_opencl_get_device_cpuset HWLOC_NAME(opencl_get_device_cpuset)
|
||||||
|
#define hwloc_opencl_get_device_osdev HWLOC_NAME(opencl_get_device_osdev)
|
||||||
|
#define hwloc_opencl_get_device_osdev_by_index HWLOC_NAME(opencl_get_device_osdev_by_index)
|
||||||
|
|
||||||
|
/* cuda.h */
|
||||||
|
|
||||||
|
#define hwloc_cuda_get_device_pci_ids HWLOC_NAME(cuda_get_device_pci_ids)
|
||||||
|
#define hwloc_cuda_get_device_cpuset HWLOC_NAME(cuda_get_device_cpuset)
|
||||||
|
#define hwloc_cuda_get_device_pcidev HWLOC_NAME(cuda_get_device_pcidev)
|
||||||
|
#define hwloc_cuda_get_device_osdev HWLOC_NAME(cuda_get_device_osdev)
|
||||||
|
#define hwloc_cuda_get_device_osdev_by_index HWLOC_NAME(cuda_get_device_osdev_by_index)
|
||||||
|
|
||||||
|
/* cudart.h */
|
||||||
|
|
||||||
|
#define hwloc_cudart_get_device_pci_ids HWLOC_NAME(cudart_get_device_pci_ids)
|
||||||
|
#define hwloc_cudart_get_device_cpuset HWLOC_NAME(cudart_get_device_cpuset)
|
||||||
|
#define hwloc_cudart_get_device_pcidev HWLOC_NAME(cudart_get_device_pcidev)
|
||||||
|
#define hwloc_cudart_get_device_osdev_by_index HWLOC_NAME(cudart_get_device_osdev_by_index)
|
||||||
|
|
||||||
|
/* nvml.h */
|
||||||
|
|
||||||
|
#define hwloc_nvml_get_device_cpuset HWLOC_NAME(nvml_get_device_cpuset)
|
||||||
|
#define hwloc_nvml_get_device_osdev HWLOC_NAME(nvml_get_device_osdev)
|
||||||
|
#define hwloc_nvml_get_device_osdev_by_index HWLOC_NAME(nvml_get_device_osdev_by_index)
|
||||||
|
|
||||||
|
/* gl.h */
|
||||||
|
|
||||||
|
#define hwloc_gl_get_display_osdev_by_port_device HWLOC_NAME(gl_get_display_osdev_by_port_device)
|
||||||
|
#define hwloc_gl_get_display_osdev_by_name HWLOC_NAME(gl_get_display_osdev_by_name)
|
||||||
|
#define hwloc_gl_get_display_by_osdev HWLOC_NAME(gl_get_display_by_osdev)
|
||||||
|
|
||||||
|
/* hwloc/plugins.h */
|
||||||
|
|
||||||
|
#define hwloc_disc_component_type_e HWLOC_NAME(disc_component_type_e)
|
||||||
|
#define HWLOC_DISC_COMPONENT_TYPE_CPU HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_CPU)
|
||||||
|
#define HWLOC_DISC_COMPONENT_TYPE_GLOBAL HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_GLOBAL)
|
||||||
|
#define HWLOC_DISC_COMPONENT_TYPE_MISC HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_MISC)
|
||||||
|
#define hwloc_disc_component_type_t HWLOC_NAME(disc_component_type_t)
|
||||||
|
#define hwloc_disc_component HWLOC_NAME(disc_component)
|
||||||
|
|
||||||
|
#define hwloc_backend HWLOC_NAME(backend)
|
||||||
|
|
||||||
|
#define hwloc_backend_alloc HWLOC_NAME(backend_alloc)
|
||||||
|
#define hwloc_backend_enable HWLOC_NAME(backend_enable)
|
||||||
|
|
||||||
|
#define hwloc_component_type_e HWLOC_NAME(component_type_e)
|
||||||
|
#define HWLOC_COMPONENT_TYPE_DISC HWLOC_NAME_CAPS(COMPONENT_TYPE_DISC)
|
||||||
|
#define HWLOC_COMPONENT_TYPE_XML HWLOC_NAME_CAPS(COMPONENT_TYPE_XML)
|
||||||
|
#define hwloc_component_type_t HWLOC_NAME(component_type_t)
|
||||||
|
#define hwloc_component HWLOC_NAME(component)
|
||||||
|
|
||||||
|
#define hwloc_plugin_check_namespace HWLOC_NAME(plugin_check_namespace)
|
||||||
|
|
||||||
|
#define hwloc_insert_object_by_cpuset HWLOC_NAME(insert_object_by_cpuset)
|
||||||
|
#define hwloc_report_error_t HWLOC_NAME(report_error_t)
|
||||||
|
#define hwloc_report_os_error HWLOC_NAME(report_os_error)
|
||||||
|
#define hwloc_hide_errors HWLOC_NAME(hide_errors)
|
||||||
|
#define hwloc__insert_object_by_cpuset HWLOC_NAME(_insert_object_by_cpuset)
|
||||||
|
#define hwloc_insert_object_by_parent HWLOC_NAME(insert_object_by_parent)
|
||||||
|
#define hwloc_alloc_setup_object HWLOC_NAME(alloc_setup_object)
|
||||||
|
#define hwloc_obj_add_children_sets HWLOC_NAME(add_children_sets)
|
||||||
|
#define hwloc_topology_reconnect HWLOC_NAME(topology_reconnect)
|
||||||
|
|
||||||
|
#define hwloc_filter_check_pcidev_subtype_important HWLOC_NAME(filter_check_pcidev_subtype_important)
|
||||||
|
#define hwloc_filter_check_osdev_subtype_important HWLOC_NAME(filter_check_osdev_subtype_important)
|
||||||
|
#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_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 */
|
||||||
|
|
||||||
|
#define hwloc_topology_insert_misc_object_by_parent HWLOC_NAME(topology_insert_misc_object_by_parent)
|
||||||
|
#define hwloc_obj_cpuset_snprintf HWLOC_NAME(obj_cpuset_snprintf)
|
||||||
|
#define hwloc_obj_type_sscanf HWLOC_NAME(obj_type_sscanf)
|
||||||
|
|
||||||
|
#define hwloc_set_membind_nodeset HWLOC_NAME(set_membind_nodeset)
|
||||||
|
#define hwloc_get_membind_nodeset HWLOC_NAME(get_membind_nodeset)
|
||||||
|
#define hwloc_set_proc_membind_nodeset HWLOC_NAME(set_proc_membind_nodeset)
|
||||||
|
#define hwloc_get_proc_membind_nodeset HWLOC_NAME(get_proc_membind_nodeset)
|
||||||
|
#define hwloc_set_area_membind_nodeset HWLOC_NAME(set_area_membind_nodeset)
|
||||||
|
#define hwloc_get_area_membind_nodeset HWLOC_NAME(get_area_membind_nodeset)
|
||||||
|
#define hwloc_alloc_membind_nodeset HWLOC_NAME(alloc_membind_nodeset)
|
||||||
|
|
||||||
|
#define hwloc_cpuset_to_nodeset_strict HWLOC_NAME(cpuset_to_nodeset_strict)
|
||||||
|
#define hwloc_cpuset_from_nodeset_strict HWLOC_NAME(cpuset_from_nodeset_strict)
|
||||||
|
|
||||||
|
/* private/debug.h */
|
||||||
|
|
||||||
|
#define hwloc_debug_enabled HWLOC_NAME(debug_enabled)
|
||||||
|
#define hwloc_debug HWLOC_NAME(debug)
|
||||||
|
|
||||||
|
/* private/misc.h */
|
||||||
|
|
||||||
|
#define hwloc_snprintf HWLOC_NAME(snprintf)
|
||||||
|
#define hwloc_namecoloncmp HWLOC_NAME(namecoloncmp)
|
||||||
|
#define hwloc_ffsl_manual HWLOC_NAME(ffsl_manual)
|
||||||
|
#define hwloc_ffs32 HWLOC_NAME(ffs32)
|
||||||
|
#define hwloc_ffsl_from_ffs32 HWLOC_NAME(ffsl_from_ffs32)
|
||||||
|
#define hwloc_flsl_manual HWLOC_NAME(flsl_manual)
|
||||||
|
#define hwloc_fls32 HWLOC_NAME(fls32)
|
||||||
|
#define hwloc_flsl_from_fls32 HWLOC_NAME(flsl_from_fls32)
|
||||||
|
#define hwloc_weight_long HWLOC_NAME(weight_long)
|
||||||
|
#define hwloc_strncasecmp HWLOC_NAME(strncasecmp)
|
||||||
|
|
||||||
|
#define hwloc_bitmap_compare_inclusion HWLOC_NAME(bitmap_compare_inclusion)
|
||||||
|
|
||||||
|
#define hwloc_pci_class_string HWLOC_NAME(pci_class_string)
|
||||||
|
#define hwloc_linux_pci_link_speed_from_string HWLOC_NAME(linux_pci_link_speed_from_string)
|
||||||
|
|
||||||
|
#define hwloc_cache_type_by_depth_type HWLOC_NAME(cache_type_by_depth_type)
|
||||||
|
#define hwloc__obj_type_is_normal HWLOC_NAME(_obj_type_is_normal)
|
||||||
|
#define hwloc__obj_type_is_memory HWLOC_NAME(_obj_type_is_memory)
|
||||||
|
#define hwloc__obj_type_is_io HWLOC_NAME(_obj_type_is_io)
|
||||||
|
#define hwloc__obj_type_is_special HWLOC_NAME(_obj_type_is_special)
|
||||||
|
|
||||||
|
#define hwloc__obj_type_is_cache HWLOC_NAME(_obj_type_is_cache)
|
||||||
|
#define hwloc__obj_type_is_dcache HWLOC_NAME(_obj_type_is_dcache)
|
||||||
|
#define hwloc__obj_type_is_icache HWLOC_NAME(_obj_type_is_icache)
|
||||||
|
|
||||||
|
/* private/cpuid-x86.h */
|
||||||
|
|
||||||
|
#define hwloc_have_x86_cpuid HWLOC_NAME(have_x86_cpuid)
|
||||||
|
#define hwloc_x86_cpuid HWLOC_NAME(x86_cpuid)
|
||||||
|
|
||||||
|
/* private/xml.h */
|
||||||
|
|
||||||
|
#define hwloc__xml_verbose HWLOC_NAME(_xml_verbose)
|
||||||
|
|
||||||
|
#define hwloc__xml_import_state_s HWLOC_NAME(_xml_import_state_s)
|
||||||
|
#define hwloc__xml_import_state_t HWLOC_NAME(_xml_import_state_t)
|
||||||
|
#define hwloc__xml_import_diff HWLOC_NAME(_xml_import_diff)
|
||||||
|
#define hwloc_xml_backend_data_s HWLOC_NAME(xml_backend_data_s)
|
||||||
|
#define hwloc__xml_export_state_s HWLOC_NAME(_xml_export_state_s)
|
||||||
|
#define hwloc__xml_export_state_t HWLOC_NAME(_xml_export_state_t)
|
||||||
|
#define hwloc__xml_export_data_s HWLOC_NAME(_xml_export_data_s)
|
||||||
|
#define hwloc__xml_export_topology HWLOC_NAME(_xml_export_topology)
|
||||||
|
#define hwloc__xml_export_diff HWLOC_NAME(_xml_export_diff)
|
||||||
|
|
||||||
|
#define hwloc_xml_callbacks HWLOC_NAME(xml_callbacks)
|
||||||
|
#define hwloc_xml_component HWLOC_NAME(xml_component)
|
||||||
|
#define hwloc_xml_callbacks_register HWLOC_NAME(xml_callbacks_register)
|
||||||
|
#define hwloc_xml_callbacks_reset HWLOC_NAME(xml_callbacks_reset)
|
||||||
|
|
||||||
|
#define hwloc__xml_imported_v1distances_s HWLOC_NAME(_xml_imported_v1distances_s)
|
||||||
|
|
||||||
|
/* private/components.h */
|
||||||
|
|
||||||
|
#define hwloc_disc_component_force_enable HWLOC_NAME(disc_component_force_enable)
|
||||||
|
#define hwloc_disc_components_enable_others HWLOC_NAME(disc_components_instantiate_others)
|
||||||
|
|
||||||
|
#define hwloc_backends_is_thissystem HWLOC_NAME(backends_is_thissystem)
|
||||||
|
#define hwloc_backends_find_callbacks HWLOC_NAME(backends_find_callbacks)
|
||||||
|
|
||||||
|
#define hwloc_backends_init HWLOC_NAME(backends_init)
|
||||||
|
#define hwloc_backends_disable_all HWLOC_NAME(backends_disable_all)
|
||||||
|
|
||||||
|
#define hwloc_components_init HWLOC_NAME(components_init)
|
||||||
|
#define hwloc_components_fini HWLOC_NAME(components_fini)
|
||||||
|
|
||||||
|
/* private/internal-private.h */
|
||||||
|
|
||||||
|
#define hwloc_xml_component HWLOC_NAME(xml_component)
|
||||||
|
#define hwloc_synthetic_component HWLOC_NAME(synthetic_component)
|
||||||
|
|
||||||
|
#define hwloc_aix_component HWLOC_NAME(aix_component)
|
||||||
|
#define hwloc_bgq_component HWLOC_NAME(bgq_component)
|
||||||
|
#define hwloc_darwin_component HWLOC_NAME(darwin_component)
|
||||||
|
#define hwloc_freebsd_component HWLOC_NAME(freebsd_component)
|
||||||
|
#define hwloc_hpux_component HWLOC_NAME(hpux_component)
|
||||||
|
#define hwloc_linux_component HWLOC_NAME(linux_component)
|
||||||
|
#define hwloc_netbsd_component HWLOC_NAME(netbsd_component)
|
||||||
|
#define hwloc_noos_component HWLOC_NAME(noos_component)
|
||||||
|
#define hwloc_solaris_component HWLOC_NAME(solaris_component)
|
||||||
|
#define hwloc_windows_component HWLOC_NAME(windows_component)
|
||||||
|
#define hwloc_x86_component HWLOC_NAME(x86_component)
|
||||||
|
|
||||||
|
#define hwloc_cuda_component HWLOC_NAME(cuda_component)
|
||||||
|
#define hwloc_gl_component HWLOC_NAME(gl_component)
|
||||||
|
#define hwloc_linuxio_component HWLOC_NAME(linuxio_component)
|
||||||
|
#define hwloc_nvml_component HWLOC_NAME(nvml_component)
|
||||||
|
#define hwloc_opencl_component HWLOC_NAME(opencl_component)
|
||||||
|
#define hwloc_pci_component HWLOC_NAME(pci_component)
|
||||||
|
|
||||||
|
#define hwloc_xml_libxml_component HWLOC_NAME(xml_libxml_component)
|
||||||
|
#define hwloc_xml_nolibxml_component HWLOC_NAME(xml_nolibxml_component)
|
||||||
|
|
||||||
|
/* private/private.h */
|
||||||
|
|
||||||
|
#define hwloc_special_level_s HWLOC_NAME(special_level_s)
|
||||||
|
|
||||||
|
#define hwloc_pci_forced_locality_s HWLOC_NAME(pci_forced_locality_s)
|
||||||
|
|
||||||
|
#define hwloc_alloc_root_sets HWLOC_NAME(alloc_root_sets)
|
||||||
|
#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
|
||||||
|
#define hwloc_get_sysctlbyname HWLOC_NAME(get_sysctlbyname)
|
||||||
|
#define hwloc_get_sysctl HWLOC_NAME(get_sysctl)
|
||||||
|
#define hwloc_fallback_nbprocessors HWLOC_NAME(fallback_nbprocessors)
|
||||||
|
|
||||||
|
#define hwloc__object_cpusets_compare_first HWLOC_NAME(_object_cpusets_compare_first)
|
||||||
|
#define hwloc__reorder_children HWLOC_NAME(_reorder_children)
|
||||||
|
|
||||||
|
#define hwloc_topology_setup_defaults HWLOC_NAME(topology_setup_defaults)
|
||||||
|
#define hwloc_topology_clear HWLOC_NAME(topology_clear)
|
||||||
|
|
||||||
|
#define hwloc__attach_memory_object HWLOC_NAME(insert_memory_object)
|
||||||
|
|
||||||
|
#define hwloc_pci_discovery_init HWLOC_NAME(pci_discovery_init)
|
||||||
|
#define hwloc_pci_discovery_prepare HWLOC_NAME(pci_discovery_prepare)
|
||||||
|
#define hwloc_pci_discovery_exit HWLOC_NAME(pci_discovery_exit)
|
||||||
|
#define hwloc_find_insert_io_parent_by_complete_cpuset HWLOC_NAME(hwloc_find_insert_io_parent_by_complete_cpuset)
|
||||||
|
#define hwloc_pci_belowroot_apply_locality HWLOC_NAME(pci_belowroot_apply_locality)
|
||||||
|
|
||||||
|
#define hwloc__add_info HWLOC_NAME(_add_info)
|
||||||
|
#define hwloc__add_info_nodup HWLOC_NAME(_add_info_nodup)
|
||||||
|
#define hwloc__move_infos HWLOC_NAME(_move_infos)
|
||||||
|
#define hwloc__free_infos HWLOC_NAME(_free_infos)
|
||||||
|
|
||||||
|
#define hwloc_binding_hooks HWLOC_NAME(binding_hooks)
|
||||||
|
#define hwloc_set_native_binding_hooks HWLOC_NAME(set_native_binding_hooks)
|
||||||
|
#define hwloc_set_binding_hooks HWLOC_NAME(set_binding_hooks)
|
||||||
|
|
||||||
|
#define hwloc_set_linuxfs_hooks HWLOC_NAME(set_linuxfs_hooks)
|
||||||
|
#define hwloc_set_bgq_hooks HWLOC_NAME(set_bgq_hooks)
|
||||||
|
#define hwloc_set_solaris_hooks HWLOC_NAME(set_solaris_hooks)
|
||||||
|
#define hwloc_set_aix_hooks HWLOC_NAME(set_aix_hooks)
|
||||||
|
#define hwloc_set_windows_hooks HWLOC_NAME(set_windows_hooks)
|
||||||
|
#define hwloc_set_darwin_hooks HWLOC_NAME(set_darwin_hooks)
|
||||||
|
#define hwloc_set_freebsd_hooks HWLOC_NAME(set_freebsd_hooks)
|
||||||
|
#define hwloc_set_netbsd_hooks HWLOC_NAME(set_netbsd_hooks)
|
||||||
|
#define hwloc_set_hpux_hooks HWLOC_NAME(set_hpux_hooks)
|
||||||
|
|
||||||
|
#define hwloc_look_hardwired_fujitsu_k HWLOC_NAME(look_hardwired_fujitsu_k)
|
||||||
|
#define hwloc_look_hardwired_fujitsu_fx10 HWLOC_NAME(look_hardwired_fujitsu_fx10)
|
||||||
|
#define hwloc_look_hardwired_fujitsu_fx100 HWLOC_NAME(look_hardwired_fujitsu_fx100)
|
||||||
|
|
||||||
|
#define hwloc_add_uname_info HWLOC_NAME(add_uname_info)
|
||||||
|
#define hwloc_free_unlinked_object HWLOC_NAME(free_unlinked_object)
|
||||||
|
#define hwloc_free_object_and_children HWLOC_NAME(free_object_and_children)
|
||||||
|
#define hwloc_free_object_siblings_and_children HWLOC_NAME(free_object_siblings_and_children)
|
||||||
|
|
||||||
|
#define hwloc_alloc_heap HWLOC_NAME(alloc_heap)
|
||||||
|
#define hwloc_alloc_mmap HWLOC_NAME(alloc_mmap)
|
||||||
|
#define hwloc_free_heap HWLOC_NAME(free_heap)
|
||||||
|
#define hwloc_free_mmap HWLOC_NAME(free_mmap)
|
||||||
|
#define hwloc_alloc_or_fail HWLOC_NAME(alloc_or_fail)
|
||||||
|
|
||||||
|
#define hwloc_internal_distances_s HWLOC_NAME(internal_distances_s)
|
||||||
|
#define hwloc_internal_distances_init HWLOC_NAME(internal_distances_init)
|
||||||
|
#define hwloc_internal_distances_prepare HWLOC_NAME(internal_distances_prepare)
|
||||||
|
#define hwloc_internal_distances_dup HWLOC_NAME(internal_distances_dup)
|
||||||
|
#define hwloc_internal_distances_refresh HWLOC_NAME(internal_distances_refresh)
|
||||||
|
#define hwloc_internal_distances_destroy HWLOC_NAME(internal_distances_destroy)
|
||||||
|
|
||||||
|
#define hwloc_internal_distances_add HWLOC_NAME(internal_distances_add)
|
||||||
|
#define hwloc_internal_distances_add_by_index HWLOC_NAME(internal_distances_add_by_index)
|
||||||
|
#define hwloc_internal_distances_invalidate_cached_objs HWLOC_NAME(hwloc_internal_distances_invalidate_cached_objs)
|
||||||
|
|
||||||
|
#define hwloc_encode_to_base64 HWLOC_NAME(encode_to_base64)
|
||||||
|
#define hwloc_decode_from_base64 HWLOC_NAME(decode_from_base64)
|
||||||
|
|
||||||
|
#define hwloc_progname HWLOC_NAME(progname)
|
||||||
|
|
||||||
|
#define hwloc__topology_disadopt HWLOC_NAME(_topology_disadopt)
|
||||||
|
#define hwloc__topology_dup HWLOC_NAME(_topology_dup)
|
||||||
|
|
||||||
|
#define hwloc_tma HWLOC_NAME(tma)
|
||||||
|
#define hwloc_tma_malloc HWLOC_NAME(tma_malloc)
|
||||||
|
#define hwloc_tma_calloc HWLOC_NAME(tma_calloc)
|
||||||
|
#define hwloc_tma_strdup HWLOC_NAME(tma_strdup)
|
||||||
|
#define hwloc_bitmap_tma_dup HWLOC_NAME(bitmap_tma_dup)
|
||||||
|
|
||||||
|
/* private/solaris-chiptype.h */
|
||||||
|
|
||||||
|
#define hwloc_solaris_chip_info_s HWLOC_NAME(solaris_chip_info_s)
|
||||||
|
#define hwloc_solaris_get_chip_info HWLOC_NAME(solaris_get_chip_info)
|
||||||
|
|
||||||
|
#endif /* HWLOC_SYM_TRANSFORM */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_RENAME_H */
|
||||||
137
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
Normal file
137
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2013-2018 Inria. All rights reserved.
|
||||||
|
* See COPYING in top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \brief Sharing topologies between processes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_SHMEM_H
|
||||||
|
#define HWLOC_SHMEM_H
|
||||||
|
|
||||||
|
#include <hwloc.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#elif 0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \defgroup hwlocality_shmem Sharing topologies between processes
|
||||||
|
*
|
||||||
|
* These functions are used to share a topology between processes by
|
||||||
|
* duplicating it into a file-backed shared-memory buffer.
|
||||||
|
*
|
||||||
|
* The master process must first get the required shared-memory size
|
||||||
|
* for storing this topology with hwloc_shmem_topology_get_length().
|
||||||
|
*
|
||||||
|
* Then it must find a virtual memory area of that size that is available
|
||||||
|
* in all processes (identical virtual addresses in all processes).
|
||||||
|
* On Linux, this can be done by comparing holes found in /proc/\<pid\>/maps
|
||||||
|
* for each process.
|
||||||
|
*
|
||||||
|
* Once found, it must open a destination file for storing the buffer,
|
||||||
|
* and pass it to hwloc_shmem_topology_write() together with
|
||||||
|
* virtual memory address and length obtained above.
|
||||||
|
*
|
||||||
|
* Other processes may then adopt this shared topology by opening the
|
||||||
|
* same file and passing it to hwloc_shmem_topology_adopt() with the
|
||||||
|
* exact same virtual memory address and length.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \brief Get the required shared memory length for storing a topology.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_shmem_topology_get_length(hwloc_topology_t topology,
|
||||||
|
size_t *lengthp,
|
||||||
|
unsigned long flags);
|
||||||
|
|
||||||
|
/** \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 in there.
|
||||||
|
*
|
||||||
|
* The segment of the file pointed by descriptor \p fd,
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* \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,
|
||||||
|
void *mmap_address, size_t length,
|
||||||
|
unsigned long flags);
|
||||||
|
|
||||||
|
/** \brief Adopt a shared memory topology stored in a file.
|
||||||
|
*
|
||||||
|
* Map a file in virtual memory and adopt the topology that was previously
|
||||||
|
* stored there with hwloc_shmem_topology_write().
|
||||||
|
*
|
||||||
|
* 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 (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.
|
||||||
|
*
|
||||||
|
* \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.
|
||||||
|
*
|
||||||
|
* \note This function takes care of calling hwloc_topology_abi_check().
|
||||||
|
*
|
||||||
|
* \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, or do not match what was given to
|
||||||
|
* hwloc_shmem_topology_write() earlier.
|
||||||
|
*
|
||||||
|
* \return -1 with errno set to EINVAL if the layout of the topology structure
|
||||||
|
* is different between the writer process and the adopter process.
|
||||||
|
*/
|
||||||
|
HWLOC_DECLSPEC int hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
|
||||||
|
int fd, hwloc_uint64_t fileoffset,
|
||||||
|
void *mmap_address, size_t length,
|
||||||
|
unsigned long flags);
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HWLOC_SHMEM_H */
|
||||||
672
src/3rdparty/hwloc/include/private/autogen/config.h
vendored
Normal file
672
src/3rdparty/hwloc/include/private/autogen/config.h
vendored
Normal file
@@ -0,0 +1,672 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2009, 2011, 2012 CNRS. All rights reserved.
|
||||||
|
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||||
|
* Copyright © 2009, 2011, 2012, 2015 Université Bordeaux. All rights reserved.
|
||||||
|
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HWLOC_CONFIGURE_H
|
||||||
|
#define HWLOC_CONFIGURE_H
|
||||||
|
|
||||||
|
#define DECLSPEC_EXPORTS
|
||||||
|
|
||||||
|
#define HWLOC_HAVE_MSVC_CPUIDEX 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
|
||||||
|
#define HAVE_CACHE_DESCRIPTOR 0
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
|
||||||
|
#define HAVE_CACHE_RELATIONSHIP 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `clz' function. */
|
||||||
|
/* #undef HAVE_CLZ */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `clzl' function. */
|
||||||
|
/* #undef HAVE_CLZL */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <CL/cl_ext.h> header file. */
|
||||||
|
/* #undef HAVE_CL_CL_EXT_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cpuset_setaffinity' function. */
|
||||||
|
/* #undef HAVE_CPUSET_SETAFFINITY */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cpuset_setid' function. */
|
||||||
|
/* #undef HAVE_CPUSET_SETID */
|
||||||
|
|
||||||
|
/* Define to 1 if we have -lcuda */
|
||||||
|
/* #undef HAVE_CUDA */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cuda.h> header file. */
|
||||||
|
/* #undef HAVE_CUDA_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <cuda_runtime_api.h> header file. */
|
||||||
|
/* #undef HAVE_CUDA_RUNTIME_API_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `CL_DEVICE_TOPOLOGY_AMD', and to
|
||||||
|
0 if you don't. */
|
||||||
|
/* #undef HAVE_DECL_CL_DEVICE_TOPOLOGY_AMD */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `CTL_HW', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
/* #undef HAVE_DECL_CTL_HW */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `fabsf', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#define HAVE_DECL_FABSF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `modff', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#define HAVE_DECL_MODFF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
/* #undef HAVE_DECL_HW_NCPU */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of
|
||||||
|
`nvmlDeviceGetMaxPcieLinkGeneration', and to 0 if you don't. */
|
||||||
|
/* #undef HAVE_DECL_NVMLDEVICEGETMAXPCIELINKGENERATION */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `pthread_getaffinity_np', and to
|
||||||
|
0 if you don't. */
|
||||||
|
#define HAVE_DECL_PTHREAD_GETAFFINITY_NP 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `pthread_setaffinity_np', and to
|
||||||
|
0 if you don't. */
|
||||||
|
#define HAVE_DECL_PTHREAD_SETAFFINITY_NP 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_STRTOULL 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
/* #undef HWLOC_HAVE_DECL_STRCASECMP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_SNPRINTF 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_strdup', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL__STRDUP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_putenv', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL__PUTENV 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0
|
||||||
|
if you don't. */
|
||||||
|
#define HAVE_DECL__SC_LARGE_PAGESIZE 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_CONF', and to 0
|
||||||
|
if you don't. */
|
||||||
|
#define HAVE_DECL__SC_NPROCESSORS_CONF 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_ONLN', and to 0
|
||||||
|
if you don't. */
|
||||||
|
#define HAVE_DECL__SC_NPROCESSORS_ONLN 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_NPROC_CONF', and to 0 if
|
||||||
|
you don't. */
|
||||||
|
#define HAVE_DECL__SC_NPROC_CONF 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_NPROC_ONLN', and to 0 if
|
||||||
|
you don't. */
|
||||||
|
#define HAVE_DECL__SC_NPROC_ONLN 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_PAGESIZE', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL__SC_PAGESIZE 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `_SC_PAGE_SIZE', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL__SC_PAGE_SIZE 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dirent.h> header file. */
|
||||||
|
/* #define HAVE_DIRENT_H 1 */
|
||||||
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
/* #undef HAVE_DLFCN_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ffs' function. */
|
||||||
|
/* #undef HAVE_FFS */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ffsl' function. */
|
||||||
|
/* #undef HAVE_FFSL */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fls' function. */
|
||||||
|
/* #undef HAVE_FLS */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `flsl' function. */
|
||||||
|
/* #undef HAVE_FLSL */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#define HAVE_GETPAGESIZE 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `GROUP_AFFINITY'. */
|
||||||
|
#define HAVE_GROUP_AFFINITY 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
|
||||||
|
#define HAVE_GROUP_RELATIONSHIP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `host_info' function. */
|
||||||
|
/* #undef HAVE_HOST_INFO */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <infiniband/verbs.h> header file. */
|
||||||
|
/* #undef HAVE_INFINIBAND_VERBS_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `KAFFINITY'. */
|
||||||
|
#define HAVE_KAFFINITY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <kstat.h> header file. */
|
||||||
|
/* #undef HAVE_KSTAT_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <langinfo.h> header file. */
|
||||||
|
/* #undef HAVE_LANGINFO_H */
|
||||||
|
|
||||||
|
/* Define to 1 if we have -lgdi32 */
|
||||||
|
#define HAVE_LIBGDI32 1
|
||||||
|
|
||||||
|
/* Define to 1 if we have -libverbs */
|
||||||
|
/* #undef HAVE_LIBIBVERBS */
|
||||||
|
|
||||||
|
/* Define to 1 if we have -lkstat */
|
||||||
|
/* #undef HAVE_LIBKSTAT */
|
||||||
|
|
||||||
|
/* Define to 1 if we have -llgrp */
|
||||||
|
/* #undef HAVE_LIBLGRP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
|
#define HAVE_LOCALE_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
|
||||||
|
#define HAVE_LOGICAL_PROCESSOR_RELATIONSHIP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <mach/mach_host.h> header file. */
|
||||||
|
/* #undef HAVE_MACH_MACH_HOST_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <mach/mach_init.h> header file. */
|
||||||
|
/* #undef HAVE_MACH_MACH_INIT_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc.h> header file. */
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||