Commit ec17b702 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Convert affinity control from the deprecated PLPA to HWLOC

parent d07b043e
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* 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-only helpers
*
* This includes helpers for manipulating linux kernel cpumap files, and hwloc
* equivalents of the Linux sched_setaffinity and sched_getaffinity system calls.
*
* @{
*/
/** \brief Convert a linux kernel cpumap file \p file into hwloc CPU set.
*
* Might be used when reading CPU set from sysfs attributes such as topology
* and caches for processors, or local_cpus for devices.
*/
HWLOC_DECLSPEC int hwloc_linux_parse_cpumap_file(FILE *file, hwloc_cpuset_t set);
/** \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.
*/
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.
*/
HWLOC_DECLSPEC int hwloc_linux_get_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_cpuset_t set);
/** @} */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_GLIBC_SCHED_H */
/*
* Copyright © 2010 INRIA. All rights reserved.
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/** \file
* \brief Macros to help interaction between hwloc and Myrinet Express.
*
* Applications that use both hwloc and Myrinet Express verbs may want to
* include this file so as to get topology information for Myrinet hardware.
*
*/
#ifndef HWLOC_MYRIEXPRESS_H
#define HWLOC_MYRIEXPRESS_H
#include <hwloc.h>
#include <hwloc/autogen/config.h>
#include <hwloc/linux.h>
#include <myriexpress.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup hwlocality_myriexpress Myrinet Express-Specific Functions
* @{
*/
/** \brief Get the CPU set of logical processors that are physically
* close the MX board \p id.
*
* For the given Myrinet Express board index \p id, read the
* OS-provided NUMA node and return the corresponding CPU set.
*/
static __hwloc_inline int
hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology,
unsigned id, hwloc_cpuset_t set)
{
uint32_t in, out;
in = id;
if (mx_get_info(NULL, MX_NUMA_NODE, &in, sizeof(in), &out, sizeof(out)) != MX_SUCCESS) {
errno = EINVAL;
return -1;
}
if (out != (uint32_t) -1) {
hwloc_obj_t obj = NULL;
while ((obj = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NODE, obj)) != NULL)
if (obj->os_index == out) {
hwloc_bitmap_copy(set, obj->cpuset);
goto out;
}
}
/* fallback to the full topology cpuset */
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
out:
return 0;
}
/** \brief Get the CPU set of logical processors that are physically
* close to endpoint \p endpoint.
*
* For the given Myrinet Express endpoint \p endpoint, read the
* OS-provided NUMA node and return the corresponding CPU set.
*/
static __hwloc_inline int
hwloc_mx_endpoint_get_device_cpuset(hwloc_topology_t topology,
mx_endpoint_t endpoint, hwloc_cpuset_t set)
{
uint64_t nid;
uint32_t nindex, eid;
mx_endpoint_addr_t eaddr;
if (mx_get_endpoint_addr(endpoint, &eaddr) != MX_SUCCESS) {
errno = EINVAL;
return -1;
}
if (mx_decompose_endpoint_addr(eaddr, &nid, &eid) != MX_SUCCESS) {
errno = EINVAL;
return -1;
}
if (mx_nic_id_to_board_number(nid, &nindex) != MX_SUCCESS) {
errno = EINVAL;
return -1;
}
return hwloc_mx_board_get_device_cpuset(topology, nindex, set);
}
/** @} */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_MYRIEXPRESS_H */
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* 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.
*
*/
#ifndef HWLOC_OPENFABRICS_VERBS_H
#define HWLOC_OPENFABRICS_VERBS_H
#include <hwloc.h>
#include <hwloc/autogen/config.h>
#include <hwloc/linux.h>
#include <infiniband/verbs.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup hwlocality_openfabrics OpenFabrics-Specific Functions
* @{
*/
/** \brief Get the CPU set of logical processors that are physically
* close to device \p ibdev.
*
* For the given OpenFabrics device \p ibdev, read the corresponding
* kernel-provided cpumap file and return the corresponding CPU set.
* 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];
FILE *sysfile = NULL;
sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
ibv_get_device_name(ibdev));
sysfile = fopen(path, "r");
if (!sysfile)
return -1;
hwloc_linux_parse_cpumap_file(sysfile, set);
fclose(sysfile);
#else
/* Non-Linux systems simply get a full cpuset */
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
#endif
return 0;
}
/** @} */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_OPENFABRICS_VERBS_H */
/*
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010-2011 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_SYSTEM HWLOC_NAME_CAPS(OBJ_SYSTEM)
#define HWLOC_OBJ_MACHINE HWLOC_NAME_CAPS(OBJ_MACHINE)
#define HWLOC_OBJ_NODE HWLOC_NAME_CAPS(OBJ_NODE)
#define HWLOC_OBJ_SOCKET HWLOC_NAME_CAPS(OBJ_SOCKET)
#define HWLOC_OBJ_CACHE HWLOC_NAME_CAPS(OBJ_CACHE)
#define HWLOC_OBJ_CORE HWLOC_NAME_CAPS(OBJ_CORE)
#define HWLOC_OBJ_PU HWLOC_NAME_CAPS(OBJ_PU)
#define HWLOC_OBJ_MISC HWLOC_NAME_CAPS(OBJ_MISC)
#define HWLOC_OBJ_GROUP HWLOC_NAME_CAPS(OBJ_GROUP)
#define HWLOC_OBJ_TYPE_MAX HWLOC_NAME_CAPS(OBJ_TYPE_MAX)
#define hwloc_obj_type_t HWLOC_NAME(obj_type_t)
#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_memory_s HWLOC_NAME(obj_memory_s)
#define hwloc_obj_memory_page_type_s HWLOC_NAME(obj_memory_page_type_s)
#define hwloc_obj HWLOC_NAME(obj)
#define hwloc_obj_t HWLOC_NAME(obj_t)
#define hwloc_distances_s HWLOC_NAME(distances_s)
#define hwloc_obj_info_s HWLOC_NAME(obj_info_s)
#define hwloc_obj_attr_u HWLOC_NAME(obj_attr_u)
#define hwloc_cache_attr_s HWLOC_NAME(cache_attr_s)
#define hwloc_group_attr_s HWLOC_NAME(group_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_check HWLOC_NAME(topology_check)
#define hwloc_topology_ignore_type HWLOC_NAME(topology_ignore_type)
#define hwloc_topology_ignore_type_keep_structure HWLOC_NAME(topology_ignore_type_keep_structure)
#define hwloc_topology_ignore_all_keep_structure HWLOC_NAME(topology_ignore_all_keep_structure)
#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_set_flags HWLOC_NAME(topology_set_flags)
#define hwloc_topology_set_fsroot HWLOC_NAME(topology_set_fsroot)
#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_distance_matrix HWLOC_NAME(topology_set_distance_matrix)
#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_topology_export_xml HWLOC_NAME(topology_export_xml)
#define hwloc_topology_export_xmlbuffer HWLOC_NAME(topology_export_xmlbuffer)
#define hwloc_topology_insert_misc_object_by_cpuset HWLOC_NAME(topology_insert_misc_object_by_cpuset)
#define hwloc_topology_insert_misc_object_by_parent HWLOC_NAME(topology_insert_misc_object_by_parent)
#define hwloc_restrict_flags_e HWLOC_NAME(restrict_flags_e)
#define HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_DISTANCES)
#define HWLOC_RESTRICT_FLAG_ADAPT_MISC HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_MISC)
#define hwloc_topology_restrict HWLOC_NAME(topology_restrict)
#define hwloc_topology_get_depth HWLOC_NAME(topology_get_depth)
#define hwloc_get_type_depth HWLOC_NAME(get_type_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_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_topology_is_thissystem HWLOC_NAME(topology_is_thissystem)
#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_of_string HWLOC_NAME(obj_type_of_string )
#define hwloc_obj_type_snprintf HWLOC_NAME(obj_type_snprintf )
#define hwloc_obj_attr_snprintf HWLOC_NAME(obj_attr_snprintf )
#define hwloc_obj_snprintf HWLOC_NAME(obj_snprintf)
#define hwloc_obj_cpuset_snprintf HWLOC_NAME(obj_cpuset_snprintf)
#define hwloc_obj_get_info_by_name HWLOC_NAME(obj_get_info_by_name)
#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_REPLICATE HWLOC_NAME_CAPS(MEMBIND_REPLICATE)
#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_flags_t HWLOC_NAME(membind_flags_t)
#define hwloc_set_membind_nodeset HWLOC_NAME(set_membind_nodeset)
#define hwloc_set_membind HWLOC_NAME(set_membind)
#define hwloc_get_membind_nodeset HWLOC_NAME(get_membind_nodeset)
#define hwloc_get_membind HWLOC_NAME(get_membind)
#define hwloc_set_proc_membind_nodeset HWLOC_NAME(set_proc_membind_nodeset)
#define hwloc_set_proc_membind HWLOC_NAME(set_proc_membind)
#define hwloc_get_proc_membind_nodeset HWLOC_NAME(get_proc_membind_nodeset)
#define hwloc_get_proc_membind HWLOC_NAME(get_proc_membind)
#define hwloc_set_area_membind_nodeset HWLOC_NAME(set_area_membind_nodeset)
#define hwloc_set_area_membind HWLOC_NAME(set_area_membind)
#define hwloc_get_area_membind_nodeset HWLOC_NAME(get_area_membind_nodeset)
#define hwloc_get_area_membind HWLOC_NAME(get_area_membind)
#define hwloc_alloc_membind_nodeset HWLOC_NAME(alloc_membind_nodeset)
#define hwloc_alloc_membind HWLOC_NAME(alloc_membind)
#define hwloc_alloc HWLOC_NAME(alloc)
#define hwloc_free HWLOC_NAME(free)
/* hwloc/bitmap.h */
#define hwloc_bitmap HWLOC_NAME(bitmap)
#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_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/cpuset.h -- deprecated but still available */
#define hwloc_cpuset HWLOC_NAME(cpuset)
#define hwloc_cpuset_s HWLOC_NAME(cpuset_s)
#define hwloc_cpuset_t HWLOC_NAME(cpuset_t)
#define hwloc_const_cpuset_t HWLOC_NAME(const_cpuset_t)
#define hwloc_cpuset_alloc HWLOC_NAME(cpuset_alloc)
#define hwloc_cpuset_free HWLOC_NAME(cpuset_free)
#define hwloc_cpuset_dup HWLOC_NAME(cpuset_dup)
#define hwloc_cpuset_copy HWLOC_NAME(cpuset_copy)
#define hwloc_cpuset_snprintf HWLOC_NAME(cpuset_snprintf)
#define hwloc_cpuset_asprintf HWLOC_NAME(cpuset_asprintf)
#define hwloc_cpuset_from_string HWLOC_NAME(cpuset_from_string)
#define hwloc_cpuset_zero HWLOC_NAME(cpuset_zero)
#define hwloc_cpuset_fill HWLOC_NAME(cpuset_fill)
#define hwloc_cpuset_from_ulong HWLOC_NAME(cpuset_from_ulong)
#define hwloc_cpuset_from_ith_ulong HWLOC_NAME(cpuset_from_ith_ulong)
#define hwloc_cpuset_to_ulong HWLOC_NAME(cpuset_to_ulong)
#define hwloc_cpuset_to_ith_ulong HWLOC_NAME(cpuset_to_ith_ulong)
#define hwloc_cpuset_cpu HWLOC_NAME(cpuset_cpu)
#define hwloc_cpuset_all_but_cpu HWLOC_NAME(cpuset_all_but_cpu)
#define hwloc_cpuset_set HWLOC_NAME(cpuset_set)
#define hwloc_cpuset_set_range HWLOC_NAME(cpuset_set_range)
#define hwloc_cpuset_set_ith_ulong HWLOC_NAME(cpuset_set_ith_ulong)
#define hwloc_cpuset_clr HWLOC_NAME(cpuset_clr)
#define hwloc_cpuset_clr_range HWLOC_NAME(cpuset_clr_range)
#define hwloc_cpuset_isset HWLOC_NAME(cpuset_isset)
#define hwloc_cpuset_iszero HWLOC_NAME(cpuset_iszero)
#define hwloc_cpuset_isfull HWLOC_NAME(cpuset_isfull)
#define hwloc_cpuset_isequal HWLOC_NAME(cpuset_isequal)
#define hwloc_cpuset_intersects HWLOC_NAME(cpuset_intersects)
#define hwloc_cpuset_isincluded HWLOC_NAME(cpuset_isincluded)
#define hwloc_cpuset_or HWLOC_NAME(cpuset_or)
#define hwloc_cpuset_and HWLOC_NAME(cpuset_and)
#define hwloc_cpuset_andnot HWLOC_NAME(cpuset_andnot)
#define hwloc_cpuset_xor HWLOC_NAME(cpuset_xor)
#define hwloc_cpuset_not HWLOC_NAME(cpuset_not)
#define hwloc_cpuset_first HWLOC_NAME(cpuset_first)
#define hwloc_cpuset_last HWLOC_NAME(cpuset_last)
#define hwloc_cpuset_next HWLOC_NAME(cpuset_next)
#define hwloc_cpuset_singlify HWLOC_NAME(cpuset_singlify)
#define hwloc_cpuset_compare_first HWLOC_NAME(cpuset_compare_first)
#define hwloc_cpuset_compare HWLOC_NAME(cpuset_compare)
#define hwloc_cpuset_weight HWLOC_NAME(cpuset_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_system_obj HWLOC_NAME(get_system_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_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_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_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_distributev HWLOC_NAME(distributev)
#define hwloc_distribute HWLOC_NAME(distribute)
#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_online_cpuset HWLOC_NAME(topology_get_online_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_to_nodeset_strict HWLOC_NAME(cpuset_to_nodeset_strict)
#define hwloc_cpuset_from_nodeset HWLOC_NAME(cpuset_from_nodeset)
#define hwloc_cpuset_from_nodeset_strict HWLOC_NAME(cpuset_from_nodeset_strict)
#define hwloc_get_whole_distance_matrix_by_depth HWLOC_NAME(get_whole_distance_matrix_by_depth)
#define hwloc_get_whole_distance_matrix_by_type HWLOC_NAME(get_whole_distance_matrix_by_type)
#define hwloc_get_distance_matrix_covering_obj_by_depth HWLOC_NAME(get_distance_matrix_covering_obj_by_depth)
#define hwloc_get_latency HWLOC_NAME(get_latency)
/* 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)
#define hwloc_cpuset_to_linux_libnuma_nodemask HWLOC_NAME(cpuset_to_linux_libnuma_nodemask)
#define hwloc_nodeset_to_linux_libnuma_nodemask HWLOC_NAME(nodeset_to_linux_libnuma_nodemask)
#define hwloc_cpuset_from_linux_libnuma_nodemask HWLOC_NAME(cpuset_from_linux_libnuma_nodemask)
#define hwloc_nodeset_from_linux_libnuma_nodemask HWLOC_NAME(nodeset_from_linux_libnuma_nodemask)
/* linux.h */
#define hwloc_linux_parse_cpumap_file HWLOC_NAME(linux_parse_cpumap_file)
#define hwloc_linux_set_tid_cpubind HWLOC_NAME(linux_set_tid_cpubind)
#define hwloc_linux_get_tid_cpubind HWLOC_NAME(linux_get_tid_cpubind)
/* openfabrics-verbs.h */
#define hwloc_ibv_get_device_cpuset HWLOC_NAME(ibv_get_device_cpuset)
/* myriexpress.h */
#define hwloc_mx_board_get_device_cpuset HWLOC_NAME(mx_board_get_device_cpuset)
#define hwloc_mx_endpoint_get_device_cpuset HWLOC_NAME(mx_endpoint_get_device_cpuset)
/* cuda.h */
#define hwloc_cuda_get_device_cpuset HWLOC_NAME(cuda_get_device_cpuset)
/* cudart.h */
#define hwloc_cudart_get_device_cpuset HWLOC_NAME(cudart_get_device_cpuset)
/* private/debug.h */
#define hwloc_debug HWLOC_NAME(debug)
/* private/misc.h */
#define hwloc_snprintf HWLOC_NAME(snprintf)
#define hwloc_namecoloncmp HWLOC_NAME(namecoloncmp)
/* FIXME: hwloc_ffsl may be a macro, but it may not be defined yet */
#define hwloc_ffs32 HWLOC_NAME(ffs32)
/* FIXME: hwloc_flsl may be a macro, but it may not be defined yet */
#define hwloc_fls32 HWLOC_NAME(fls32)
#define hwloc_weight_long HWLOC_NAME(weight_long)
/* private/cpuid.h */
#define hwloc_have_cpuid HWLOC_NAME(have_cpuid)
#define hwloc_cpuid HWLOC_NAME(cpuid)
/* private/private.h */
#define hwloc_ignore_type_e HWLOC_NAME(ignore_type_e)
#define HWLOC_IGNORE_TYPE_NEVER HWLOC_NAME_CAPS(IGNORE_TYPE_NEVER)
#define HWLOC_IGNORE_TYPE_KEEP_STRUCTURE HWLOC_NAME_CAPS(IGNORE_TYPE_KEEP_STRUCTURE)
#define HWLOC_IGNORE_TYPE_ALWAYS HWLOC_NAME_CAPS(IGNORE_TYPE_ALWAYS)
#define hwloc_os_distances_s HWLOC_NAME(os_distances_s)
#define hwloc_backend_e HWLOC_NAME(backend_e)
#define hwloc_backend_t HWLOC_NAME(backend_t)
#define HWLOC_BACKEND_NONE HWLOC_NAME_CAPS(BACKEND_NONE)
#define HWLOC_BACKEND_SYNTHETIC HWLOC_NAME_CAPS(BACKEND_SYNTHETIC)
#define HWLOC_BACKEND_SYSFS HWLOC_NAME_CAPS(BACKEND_SYSFS)
#define HWLOC_BACKEND_XML HWLOC_NAME_CAPS(BACKEND_XML)
#define HWLOC_BACKEND_MAX HWLOC_NAME_CAPS(BACKEND_MAX)
#define hwloc_backend_params_u HWLOC_NAME(backend_params_u)
#define hwloc_backend_params_sysfs_s HWLOC_NAME(backend_params_sysfs_s)
#define hwloc_backend_params_osf HWLOC_NAME(backend_params_osf)
#define hwloc_backend_params_xml_s HWLOC_NAME(backend_params_xml_s)
#define hwloc_backend_params_synthetic_s HWLOC_NAME(backend_params_synthetic_s)
#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
#define hwloc_setup_misc_level_from_distances HWLOC_NAME(setup_misc_level_from_distances)
#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_look_linux HWLOC_NAME(look_linux)
#define hwloc_set_linux_hooks HWLOC_NAME(set_linux_hooks)
#define hwloc_backend_sysfs_init HWLOC_NAME(backend_sysfs_init)
#define hwloc_backend_sysfs_exit HWLOC_NAME(backend_sysfs_exit)
#define hwloc_backend_xml_init HWLOC_NAME(backend_xml_init)
#define hwloc_xml_check_distances HWLOC_NAME(xml_check_distances)
#define hwloc_look_xml HWLOC_NAME(look_xml)
#define hwloc_backend_xml_exit HWLOC_NAME(backend_xml_exit)
#define hwloc_look_solaris HWLOC_NAME(look_solaris)
#define hwloc_set_solaris_hooks HWLOC_NAME(set_solaris_hooks)
#define hwloc_look_aix HWLOC_NAME(look_aix)
#define hwloc_set_aix_hooks HWLOC_NAME(set_aix_hooks)
#define hwloc_look_osf HWLOC_NAME(look_osf)
#define hwloc_set_osf_hooks HWLOC_NAME(set_osf_hooks)
#define hwloc_look_windows HWLOC_NAME(look_windows)
#define hwloc_set_windows_hooks HWLOC_NAME(set_windows_hooks)
#define hwloc_look_darwin HWLOC_NAME(look_darwin)
#define hwloc_set_darwin_hooks HWLOC_NAME(set_darwin_hooks)
#define hwloc_look_freebsd HWLOC_NAME(look_freebsd)
#define hwloc_set_freebsd_hooks HWLOC_NAME(set_freebsd_hooks)
#define hwloc_look_hpux HWLOC_NAME(look_hpux)
#define hwloc_set_hpux_hooks HWLOC_NAME(set_hpux_hooks)
#define hwloc_look_x86 HWLOC_NAME(look_x86)
#define hwloc_backend_synthetic_init HWLOC_NAME(backend_synthetic_init)
#define hwloc_backend_synthetic_exit HWLOC_NAME(backend_synthetic_exit)
#define hwloc_look_synthetic HWLOC_NAME(look_synthetic )
#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__insert_object_by_cpuset HWLOC_NAME(_insert_object_by_cpuset)
#define hwloc_insert_object_by_parent HWLOC_NAME(insert_object_by_parent)
#define hwloc_add_object_info HWLOC_NAME(add_object_info)
#define hwloc_add_uname_info HWLOC_NAME(add_uname_info)
#define hwloc_free_object HWLOC_NAME(free_object)
#define hwloc_bitmap_printf_value HWLOC_NAME(bitmap_printf_value)
#define hwloc_alloc_setup_object HWLOC_NAME(alloc_setup_object)
#define hwloc_free_unlinked_object HWLOC_NAME(free_unlinked_object)
#define hwloc_setup_level HWLOC_NAME(setup_level)
#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_topology_distances_init HWLOC_NAME(topology_distances_init)
#define hwloc_topology_distances_clear HWLOC_NAME(topology_distances_clear)
#define hwloc_topology_distances_destroy HWLOC_NAME(topology_distances_destroy)
#define hwloc_topology__set_distance_matrix HWLOC_NAME(topology__set_distance_matrix)
#define hwloc_store_distances_from_env HWLOC_NAME(store_distances_from_env)
#define hwloc_convert_distances_indexes_into_objects HWLOC_NAME(convert_distances_indexes_into_objects)
#define hwloc_finalize_logical_distances HWLOC_NAME(finalize_logical_distances)
#define hwloc_restrict_distances HWLOC_NAME(restrict_distances)
#define hwloc_free_logical_distances HWLOC_NAME(free_logical_distances)
#define hwloc_group_by_distances HWLOC_NAME(group_by_distances)
#endif /* HWLOC_SYM_TRANSFORM */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_RENAME_H */
/* hwloc-1.2.1/include/private/autogen/config.h. Generated from config.h.in by configure. */
/* include/private/autogen/config.h.in. Generated from configure.ac by autoheader. */
/* -*- c -*-
*
* Copyright © 2009 CNRS, INRIA., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef HWLOC_CONFIGURE_H
#define HWLOC_CONFIGURE_H
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
/* #undef HAVE_CACHE_DESCRIPTOR */
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
/* #undef HAVE_CACHE_RELATIONSHIP */
/* 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 we have -lcuda */
/* #undef HAVE_CUDA */
/* Define to 1 if we have -lcudart */
/* #undef HAVE_CUDART */
/* 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 `CTL_HW', and to 0 if you don't.
*/
#define HAVE_DECL_CTL_HW 0
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
don't. */
#define HAVE_DECL_HW_NCPU 0
/* 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 1
/* 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 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 1
/* 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 1
/* 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 <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ffs' function. */
#define HAVE_FFS 1
/* Define to 1 if you have the `ffsl' function. */
#define HAVE_FFSL 1
/* 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'. */
/* #undef HAVE_GROUP_AFFINITY */
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
/* #undef HAVE_GROUP_RELATIONSHIP */
/* 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'. */
/* #undef HAVE_KAFFINITY */
/* 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 */
/* #undef HAVE_LIBGDI32 */
/* 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. */
/* #undef HAVE_LOCALE_H */
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
/* #undef HAVE_LOGICAL_PROCESSOR_RELATIONSHIP */
/* 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
/* Define to 1 if you have the `memalign' function. */
#define HAVE_MEMALIGN 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <myriexpress.h> header file. */
/* #undef HAVE_MYRIEXPRESS_H */
/* Define to 1 if you have the `nl_langinfo' function. */
/* #undef HAVE_NL_LANGINFO */
/* Define to 1 if you have the <numaif.h> header file. */
/* #undef HAVE_NUMAIF_H */
/* Define to 1 if the system has the type `NUMA_NODE_RELATIONSHIP'. */
/* #undef HAVE_NUMA_NODE_RELATIONSHIP */
/* Define to 1 if you have the `openat' function. */
#define HAVE_OPENAT 1
/* Define to 1 if you have the `posix_memalign' function. */
#define HAVE_POSIX_MEMALIGN 1
/* Define to 1 if the system has the type `PROCESSOR_CACHE_TYPE'. */
/* #undef HAVE_PROCESSOR_CACHE_TYPE */
/* Define to 1 if the system has the type `PROCESSOR_GROUP_INFO'. */
/* #undef HAVE_PROCESSOR_GROUP_INFO */
/* Define to 1 if the system has the type `PROCESSOR_RELATIONSHIP'. */
/* #undef HAVE_PROCESSOR_RELATIONSHIP */
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_BLOCK'. */
/* #undef HAVE_PSAPI_WORKING_SET_EX_BLOCK */
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_INFORMATION'.
*/
/* #undef HAVE_PSAPI_WORKING_SET_EX_INFORMATION */
/* Define to 1 if you have the <pthread_np.h> header file. */
/* #undef HAVE_PTHREAD_NP_H */
/* Define to 1 if the system has the type `pthread_t'. */
#define HAVE_PTHREAD_T 1
/* Define to 1 if you have the `putwc' function. */
/* #undef HAVE_PUTWC */
/* Define to 1 if the system has the type `RelationProcessorPackage'. */
/* #undef HAVE_RELATIONPROCESSORPACKAGE */
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1
/* Define to 1 if you have the `sysctlbyname' function. */
/* #undef HAVE_SYSCTLBYNAME */
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION'. */
/* #undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION */
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX'. */
/* #undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX */
/* Define to 1 if you have the <sys/cpuset.h> header file. */
/* #undef HAVE_SYS_CPUSET_H */
/* Define to 1 if you have the <sys/lgrp_user.h> header file. */
/* #undef HAVE_SYS_LGRP_USER_H */
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if the system has the type `wchar_t'. */
/* #undef HAVE_WCHAR_T */
/* Define to 1 if you have the <X11/keysym.h> header file. */
/* #undef HAVE_X11_KEYSYM_H */
/* Define to 1 if you have the <X11/Xlib.h> header file. */
/* #undef HAVE_X11_XLIB_H */
/* Define to 1 if you have the <X11/Xutil.h> header file. */
/* #undef HAVE_X11_XUTIL_H */
/* Define to 1 on AIX */
/* #undef HWLOC_AIX_SYS */
/* Whether C compiler supports -fvisibility */
#define HWLOC_C_HAVE_VISIBILITY 1
/* Define to 1 on Darwin */
/* #undef HWLOC_DARWIN_SYS */
/* Whether we are in debugging mode or not */
/* #undef HWLOC_DEBUG */
/* Define to 1 on *FREEBSD */
/* #undef HWLOC_FREEBSD_SYS */
/* Whether your compiler has __attribute__ or not */
#define HWLOC_HAVE_ATTRIBUTE 1
/* Whether your compiler has __attribute__ aligned or not */
#define HWLOC_HAVE_ATTRIBUTE_ALIGNED 1
/* Whether your compiler has __attribute__ always_inline or not */
#define HWLOC_HAVE_ATTRIBUTE_ALWAYS_INLINE 1
/* Whether your compiler has __attribute__ cold or not */
#define HWLOC_HAVE_ATTRIBUTE_COLD 1
/* Whether your compiler has __attribute__ const or not */
#define HWLOC_HAVE_ATTRIBUTE_CONST 1
/* Whether your compiler has __attribute__ deprecated or not */
#define HWLOC_HAVE_ATTRIBUTE_DEPRECATED 1
/* Whether your compiler has __attribute__ format or not */
#define HWLOC_HAVE_ATTRIBUTE_FORMAT 0
/* Whether your compiler has __attribute__ hot or not */
#define HWLOC_HAVE_ATTRIBUTE_HOT 1
/* Whether your compiler has __attribute__ malloc or not */
#define HWLOC_HAVE_ATTRIBUTE_MALLOC 1
/* Whether your compiler has __attribute__ may_alias or not */
#define HWLOC_HAVE_ATTRIBUTE_MAY_ALIAS 1
/* Whether your compiler has __attribute__ nonnull or not */
#define HWLOC_HAVE_ATTRIBUTE_NONNULL 0
/* Whether your compiler has __attribute__ noreturn or not */
#define HWLOC_HAVE_ATTRIBUTE_NORETURN 1
/* Whether your compiler has __attribute__ no_instrument_function or not */
#define HWLOC_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION 1
/* Whether your compiler has __attribute__ packed or not */
#define HWLOC_HAVE_ATTRIBUTE_PACKED 1
/* Whether your compiler has __attribute__ pure or not */
#define HWLOC_HAVE_ATTRIBUTE_PURE 1
/* Whether your compiler has __attribute__ sentinel or not */
#define HWLOC_HAVE_ATTRIBUTE_SENTINEL 0
/* Whether your compiler has __attribute__ unused or not */
#define HWLOC_HAVE_ATTRIBUTE_UNUSED 1
/* Whether your compiler has __attribute__ warn unused result or not */
#define HWLOC_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT 1
/* Whether your compiler has __attribute__ weak alias or not */
#define HWLOC_HAVE_ATTRIBUTE_WEAK_ALIAS 1
/* Define to 1 if you have the `cairo' library. */
/* #undef HWLOC_HAVE_CAIRO */
/* Define to 1 if you have the `clz' function. */
/* #undef HWLOC_HAVE_CLZ */
/* Define to 1 if you have the `clzl' function. */
/* #undef HWLOC_HAVE_CLZL */
/* Define to 1 if you have cpuid */
#define HWLOC_HAVE_CPUID 1
/* Define to 1 if the CPU_SET macro works */
#define HWLOC_HAVE_CPU_SET 1
/* Define to 1 if the CPU_SET_S macro works */
#define HWLOC_HAVE_CPU_SET_S 1
/* Define to 1 if function `clz' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_CLZ */
/* Define to 1 if function `clzl' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_CLZL */
/* Define to 1 if function `ffs' is declared by system headers */
#define HWLOC_HAVE_DECL_FFS 1
/* Define to 1 if function `ffsl' is declared by system headers */
#define HWLOC_HAVE_DECL_FFSL 1
/* Define to 1 if function `fls' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_FLS */
/* Define to 1 if function `flsl' is declared by system headers */
/* #undef HWLOC_HAVE_DECL_FLSL */
/* Define to 1 if you have the `ffs' function. */
#define HWLOC_HAVE_FFS 1
/* Define to 1 if you have the `ffsl' function. */
#define HWLOC_HAVE_FFSL 1
/* Define to 1 if you have the `fls' function. */
/* #undef HWLOC_HAVE_FLS */
/* Define to 1 if you have the `flsl' function. */
/* #undef HWLOC_HAVE_FLSL */
/* Define to 1 if you have a library providing the termcap interface */
/* #undef HWLOC_HAVE_LIBTERMCAP */
/* Define to 1 if mbind is available. */
/* #undef HWLOC_HAVE_MBIND */
/* Define to 1 if migrate_pages is available. */
/* #undef HWLOC_HAVE_MIGRATE_PAGES */
/* Define to 1 if glibc provides the old prototype of sched_setaffinity() */
/* #undef HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
/* `Define to 1 if you have pthread_getthrds_np' */
/* #undef HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
/* Define to 1 if set_mempolicy is available. */
/* #undef HWLOC_HAVE_SET_MEMPOLICY */
/* Define to 1 if you have the <stdint.h> header file. */
#define HWLOC_HAVE_STDINT_H 1
/* Define to 1 if you have the `windows.h' header. */
/* #undef HWLOC_HAVE_WINDOWS_H */
/* Define to 1 if X11 libraries are available. */
/* #undef HWLOC_HAVE_X11 */
/* Define to 1 if you have the `xml' library. */
/* #undef HWLOC_HAVE_XML */
/* Define to 1 if the _syscall3 macro works */
/* #undef HWLOC_HAVE__SYSCALL3 */
/* Define to 1 on HP-UX */
/* #undef HWLOC_HPUX_SYS */
/* Define to 1 on Irix */
/* #undef HWLOC_IRIX_SYS */
/* Define to 1 on Linux */
#define HWLOC_LINUX_SYS 1
/* Major version of hwloc */
/* #undef HWLOC_MAJOR_VERSION */
/* Minor version of hwloc */
/* #undef HWLOC_MINOR_VERSION */
/* Define to 1 on OSF */
/* #undef HWLOC_OSF_SYS */
/* Release version of hwloc */
/* #undef HWLOC_RELEASE_VERSION */
/* The size of `unsigned int', as computed by sizeof */
#define HWLOC_SIZEOF_UNSIGNED_INT 4
/* The size of `unsigned long', as computed by sizeof */
#define HWLOC_SIZEOF_UNSIGNED_LONG 4
/* Define to 1 on Solaris */
/* #undef HWLOC_SOLARIS_SYS */
/* The hwloc symbol prefix */
#define HWLOC_SYM_PREFIX hwloc_
/* The hwloc symbol prefix in all caps */
#define HWLOC_SYM_PREFIX_CAPS HWLOC_
/* Whether we need to re-define all the hwloc public symbols or not */
#define HWLOC_SYM_TRANSFORM 0
/* Define to 1 on unsupported systems */
/* #undef HWLOC_UNSUPPORTED_SYS */
/* Define to 1 if ncurses works, preferred over curses */
/* #undef HWLOC_USE_NCURSES */
/* Define to 1 on WINDOWS */
/* #undef HWLOC_WIN_SYS */
/* Define to 1 on x86_32 */
#define HWLOC_X86_32_ARCH 1
/* Define to 1 on x86_64 */
/* #undef HWLOC_X86_64_ARCH */
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "htop"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "loderunner@users.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "htop"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "htop 0.9.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "htop"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.9.1"
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* The size of `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 4
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
# define _HPUX_SOURCE 1
#endif
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Version number of package */
#define VERSION "0.9.1"
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Are we building for HP-UX? */
#define _HPUX_SOURCE 1
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define this to a keyword that can safely replace inline in installed
headers */
#define __hwloc_inline __inline__
/* Define this to the process ID type */
#define hwloc_pid_t pid_t
/* Define this to either strncasecmp or strncmp */
#define hwloc_strncasecmp strncasecmp
/* Define this to the thread ID type */
#define hwloc_thread_t pthread_t
#endif /* HWLOC_CONFIGURE_H */
/* include/private/autogen/config.h.in. Generated from configure.ac by autoheader. */
/* -*- c -*-
*
* Copyright © 2009 CNRS, INRIA., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef HWLOC_CONFIGURE_H
#define HWLOC_CONFIGURE_H
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
#undef HAVE_CACHE_DESCRIPTOR
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
#undef HAVE_CACHE_RELATIONSHIP
/* 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 we have -lcuda */
#undef HAVE_CUDA
/* Define to 1 if we have -lcudart */
#undef HAVE_CUDART
/* 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 `CTL_HW', and to 0 if you don't.
*/
#undef HAVE_DECL_CTL_HW
/* 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 `pthread_getaffinity_np', and to
0 if you don't. */
#undef HAVE_DECL_PTHREAD_GETAFFINITY_NP
/* Define to 1 if you have the declaration of `pthread_setaffinity_np', and to
0 if you don't. */
#undef HAVE_DECL_PTHREAD_SETAFFINITY_NP
/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0
if you don't. */
#undef HAVE_DECL__SC_LARGE_PAGESIZE
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_CONF', and to 0
if you don't. */
#undef HAVE_DECL__SC_NPROCESSORS_CONF
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_ONLN', and to 0
if you don't. */
#undef HAVE_DECL__SC_NPROCESSORS_ONLN
/* Define to 1 if you have the declaration of `_SC_NPROC_CONF', and to 0 if
you don't. */
#undef HAVE_DECL__SC_NPROC_CONF
/* Define to 1 if you have the declaration of `_SC_NPROC_ONLN', and to 0 if
you don't. */
#undef HAVE_DECL__SC_NPROC_ONLN
/* 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. */
#undef HAVE_GETPAGESIZE
/* Define to 1 if the system has the type `GROUP_AFFINITY'. */
#undef HAVE_GROUP_AFFINITY
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
#undef HAVE_GROUP_RELATIONSHIP
/* 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. */
#undef HAVE_INTTYPES_H
/* Define to 1 if the system has the type `KAFFINITY'. */
#undef HAVE_KAFFINITY
/* 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 */
#undef HAVE_LIBGDI32
/* 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. */
#undef HAVE_LOCALE_H
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
#undef HAVE_LOGICAL_PROCESSOR_RELATIONSHIP
/* 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. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the `memalign' function. */
#undef HAVE_MEMALIGN
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <myriexpress.h> header file. */
#undef HAVE_MYRIEXPRESS_H
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
/* Define to 1 if you have the <numaif.h> header file. */
#undef HAVE_NUMAIF_H
/* Define to 1 if the system has the type `NUMA_NODE_RELATIONSHIP'. */
#undef HAVE_NUMA_NODE_RELATIONSHIP
/* Define to 1 if you have the `openat' function. */
#undef HAVE_OPENAT
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if the system has the type `PROCESSOR_CACHE_TYPE'. */
#undef HAVE_PROCESSOR_CACHE_TYPE
/* Define to 1 if the system has the type `PROCESSOR_GROUP_INFO'. */
#undef HAVE_PROCESSOR_GROUP_INFO
/* Define to 1 if the system has the type `PROCESSOR_RELATIONSHIP'. */
#undef HAVE_PROCESSOR_RELATIONSHIP
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_BLOCK'. */
#undef HAVE_PSAPI_WORKING_SET_EX_BLOCK
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_INFORMATION'.
*/
#undef HAVE_PSAPI_WORKING_SET_EX_INFORMATION
/* Define to 1 if you have the <pthread_np.h> header file. */
#undef HAVE_PTHREAD_NP_H
/* Define to 1 if the system has the type `pthread_t'. */
#undef HAVE_PTHREAD_T
/* Define to 1 if you have the `putwc' function. */
#undef HAVE_PUTWC
/* Define to 1 if the system has the type `RelationProcessorPackage'. */
#undef HAVE_RELATIONPROCESSORPACKAGE
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the `sysctl' function. */
#undef HAVE_SYSCTL
/* Define to 1 if you have the `sysctlbyname' function. */
#undef HAVE_SYSCTLBYNAME
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION'. */
#undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION
/* Define to 1 if the system has the type
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX'. */
#undef HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
/* Define to 1 if you have the <sys/cpuset.h> header file. */
#undef HAVE_SYS_CPUSET_H
/* Define to 1 if you have the <sys/lgrp_user.h> header file. */
#undef HAVE_SYS_LGRP_USER_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the type `wchar_t'. */
#undef HAVE_WCHAR_T
/* Define to 1 if you have the <X11/keysym.h> header file. */
#undef HAVE_X11_KEYSYM_H
/* Define to 1 if you have the <X11/Xlib.h> header file. */
#undef HAVE_X11_XLIB_H
/* Define to 1 if you have the <X11/Xutil.h> header file. */
#undef HAVE_X11_XUTIL_H
/* Define to 1 on AIX */
#undef HWLOC_AIX_SYS
/* Whether C compiler supports -fvisibility */
#undef HWLOC_C_HAVE_VISIBILITY
/* Define to 1 on Darwin */
#undef HWLOC_DARWIN_SYS
/* Whether we are in debugging mode or not */
#undef HWLOC_DEBUG
/* Define to 1 on *FREEBSD */
#undef HWLOC_FREEBSD_SYS
/* Whether your compiler has __attribute__ or not */
#undef HWLOC_HAVE_ATTRIBUTE
/* Whether your compiler has __attribute__ aligned or not */
#undef HWLOC_HAVE_ATTRIBUTE_ALIGNED
/* Whether your compiler has __attribute__ always_inline or not */
#undef HWLOC_HAVE_ATTRIBUTE_ALWAYS_INLINE
/* Whether your compiler has __attribute__ cold or not */
#undef HWLOC_HAVE_ATTRIBUTE_COLD
/* Whether your compiler has __attribute__ const or not */
#undef HWLOC_HAVE_ATTRIBUTE_CONST
/* Whether your compiler has __attribute__ deprecated or not */
#undef HWLOC_HAVE_ATTRIBUTE_DEPRECATED
/* Whether your compiler has __attribute__ format or not */
#undef HWLOC_HAVE_ATTRIBUTE_FORMAT
/* Whether your compiler has __attribute__ hot or not */
#undef HWLOC_HAVE_ATTRIBUTE_HOT
/* Whether your compiler has __attribute__ malloc or not */
#undef HWLOC_HAVE_ATTRIBUTE_MALLOC
/* Whether your compiler has __attribute__ may_alias or not */
#undef HWLOC_HAVE_ATTRIBUTE_MAY_ALIAS
/* Whether your compiler has __attribute__ nonnull or not */
#undef HWLOC_HAVE_ATTRIBUTE_NONNULL
/* Whether your compiler has __attribute__ noreturn or not */
#undef HWLOC_HAVE_ATTRIBUTE_NORETURN
/* Whether your compiler has __attribute__ no_instrument_function or not */
#undef HWLOC_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION
/* Whether your compiler has __attribute__ packed or not */
#undef HWLOC_HAVE_ATTRIBUTE_PACKED
/* Whether your compiler has __attribute__ pure or not */
#undef HWLOC_HAVE_ATTRIBUTE_PURE
/* Whether your compiler has __attribute__ sentinel or not */
#undef HWLOC_HAVE_ATTRIBUTE_SENTINEL
/* Whether your compiler has __attribute__ unused or not */
#undef HWLOC_HAVE_ATTRIBUTE_UNUSED
/* Whether your compiler has __attribute__ warn unused result or not */
#undef HWLOC_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT
/* Whether your compiler has __attribute__ weak alias or not */
#undef HWLOC_HAVE_ATTRIBUTE_WEAK_ALIAS
/* Define to 1 if you have the `cairo' library. */
#undef HWLOC_HAVE_CAIRO
/* Define to 1 if you have the `clz' function. */
#undef HWLOC_HAVE_CLZ
/* Define to 1 if you have the `clzl' function. */
#undef HWLOC_HAVE_CLZL
/* Define to 1 if you have cpuid */
#undef HWLOC_HAVE_CPUID
/* Define to 1 if the CPU_SET macro works */
#undef HWLOC_HAVE_CPU_SET
/* Define to 1 if the CPU_SET_S macro works */
#undef HWLOC_HAVE_CPU_SET_S
/* Define to 1 if function `clz' is declared by system headers */
#undef HWLOC_HAVE_DECL_CLZ
/* Define to 1 if function `clzl' is declared by system headers */
#undef HWLOC_HAVE_DECL_CLZL
/* Define to 1 if function `ffs' is declared by system headers */
#undef HWLOC_HAVE_DECL_FFS
/* Define to 1 if function `ffsl' is declared by system headers */
#undef HWLOC_HAVE_DECL_FFSL
/* Define to 1 if function `fls' is declared by system headers */
#undef HWLOC_HAVE_DECL_FLS
/* Define to 1 if function `flsl' is declared by system headers */
#undef HWLOC_HAVE_DECL_FLSL
/* Define to 1 if you have the `ffs' function. */
#undef HWLOC_HAVE_FFS
/* Define to 1 if you have the `ffsl' function. */
#undef HWLOC_HAVE_FFSL
/* Define to 1 if you have the `fls' function. */
#undef HWLOC_HAVE_FLS
/* Define to 1 if you have the `flsl' function. */
#undef HWLOC_HAVE_FLSL
/* Define to 1 if you have a library providing the termcap interface */
#undef HWLOC_HAVE_LIBTERMCAP
/* Define to 1 if mbind is available. */
#undef HWLOC_HAVE_MBIND
/* Define to 1 if migrate_pages is available. */
#undef HWLOC_HAVE_MIGRATE_PAGES
/* Define to 1 if glibc provides the old prototype of sched_setaffinity() */
#undef HWLOC_HAVE_OLD_SCHED_SETAFFINITY
/* `Define to 1 if you have pthread_getthrds_np' */
#undef HWLOC_HAVE_PTHREAD_GETTHRDS_NP
/* Define to 1 if set_mempolicy is available. */
#undef HWLOC_HAVE_SET_MEMPOLICY
/* Define to 1 if you have the <stdint.h> header file. */
#undef HWLOC_HAVE_STDINT_H
/* Define to 1 if you have the `windows.h' header. */
#undef HWLOC_HAVE_WINDOWS_H
/* Define to 1 if X11 libraries are available. */
#undef HWLOC_HAVE_X11
/* Define to 1 if you have the `xml' library. */
#undef HWLOC_HAVE_XML
/* Define to 1 if the _syscall3 macro works */
#undef HWLOC_HAVE__SYSCALL3
/* Define to 1 on HP-UX */
#undef HWLOC_HPUX_SYS
/* Define to 1 on Irix */
#undef HWLOC_IRIX_SYS
/* Define to 1 on Linux */
#undef HWLOC_LINUX_SYS
/* Major version of hwloc */
#undef HWLOC_MAJOR_VERSION
/* Minor version of hwloc */
#undef HWLOC_MINOR_VERSION
/* Define to 1 on OSF */
#undef HWLOC_OSF_SYS
/* Release version of hwloc */
#undef HWLOC_RELEASE_VERSION
/* The size of `unsigned int', as computed by sizeof */
#undef HWLOC_SIZEOF_UNSIGNED_INT
/* The size of `unsigned long', as computed by sizeof */
#undef HWLOC_SIZEOF_UNSIGNED_LONG
/* Define to 1 on Solaris */
#undef HWLOC_SOLARIS_SYS
/* The hwloc symbol prefix */
#undef HWLOC_SYM_PREFIX
/* The hwloc symbol prefix in all caps */
#undef HWLOC_SYM_PREFIX_CAPS
/* Whether we need to re-define all the hwloc public symbols or not */
#undef HWLOC_SYM_TRANSFORM
/* Define to 1 on unsupported systems */
#undef HWLOC_UNSUPPORTED_SYS
/* Define to 1 if ncurses works, preferred over curses */
#undef HWLOC_USE_NCURSES
/* Define to 1 on WINDOWS */
#undef HWLOC_WIN_SYS
/* Define to 1 on x86_32 */
#undef HWLOC_X86_32_ARCH
/* Define to 1 on x86_64 */
#undef HWLOC_X86_64_ARCH
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `unsigned int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_INT
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
# undef _HPUX_SOURCE
#endif
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Are we building for HP-UX? */
#undef _HPUX_SOURCE
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define this to a keyword that can safely replace inline in installed
headers */
#undef __hwloc_inline
/* Define this to the process ID type */
#undef hwloc_pid_t
/* Define this to either strncasecmp or strncmp */
#undef hwloc_strncasecmp
/* Define this to the thread ID type */
#undef hwloc_thread_t
#endif /* HWLOC_CONFIGURE_H */
timestamp for hwloc-1.2.1/include/private/autogen/config.h
/*
* Copyright © 2010-2011 Université Bordeaux 1
* Copyright © 2010 Cisco Systems, Inc. All rights reserved.
*
* See COPYING in top-level directory.
*/
/* Internals for x86's cpuid. */
#ifndef HWLOC_PRIVATE_CPUID_H
#define HWLOC_PRIVATE_CPUID_H
#ifdef HWLOC_X86_32_ARCH
static __hwloc_inline int hwloc_have_cpuid(void)
{
int ret;
unsigned tmp, tmp2;
asm(
"mov $0,%0\n\t" /* Not supported a priori */
"pushfl \n\t" /* Save flags */
"pushfl \n\t" \
"pop %1 \n\t" /* Get flags */ \
#define TRY_TOGGLE \
"xor $0x00200000,%1\n\t" /* Try to toggle ID */ \
"mov %1,%2\n\t" /* Save expected value */ \
"push %1 \n\t" \
"popfl \n\t" /* Try to toggle */ \
"pushfl \n\t" \
"pop %1 \n\t" \
"cmp %1,%2\n\t" /* Compare with expected value */ \
"jnz Lhwloc1\n\t" /* Unexpected, failure */ \
TRY_TOGGLE /* Try to set/clear */
TRY_TOGGLE /* Try to clear/set */
"mov $1,%0\n\t" /* Passed the test! */
"Lhwloc1: \n\t"
"popfl \n\t" /* Restore flags */
: "=r" (ret), "=&r" (tmp), "=&r" (tmp2));
return ret;
}
#endif /* HWLOC_X86_32_ARCH */
#ifdef HWLOC_X86_64_ARCH
static __hwloc_inline int hwloc_have_cpuid(void) { return 1; }
#endif /* HWLOC_X86_64_ARCH */
static __hwloc_inline void hwloc_cpuid(unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
{
asm(
#ifdef HWLOC_X86_32_ARCH
"push %%ebx\n\t"
#endif
"cpuid\n\t"
#ifdef HWLOC_X86_32_ARCH
"mov %%ebx,%1\n\t"
"pop %%ebx\n\t"
#endif
: "+a" (*eax),
#ifdef HWLOC_X86_32_ARCH
"=r" (*ebx),
#else
"=b" (*ebx),
#endif
"+c" (*ecx), "=d" (*edx));
}
#endif /* HWLOC_PRIVATE_CPUID_H */
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009, 2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* The configuration file */
#ifndef HWLOC_DEBUG_H
#define HWLOC_DEBUG_H
#include <private/autogen/config.h>
#ifdef HWLOC_DEBUG
#include <stdarg.h>
#include <stdio.h>
#endif
static __hwloc_inline void hwloc_debug(const char *s __hwloc_attribute_unused, ...)
{
#ifdef HWLOC_DEBUG
va_list ap;
va_start(ap, s);
vfprintf(stderr, s, ap);
va_end(ap);
#endif
}
#ifdef HWLOC_DEBUG
#define hwloc_debug_bitmap(fmt, bitmap) do { \
char *s= hwloc_bitmap_printf_value(bitmap); \
fprintf(stderr, fmt, s); \
free(s); \
} while (0)
#define hwloc_debug_1arg_bitmap(fmt, arg1, bitmap) do { \
char *s= hwloc_bitmap_printf_value(bitmap); \
fprintf(stderr, fmt, arg1, s); \
free(s); \
} while (0)
#define hwloc_debug_2args_bitmap(fmt, arg1, arg2, bitmap) do { \
char *s= hwloc_bitmap_printf_value(bitmap); \
fprintf(stderr, fmt, arg1, arg2, s); \
free(s); \
} while (0)
#else
#define hwloc_debug_bitmap(s, bitmap) do { } while(0)
#define hwloc_debug_1arg_bitmap(s, arg1, bitmap) do { } while(0)
#define hwloc_debug_2args_bitmap(s, arg1, arg2, bitmap) do { } while(0)
#endif
#endif /* HWLOC_DEBUG_H */
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* Misc internals routines. */
#ifndef HWLOC_PRIVATE_MISC_H
#define HWLOC_PRIVATE_MISC_H
#include <hwloc/autogen/config.h>
#include <private/autogen/config.h>
#include <private/private.h>
/* On some systems, snprintf returns the size of written data, not the actually
* required size. hwloc_snprintf always report the actually required size. */
int hwloc_snprintf(char *str, size_t size, const char *format, ...) __hwloc_attribute_format(printf, 3, 4);
/* Check whether needle matches the beginning of haystack, at least n, and up
* to a colon or \0 */
HWLOC_DECLSPEC
int hwloc_namecoloncmp(const char *haystack, const char *needle, size_t n);
/* Compile-time assertion */
#define HWLOC_BUILD_ASSERT(condition) ((void)sizeof(char[1 - 2*!(condition)]))
#define HWLOC_BITS_PER_LONG (HWLOC_SIZEOF_UNSIGNED_LONG * 8)
#define HWLOC_BITS_PER_INT (HWLOC_SIZEOF_UNSIGNED_INT * 8)
#if (HWLOC_BITS_PER_LONG != 32) && (HWLOC_BITS_PER_LONG != 64)
#error "unknown size for unsigned long."
#endif
#if (HWLOC_BITS_PER_INT != 16) && (HWLOC_BITS_PER_INT != 32) && (HWLOC_BITS_PER_INT != 64)
#error "unknown size for unsigned int."
#endif
/**
* ffsl helpers.
*/
#ifdef __GNUC__
# if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
/* Starting from 3.4, gcc has a long variant. */
# define hwloc_ffsl(x) __builtin_ffsl(x)
# else
# define hwloc_ffs(x) __builtin_ffs(x)
# define HWLOC_NEED_FFSL
# endif
#elif defined(HWLOC_HAVE_FFSL)
# ifndef HWLOC_HAVE_DECL_FFSL
extern int ffsl(long) __hwloc_attribute_const;
# endif
# define hwloc_ffsl(x) ffsl(x)
#elif defined(HWLOC_HAVE_FFS)
# ifndef HWLOC_HAVE_DECL_FFS
extern int ffs(int) __hwloc_attribute_const;
# endif
# define hwloc_ffs(x) ffs(x)
# define HWLOC_NEED_FFSL
#else /* no ffs implementation */
static __hwloc_inline int __hwloc_attribute_const
hwloc_ffsl(unsigned long x)
{
int i;
if (!x)
return 0;
i = 1;
#if HWLOC_BITS_PER_LONG >= 64
if (!(x & 0xfffffffful)) {
x >>= 32;
i += 32;
}
#endif
if (!(x & 0xffffu)) {
x >>= 16;
i += 16;
}
if (!(x & 0xff)) {
x >>= 8;
i += 8;
}
if (!(x & 0xf)) {
x >>= 4;
i += 4;
}
if (!(x & 0x3)) {
x >>= 2;
i += 2;
}
if (!(x & 0x1)) {
x >>= 1;
i += 1;
}
return i;
}
#endif
#ifdef HWLOC_NEED_FFSL
/* We only have an int ffs(int) implementation, build a long one. */
/* First make it 32 bits if it was only 16. */
static __hwloc_inline int __hwloc_attribute_const
hwloc_ffs32(unsigned long x)
{
#if HWLOC_BITS_PER_INT == 16
int low_ffs, hi_ffs;
low_ffs = hwloc_ffs(x & 0xfffful);
if (low_ffs)
return low_ffs;
hi_ffs = hwloc_ffs(x >> 16);
if (hi_ffs)
return hi_ffs + 16;
return 0;
#else
return hwloc_ffs(x);
#endif
}
/* Then make it 64 bit if longs are. */
static __hwloc_inline int __hwloc_attribute_const
hwloc_ffsl(unsigned long x)
{
#if HWLOC_BITS_PER_LONG == 64
int low_ffs, hi_ffs;
low_ffs = hwloc_ffs32(x & 0xfffffffful);
if (low_ffs)
return low_ffs;
hi_ffs = hwloc_ffs32(x >> 32);
if (hi_ffs)
return hi_ffs + 32;
return 0;
#else
return hwloc_ffs32(x);
#endif
}
#endif
/**
* flsl helpers.
*/
#ifdef __GNUC_____
# if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
# define hwloc_flsl(x) (x ? 8*sizeof(long) - __builtin_clzl(x) : 0)
# else
# define hwloc_fls(x) (x ? 8*sizeof(int) - __builtin_clz(x) : 0)
# define HWLOC_NEED_FLSL
# endif
#elif defined(HWLOC_HAVE_FLSL)
# ifndef HWLOC_HAVE_DECL_FLSL
extern int flsl(long) __hwloc_attribute_const;
# endif
# define hwloc_flsl(x) flsl(x)
#elif defined(HWLOC_HAVE_CLZL)
# ifndef HWLOC_HAVE_DECL_CLZL
extern int clzl(long) __hwloc_attribute_const;
# endif
# define hwloc_flsl(x) (x ? 8*sizeof(long) - clzl(x) : 0)
#elif defined(HWLOC_HAVE_FLS)
# ifndef HWLOC_HAVE_DECL_FLS
extern int fls(int) __hwloc_attribute_const;
# endif
# define hwloc_fls(x) fls(x)
# define HWLOC_NEED_FLSL
#elif defined(HWLOC_HAVE_CLZ)
# ifndef HWLOC_HAVE_DECL_CLZ
extern int clz(int) __hwloc_attribute_const;
# endif
# define hwloc_fls(x) (x ? 8*sizeof(int) - clz(x) : 0)
# define HWLOC_NEED_FLSL
#else /* no fls implementation */
static __hwloc_inline int __hwloc_attribute_const
hwloc_flsl(unsigned long x)
{
int i = 0;
if (!x)
return 0;
i = 1;
#if HWLOC_BITS_PER_LONG >= 64
if ((x & 0xffffffff00000000ul)) {
x >>= 32;
i += 32;
}
#endif
if ((x & 0xffff0000u)) {
x >>= 16;
i += 16;
}
if ((x & 0xff00)) {
x >>= 8;
i += 8;
}
if ((x & 0xf0)) {
x >>= 4;
i += 4;
}
if ((x & 0xc)) {
x >>= 2;
i += 2;
}
if ((x & 0x2)) {
x >>= 1;
i += 1;
}
return i;
}
#endif
#ifdef HWLOC_NEED_FLSL
/* We only have an int fls(int) implementation, build a long one. */
/* First make it 32 bits if it was only 16. */
static __hwloc_inline int __hwloc_attribute_const
hwloc_fls32(unsigned long x)
{
#if HWLOC_BITS_PER_INT == 16
int low_fls, hi_fls;
hi_fls = hwloc_fls(x >> 16);
if (hi_fls)
return hi_fls + 16;
low_fls = hwloc_fls(x & 0xfffful);
if (low_fls)
return low_fls;
return 0;
#else
return hwloc_fls(x);
#endif
}
/* Then make it 64 bit if longs are. */
static __hwloc_inline int __hwloc_attribute_const
hwloc_flsl(unsigned long x)
{
#if HWLOC_BITS_PER_LONG == 64
int low_fls, hi_fls;
hi_fls = hwloc_fls32(x >> 32);
if (hi_fls)
return hi_fls + 32;
low_fls = hwloc_fls32(x & 0xfffffffful);
if (low_fls)
return low_fls;
return 0;
#else
return hwloc_fls32(x);
#endif
}
#endif
static __hwloc_inline int __hwloc_attribute_const
hwloc_weight_long(unsigned long w)
{
#if HWLOC_BITS_PER_LONG == 32
#if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__) >= 4)
return __builtin_popcount(w);
#else
unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
#endif
#else /* HWLOC_BITS_PER_LONG == 32 */
#if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__) >= 4)
return __builtin_popcountll(w);
#else
unsigned long res;
res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
#endif
#endif /* HWLOC_BITS_PER_LONG == 64 */
}
#endif /* HWLOC_PRIVATE_MISC_H */
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 INRIA. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
*
* See COPYING in top-level directory.
*/
/* Internal types and helpers. */
#ifndef HWLOC_PRIVATE_H
#define HWLOC_PRIVATE_H
#include <private/autogen/config.h>
#include <hwloc.h>
#include <hwloc/bitmap.h>
#include <private/debug.h>
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <string.h>
#ifdef HWLOC_HAVE_ATTRIBUTE_FORMAT
# if HWLOC_HAVE_ATTRIBUTE_FORMAT
# define __hwloc_attribute_format(type, str, arg) __attribute__((__format__(type, str, arg)))
# else
# define __hwloc_attribute_format(type, str, arg)
# endif
#else
# define __hwloc_attribute_format(type, str, arg)
#endif
enum hwloc_ignore_type_e {
HWLOC_IGNORE_TYPE_NEVER = 0,
HWLOC_IGNORE_TYPE_KEEP_STRUCTURE,
HWLOC_IGNORE_TYPE_ALWAYS
};
#define HWLOC_DEPTH_MAX 128
typedef enum hwloc_backend_e {
HWLOC_BACKEND_NONE,
HWLOC_BACKEND_SYNTHETIC,
#ifdef HWLOC_LINUX_SYS
HWLOC_BACKEND_SYSFS,
#endif
#ifdef HWLOC_HAVE_XML
HWLOC_BACKEND_XML,
#endif
/* This value is only here so that we can end the enum list without
a comma (thereby preventing compiler warnings) */
HWLOC_BACKEND_MAX
} hwloc_backend_t;
struct hwloc_topology {
unsigned nb_levels; /* Number of horizontal levels */
unsigned next_group_depth; /* Depth of the next Group object that we may create */
unsigned level_nbobjects[HWLOC_DEPTH_MAX]; /* Number of objects on each horizontal level */
struct hwloc_obj **levels[HWLOC_DEPTH_MAX]; /* Direct access to levels, levels[l = 0 .. nblevels-1][0..level_nbobjects[l]] */
unsigned long flags;
int type_depth[HWLOC_OBJ_TYPE_MAX];
enum hwloc_ignore_type_e ignored_types[HWLOC_OBJ_TYPE_MAX];
int is_thissystem;
int is_loaded;
hwloc_pid_t pid; /* Process ID the topology is view from, 0 for self */
int (*set_thisproc_cpubind)(hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags);
int (*get_thisproc_cpubind)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
int (*set_thisthread_cpubind)(hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags);
int (*get_thisthread_cpubind)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
int (*set_proc_cpubind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t set, int flags);
int (*get_proc_cpubind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags);
#ifdef hwloc_thread_t
int (*set_thread_cpubind)(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_cpuset_t set, int flags);
int (*get_thread_cpubind)(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_cpuset_t set, int flags);
#endif
int (*get_thisproc_last_cpu_location)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
int (*get_thisthread_last_cpu_location)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
int (*get_proc_last_cpu_location)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags);
int (*set_thisproc_membind)(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*get_thisproc_membind)(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
int (*set_thisthread_membind)(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*get_thisthread_membind)(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
int (*set_proc_membind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*get_proc_membind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
int (*set_area_membind)(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*get_area_membind)(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
/* This has to return the same kind of pointer as alloc_membind, so that free_membind can be used on it */
void *(*alloc)(hwloc_topology_t topology, size_t len);
/* alloc_membind has to always succeed if !(flags & HWLOC_MEMBIND_STRICT).
* see hwloc_alloc_or_fail which is convenient for that. */
void *(*alloc_membind)(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
int (*free_membind)(hwloc_topology_t topology, void *addr, size_t len);
struct hwloc_topology_support support;
struct hwloc_os_distances_s {
int nbobjs;
unsigned *indexes; /* array of OS indexes before we can convert them into objs. always available.
*/
struct hwloc_obj **objs; /* array of objects, in the same order as above.
* either given (by a backend) together with the indexes array above.
* or build from the above indexes array when not given (by the user).
*/
float *distances; /* distance matrices, ordered according to the above indexes/objs array.
* distance from i to j is stored in slot i*nbnodes+j.
* will be copied into the main logical-index-ordered distance at the end of the discovery.
*/
} os_distances[HWLOC_OBJ_TYPE_MAX];
hwloc_backend_t backend_type;
union hwloc_backend_params_u {
#ifdef HWLOC_LINUX_SYS
struct hwloc_backend_params_sysfs_s {
/* sysfs backend parameters */
char *root_path; /* The path of the file system root, used when browsing, e.g., Linux' sysfs and procfs. */
int root_fd; /* The file descriptor for the file system root, used when browsing, e.g., Linux' sysfs and procfs. */
} sysfs;
#endif /* HWLOC_LINUX_SYS */
#if defined(HWLOC_OSF_SYS) || defined(HWLOC_COMPILE_PORTS)
struct hwloc_backend_params_osf {
int nbnodes;
} osf;
#endif /* HWLOC_OSF_SYS */
#ifdef HWLOC_HAVE_XML
struct hwloc_backend_params_xml_s {
/* xml backend parameters */
void *doc;
} xml;
#endif /* HWLOC_HAVE_XML */
struct hwloc_backend_params_synthetic_s {
/* synthetic backend parameters */
#define HWLOC_SYNTHETIC_MAX_DEPTH 128
unsigned arity[HWLOC_SYNTHETIC_MAX_DEPTH];
hwloc_obj_type_t type[HWLOC_SYNTHETIC_MAX_DEPTH];
unsigned id[HWLOC_SYNTHETIC_MAX_DEPTH];
unsigned depth[HWLOC_SYNTHETIC_MAX_DEPTH]; /* For cache/misc */
} synthetic;
} backend_params;
};
extern void hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb_pus);
extern int hwloc_get_sysctlbyname(const char *name, int64_t *n);
extern int hwloc_get_sysctl(int name[], unsigned namelen, int *n);
extern unsigned hwloc_fallback_nbprocessors(struct hwloc_topology *topology);
#if defined(HWLOC_LINUX_SYS)
extern void hwloc_look_linux(struct hwloc_topology *topology);
extern void hwloc_set_linux_hooks(struct hwloc_topology *topology);
extern int hwloc_backend_sysfs_init(struct hwloc_topology *topology, const char *fsroot_path);
extern void hwloc_backend_sysfs_exit(struct hwloc_topology *topology);
#endif /* HWLOC_LINUX_SYS */
#ifdef HWLOC_HAVE_XML
extern int hwloc_backend_xml_init(struct hwloc_topology *topology, const char *xmlpath, const char *xmlbuffer, int buflen);
extern void hwloc_xml_check_distances(struct hwloc_topology *topology);
extern void hwloc_look_xml(struct hwloc_topology *topology);
extern void hwloc_backend_xml_exit(struct hwloc_topology *topology);
#endif /* HWLOC_HAVE_XML */
#ifdef HWLOC_SOLARIS_SYS
extern void hwloc_look_solaris(struct hwloc_topology *topology);
extern void hwloc_set_solaris_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_SOLARIS_SYS */
#ifdef HWLOC_AIX_SYS
extern void hwloc_look_aix(struct hwloc_topology *topology);
extern void hwloc_set_aix_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_AIX_SYS */
#ifdef HWLOC_OSF_SYS
extern void hwloc_look_osf(struct hwloc_topology *topology);
extern void hwloc_set_osf_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_OSF_SYS */
#ifdef HWLOC_WIN_SYS
extern void hwloc_look_windows(struct hwloc_topology *topology);
extern void hwloc_set_windows_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_WIN_SYS */
#ifdef HWLOC_DARWIN_SYS
extern void hwloc_look_darwin(struct hwloc_topology *topology);
extern void hwloc_set_darwin_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_DARWIN_SYS */
#ifdef HWLOC_FREEBSD_SYS
extern void hwloc_look_freebsd(struct hwloc_topology *topology);
extern void hwloc_set_freebsd_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_FREEBSD_SYS */
#ifdef HWLOC_HPUX_SYS
extern void hwloc_look_hpux(struct hwloc_topology *topology);
extern void hwloc_set_hpux_hooks(struct hwloc_topology *topology);
#endif /* HWLOC_HPUX_SYS */
extern void hwloc_look_x86(struct hwloc_topology *topology, unsigned nbprocs);
extern int hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *description);
extern void hwloc_backend_synthetic_exit(struct hwloc_topology *topology);
extern void hwloc_look_synthetic (struct hwloc_topology *topology);
/*
* 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.
*/
extern void hwloc_insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj);
/*
* Add an object to the topology and specify which error callback to use
*/
typedef void (*hwloc_report_error_t)(const char * msg, int line);
extern void hwloc_report_os_error(const char * msg, int line);
extern int hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj, hwloc_report_error_t report_error);
/*
* 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.
*
* The given object may have children.
*
* Remember to call topology_connect() afterwards to fix handy pointers.
*/
extern void hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t parent, hwloc_obj_t obj);
/* Insert name/value in the object infos array. name and value are copied by the callee. */
extern void hwloc_add_object_info(hwloc_obj_t obj, const char *name, const char *value);
/* Insert uname-specific names/values in the object infos array */
extern void hwloc_add_uname_info(struct hwloc_topology *topology);
/** \brief Return a locally-allocated stringified bitmap for printf-like calls. */
static __hwloc_inline char *
hwloc_bitmap_printf_value(hwloc_const_bitmap_t bitmap)
{
char *buf;
hwloc_bitmap_asprintf(&buf, bitmap);
return buf;
}
static __hwloc_inline struct hwloc_obj *
hwloc_alloc_setup_object(hwloc_obj_type_t type, signed idx)
{
struct hwloc_obj *obj = malloc(sizeof(*obj));
memset(obj, 0, sizeof(*obj));
obj->type = type;
obj->os_index = idx;
obj->os_level = -1;
obj->attr = malloc(sizeof(*obj->attr));
memset(obj->attr, 0, sizeof(*obj->attr));
/* do not allocate the cpuset here, let the caller do it */
return obj;
}
extern void hwloc_free_unlinked_object(hwloc_obj_t obj);
#define hwloc_object_cpuset_from_array(l, _value, _array, _max) do { \
struct hwloc_obj *__l = (l); \
unsigned int *__a = (_array); \
int k; \
__l->cpuset = hwloc_bitmap_alloc(); \
for(k=0; k<_max; k++) \
if (__a[k] == _value) \
hwloc_bitmap_set(__l->cpuset, k); \
} while (0)
/* Configures an array of NUM objects of type TYPE with physical IDs OSPHYSIDS
* and for which processors have ID PROC_PHYSIDS, and add them to the topology.
* */
static __hwloc_inline void
hwloc_setup_level(int procid_max, unsigned num, unsigned *osphysids, unsigned *proc_physids, struct hwloc_topology *topology, hwloc_obj_type_t type)
{
struct hwloc_obj *obj;
unsigned j;
hwloc_debug("%d %s\n", num, hwloc_obj_type_string(type));
for (j = 0; j < num; j++)
{
obj = hwloc_alloc_setup_object(type, osphysids[j]);
hwloc_object_cpuset_from_array(obj, j, proc_physids, procid_max);
hwloc_debug_2args_bitmap("%s %d has cpuset %s\n",
hwloc_obj_type_string(type),
j, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
hwloc_debug("%s", "\n");
}
/* This can be used for the alloc field to get allocated data that can be freed by free() */
void *hwloc_alloc_heap(hwloc_topology_t topology, size_t len);
/* This can be used for the alloc field to get allocated data that can be freed by munmap() */
void *hwloc_alloc_mmap(hwloc_topology_t topology, size_t len);
/* This can be used for the free_membind field to free data using free() */
int hwloc_free_heap(hwloc_topology_t topology, void *addr, size_t len);
/* This can be used for the free_membind field to free data using munmap() */
int hwloc_free_mmap(hwloc_topology_t topology, void *addr, size_t len);
/* Allocates unbound memory or fail, depending on whether STRICT is requested
* or not */
static __hwloc_inline void *
hwloc_alloc_or_fail(hwloc_topology_t topology, size_t len, int flags)
{
if (flags & HWLOC_MEMBIND_STRICT)
return NULL;
return hwloc_alloc(topology, len);
}
extern void hwloc_topology_distances_init(struct hwloc_topology *topology);
extern void hwloc_topology_distances_clear(struct hwloc_topology *topology);
extern void hwloc_topology_distances_destroy(struct hwloc_topology *topology);
extern void hwloc_topology__set_distance_matrix(struct hwloc_topology *topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances);
extern void hwloc_store_distances_from_env(struct hwloc_topology *topology);
extern void hwloc_convert_distances_indexes_into_objects(struct hwloc_topology *topology);
extern void hwloc_finalize_logical_distances(struct hwloc_topology *topology);
extern void hwloc_restrict_distances(struct hwloc_topology *topology, unsigned long flags);
extern void hwloc_free_logical_distances(struct hwloc_distances_s *dist);
extern void hwloc_group_by_distances(struct hwloc_topology *topology);
#endif /* HWLOC_PRIVATE_H */
# Copyright © 2009-2010 INRIA. All rights reserved.
# Copyright © 2009-2010 Université Bordeaux 1
# Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
# See COPYING in top-level directory.
AM_CFLAGS = $(HWLOC_CFLAGS)
AM_CPPFLAGS = $(HWLOC_CPPFLAGS)
AM_LDFLAGS = $(HWLOC_LDFLAGS)
EXTRA_DIST = dolib.c
# If we're in standalone mode, build the installable library.
# Otherwise, build the embedded library.
if HWLOC_BUILD_STANDALONE
lib_LTLIBRARIES = libhwloc.la
else
noinst_LTLIBRARIES = libhwloc_embedded.la
endif
# Sources and ldflags
sources = \
topology.c \
traversal.c \
distances.c \
topology-synthetic.c \
bind.c \
cpuset.c \
misc.c
ldflags =
# Conditionally add to the sources and ldflags
if HWLOC_HAVE_XML
sources += topology-xml.c
endif HWLOC_HAVE_XML
if HWLOC_HAVE_SOLARIS
sources += topology-solaris.c
endif HWLOC_HAVE_SOLARIS
if HWLOC_HAVE_LINUX
sources += topology-linux.c
endif HWLOC_HAVE_LINUX
if HWLOC_HAVE_AIX
sources += topology-aix.c
ldflags += -lpthread
endif HWLOC_HAVE_AIX
if HWLOC_HAVE_OSF
sources += topology-osf.c
ldflags += -lnuma -lpthread
endif HWLOC_HAVE_OSF
if HWLOC_HAVE_HPUX
sources += topology-hpux.c
ldflags += -lpthread
endif HWLOC_HAVE_HPUX
if HWLOC_HAVE_WINDOWS
sources += topology-windows.c
endif HWLOC_HAVE_WINDOWS
if HWLOC_HAVE_DARWIN
sources += topology-darwin.c
endif HWLOC_HAVE_DARWIN
if HWLOC_HAVE_FREEBSD
sources += topology-freebsd.c
endif HWLOC_HAVE_FREEBSD
if HWLOC_HAVE_GCC
ldflags += -no-undefined
endif HWLOC_HAVE_GCC
if HWLOC_HAVE_WINDOWS
LC_MESSAGES=C
export LC_MESSAGES
ldflags += -Xlinker --output-def -Xlinker .libs/libhwloc.def
if HWLOC_HAVE_MS_LIB
.libs/libhwloc.lib: libhwloc.la dolib
./dolib "$(HWLOC_MS_LIB)" X86 .libs/libhwloc.def libhwloc-$(HWLOC_SOVERSION) .libs/libhwloc.lib
all-local: .libs/libhwloc.lib
endif HWLOC_HAVE_MS_LIB
install-exec-hook:
$(INSTALL) .libs/libhwloc.def $(DESTDIR)$(libdir)
if HWLOC_HAVE_MS_LIB
$(INSTALL) .libs/libhwloc.lib $(DESTDIR)$(libdir)
$(INSTALL) .libs/libhwloc.exp $(DESTDIR)$(libdir)
endif HWLOC_HAVE_MS_LIB
endif HWLOC_HAVE_WINDOWS
if HWLOC_HAVE_CPUID
sources += topology-x86.c
endif HWLOC_HAVE_CPUID
# Installable library
libhwloc_la_SOURCES = $(sources)
libhwloc_la_LDFLAGS = $(ldflags) -version-number $(libhwloc_so_version) $(HWLOC_XML_LIBS) $(HWLOC_LINUX_LIBNUMA_LIBS)
# Embedded library (note the lack of a .so version number -- that
# intentionally only appears in the installable library)
libhwloc_embedded_la_SOURCES = $(sources)
libhwloc_embedded_la_LDFLAGS = $(ldflags) $(HWLOC_XML_LIBS) $(HWLOC_LINUX_LIBNUMA_LIBS)
# XML data (only install if we're building in standalone mode)
if HWLOC_BUILD_STANDALONE
xml_DATA = $(srcdir)/hwloc.dtd
xmldir = $(pkgdatadir)
EXTRA_DIST += hwloc.dtd
endif
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Copyright © 2009-2010 INRIA. All rights reserved.
# Copyright © 2009-2010 Université Bordeaux 1
# Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
# See COPYING in top-level directory.
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
# Conditionally add to the sources and ldflags
@HWLOC_HAVE_XML_TRUE@am__append_1 = topology-xml.c
@HWLOC_HAVE_SOLARIS_TRUE@am__append_2 = topology-solaris.c
@HWLOC_HAVE_LINUX_TRUE@am__append_3 = topology-linux.c
@HWLOC_HAVE_AIX_TRUE@am__append_4 = topology-aix.c
@HWLOC_HAVE_AIX_TRUE@am__append_5 = -lpthread
@HWLOC_HAVE_OSF_TRUE@am__append_6 = topology-osf.c
@HWLOC_HAVE_OSF_TRUE@am__append_7 = -lnuma -lpthread
@HWLOC_HAVE_HPUX_TRUE@am__append_8 = topology-hpux.c
@HWLOC_HAVE_HPUX_TRUE@am__append_9 = -lpthread
@HWLOC_HAVE_WINDOWS_TRUE@am__append_10 = topology-windows.c
@HWLOC_HAVE_DARWIN_TRUE@am__append_11 = topology-darwin.c
@HWLOC_HAVE_FREEBSD_TRUE@am__append_12 = topology-freebsd.c
@HWLOC_HAVE_GCC_TRUE@am__append_13 = -no-undefined
@HWLOC_HAVE_WINDOWS_TRUE@am__append_14 = -Xlinker --output-def -Xlinker .libs/libhwloc.def
@HWLOC_HAVE_CPUID_TRUE@am__append_15 = topology-x86.c
@HWLOC_BUILD_STANDALONE_TRUE@am__append_16 = hwloc.dtd
subdir = hwloc-1.2.1/src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/hwloc-1.2.1/config/hwloc_check_attributes.m4 \
$(top_srcdir)/hwloc-1.2.1/config/hwloc_check_visibility.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/hwloc-1.2.1/config/hwloc.m4 \
$(top_srcdir)/hwloc-1.2.1/config/hwloc_pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/hwloc-1.2.1/include/private/autogen/config.h \
$(top_builddir)/hwloc-1.2.1/include/hwloc/autogen/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(xmldir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
libhwloc_la_LIBADD =
am__libhwloc_la_SOURCES_DIST = topology.c traversal.c distances.c \
topology-synthetic.c bind.c cpuset.c misc.c topology-xml.c \
topology-solaris.c topology-linux.c topology-aix.c \
topology-osf.c topology-hpux.c topology-windows.c \
topology-darwin.c topology-freebsd.c topology-x86.c
@HWLOC_HAVE_XML_TRUE@am__objects_1 = topology-xml.lo
@HWLOC_HAVE_SOLARIS_TRUE@am__objects_2 = topology-solaris.lo
@HWLOC_HAVE_LINUX_TRUE@am__objects_3 = topology-linux.lo
@HWLOC_HAVE_AIX_TRUE@am__objects_4 = topology-aix.lo
@HWLOC_HAVE_OSF_TRUE@am__objects_5 = topology-osf.lo
@HWLOC_HAVE_HPUX_TRUE@am__objects_6 = topology-hpux.lo
@HWLOC_HAVE_WINDOWS_TRUE@am__objects_7 = topology-windows.lo
@HWLOC_HAVE_DARWIN_TRUE@am__objects_8 = topology-darwin.lo
@HWLOC_HAVE_FREEBSD_TRUE@am__objects_9 = topology-freebsd.lo
@HWLOC_HAVE_CPUID_TRUE@am__objects_10 = topology-x86.lo
am__objects_11 = topology.lo traversal.lo distances.lo \
topology-synthetic.lo bind.lo cpuset.lo misc.lo \
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
$(am__objects_10)
am_libhwloc_la_OBJECTS = $(am__objects_11)
libhwloc_la_OBJECTS = $(am_libhwloc_la_OBJECTS)
libhwloc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libhwloc_la_LDFLAGS) $(LDFLAGS) -o $@
@HWLOC_BUILD_STANDALONE_TRUE@am_libhwloc_la_rpath = -rpath $(libdir)
libhwloc_embedded_la_LIBADD =
am__libhwloc_embedded_la_SOURCES_DIST = topology.c traversal.c \
distances.c topology-synthetic.c bind.c cpuset.c misc.c \
topology-xml.c topology-solaris.c topology-linux.c \
topology-aix.c topology-osf.c topology-hpux.c \
topology-windows.c topology-darwin.c topology-freebsd.c \
topology-x86.c
am_libhwloc_embedded_la_OBJECTS = $(am__objects_11)
libhwloc_embedded_la_OBJECTS = $(am_libhwloc_embedded_la_OBJECTS)
libhwloc_embedded_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libhwloc_embedded_la_LDFLAGS) $(LDFLAGS) -o $@
@HWLOC_BUILD_STANDALONE_FALSE@am_libhwloc_embedded_la_rpath =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/hwloc-1.2.1/include/private/autogen -I$(top_builddir)/hwloc-1.2.1/include/hwloc/autogen
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libhwloc_la_SOURCES) $(libhwloc_embedded_la_SOURCES)
DIST_SOURCES = $(am__libhwloc_la_SOURCES_DIST) \
$(am__libhwloc_embedded_la_SOURCES_DIST)
DATA = $(xml_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASH = @BASH@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HWLOC_CFLAGS = @HWLOC_CFLAGS@
HWLOC_CPPFLAGS = @HWLOC_CPPFLAGS@
HWLOC_EMBEDDED_CFLAGS = @HWLOC_EMBEDDED_CFLAGS@
HWLOC_EMBEDDED_CPPFLAGS = @HWLOC_EMBEDDED_CPPFLAGS@
HWLOC_EMBEDDED_LDADD = @HWLOC_EMBEDDED_LDADD@
HWLOC_EMBEDDED_LIBS = @HWLOC_EMBEDDED_LIBS@
HWLOC_HAVE_XML = @HWLOC_HAVE_XML@
HWLOC_KERRIGHED_CFLAGS = @HWLOC_KERRIGHED_CFLAGS@
HWLOC_KERRIGHED_LIBS = @HWLOC_KERRIGHED_LIBS@
HWLOC_LDFLAGS = @HWLOC_LDFLAGS@
HWLOC_LIBS = @HWLOC_LIBS@
HWLOC_LINUX_LIBNUMA_LIBS = @HWLOC_LINUX_LIBNUMA_LIBS@
HWLOC_MS_LIB = @HWLOC_MS_LIB@
HWLOC_PKG_CONFIG = @HWLOC_PKG_CONFIG@
HWLOC_REQUIRES = @HWLOC_REQUIRES@
HWLOC_XML_CFLAGS = @HWLOC_XML_CFLAGS@
HWLOC_XML_LIBS = @HWLOC_XML_LIBS@
HWLOC_top_builddir = @HWLOC_top_builddir@
HWLOC_top_srcdir = @HWLOC_top_srcdir@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = $(HWLOC_CFLAGS)
AM_CPPFLAGS = $(HWLOC_CPPFLAGS)
AM_LDFLAGS = $(HWLOC_LDFLAGS)
EXTRA_DIST = dolib.c $(am__append_16)
# If we're in standalone mode, build the installable library.
# Otherwise, build the embedded library.
@HWLOC_BUILD_STANDALONE_TRUE@lib_LTLIBRARIES = libhwloc.la
@HWLOC_BUILD_STANDALONE_FALSE@noinst_LTLIBRARIES = libhwloc_embedded.la
# Sources and ldflags
sources = topology.c traversal.c distances.c topology-synthetic.c \
bind.c cpuset.c misc.c $(am__append_1) $(am__append_2) \
$(am__append_3) $(am__append_4) $(am__append_6) \
$(am__append_8) $(am__append_10) $(am__append_11) \
$(am__append_12) $(am__append_15)
ldflags = $(am__append_5) $(am__append_7) $(am__append_9) \
$(am__append_13) $(am__append_14)
@HWLOC_HAVE_WINDOWS_TRUE@LC_MESSAGES = C
# Installable library
libhwloc_la_SOURCES = $(sources)
libhwloc_la_LDFLAGS = $(ldflags) -version-number $(libhwloc_so_version) $(HWLOC_XML_LIBS) $(HWLOC_LINUX_LIBNUMA_LIBS)
# Embedded library (note the lack of a .so version number -- that
# intentionally only appears in the installable library)
libhwloc_embedded_la_SOURCES = $(sources)
libhwloc_embedded_la_LDFLAGS = $(ldflags) $(HWLOC_XML_LIBS) $(HWLOC_LINUX_LIBNUMA_LIBS)
# XML data (only install if we're building in standalone mode)
@HWLOC_BUILD_STANDALONE_TRUE@xml_DATA = $(srcdir)/hwloc.dtd
@HWLOC_BUILD_STANDALONE_TRUE@xmldir = $(pkgdatadir)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu hwloc-1.2.1/src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu hwloc-1.2.1/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libhwloc.la: $(libhwloc_la_OBJECTS) $(libhwloc_la_DEPENDENCIES)
$(libhwloc_la_LINK) $(am_libhwloc_la_rpath) $(libhwloc_la_OBJECTS) $(libhwloc_la_LIBADD) $(LIBS)
libhwloc_embedded.la: $(libhwloc_embedded_la_OBJECTS) $(libhwloc_embedded_la_DEPENDENCIES)
$(libhwloc_embedded_la_LINK) $(am_libhwloc_embedded_la_rpath) $(libhwloc_embedded_la_OBJECTS) $(libhwloc_embedded_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bind.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpuset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distances.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-aix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-darwin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-freebsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-hpux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-linux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-osf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-solaris.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-synthetic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-windows.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-x86.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology-xml.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/topology.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/traversal.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-xmlDATA: $(xml_DATA)
@$(NORMAL_INSTALL)
test -z "$(xmldir)" || $(MKDIR_P) "$(DESTDIR)$(xmldir)"
@list='$(xml_DATA)'; test -n "$(xmldir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(xmldir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(xmldir)" || exit $$?; \
done
uninstall-xmlDATA:
@$(NORMAL_UNINSTALL)
@list='$(xml_DATA)'; test -n "$(xmldir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(xmldir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(xmldir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
@HWLOC_HAVE_MS_LIB_FALSE@all-local:
@HWLOC_HAVE_WINDOWS_FALSE@all-local:
all-am: Makefile $(LTLIBRARIES) $(DATA) all-local
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(xmldir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@HWLOC_HAVE_WINDOWS_FALSE@install-exec-hook:
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-xmlDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES uninstall-xmlDATA
.MAKE: install-am install-exec-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-exec-hook install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip install-xmlDATA \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES \
uninstall-xmlDATA
@HWLOC_HAVE_WINDOWS_TRUE@export LC_MESSAGES
@HWLOC_HAVE_MS_LIB_TRUE@@HWLOC_HAVE_WINDOWS_TRUE@.libs/libhwloc.lib: libhwloc.la dolib
@HWLOC_HAVE_MS_LIB_TRUE@@HWLOC_HAVE_WINDOWS_TRUE@ ./dolib "$(HWLOC_MS_LIB)" X86 .libs/libhwloc.def libhwloc-$(HWLOC_SOVERSION) .libs/libhwloc.lib
@HWLOC_HAVE_MS_LIB_TRUE@@HWLOC_HAVE_WINDOWS_TRUE@all-local: .libs/libhwloc.lib
@HWLOC_HAVE_WINDOWS_TRUE@install-exec-hook:
@HWLOC_HAVE_WINDOWS_TRUE@ $(INSTALL) .libs/libhwloc.def $(DESTDIR)$(libdir)
@HWLOC_HAVE_MS_LIB_TRUE@@HWLOC_HAVE_WINDOWS_TRUE@ $(INSTALL) .libs/libhwloc.lib $(DESTDIR)$(libdir)
@HWLOC_HAVE_MS_LIB_TRUE@@HWLOC_HAVE_WINDOWS_TRUE@ $(INSTALL) .libs/libhwloc.exp $(DESTDIR)$(libdir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 INRIA. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#include <hwloc.h>
#include <private/private.h>
#include <hwloc/helper.h>
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
/* TODO: HWLOC_GNU_SYS, HWLOC_IRIX_SYS,
*
* IRIX: see MP_MUSTRUN / _DSM_MUSTRUN, pthread_setrunon_np, /hw, procss_cpulink, numa_create
*
* We could use glibc's sched_setaffinity generically when it is available
*
* Darwin and OpenBSD don't seem to have binding facilities.
*/
static hwloc_const_bitmap_t
hwloc_fix_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set)
{
hwloc_const_bitmap_t topology_set = hwloc_topology_get_topology_cpuset(topology);
hwloc_const_bitmap_t complete_set = hwloc_topology_get_complete_cpuset(topology);
if (!topology_set) {
/* The topology is composed of several systems, the cpuset is ambiguous. */
errno = EXDEV;
return NULL;
}
if (hwloc_bitmap_iszero(set)) {
errno = EINVAL;
return NULL;
}
if (!hwloc_bitmap_isincluded(set, complete_set)) {
errno = EINVAL;
return NULL;
}
if (hwloc_bitmap_isincluded(topology_set, set))
set = complete_set;
return set;
}
int
hwloc_set_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set, int flags)
{
set = hwloc_fix_cpubind(topology, set);
if (!set)
return -1;
if (flags & HWLOC_CPUBIND_PROCESS) {
if (topology->set_thisproc_cpubind)
return topology->set_thisproc_cpubind(topology, set, flags);
} else if (flags & HWLOC_CPUBIND_THREAD) {
if (topology->set_thisthread_cpubind)
return topology->set_thisthread_cpubind(topology, set, flags);
} else {
if (topology->set_thisproc_cpubind)
return topology->set_thisproc_cpubind(topology, set, flags);
else if (topology->set_thisthread_cpubind)
return topology->set_thisthread_cpubind(topology, set, flags);
}
errno = ENOSYS;
return -1;
}
int
hwloc_get_cpubind(hwloc_topology_t topology, hwloc_bitmap_t set, int flags)
{
if (flags & HWLOC_CPUBIND_PROCESS) {
if (topology->get_thisproc_cpubind)
return topology->get_thisproc_cpubind(topology, set, flags);
} else if (flags & HWLOC_CPUBIND_THREAD) {
if (topology->get_thisthread_cpubind)
return topology->get_thisthread_cpubind(topology, set, flags);
} else {
if (topology->get_thisproc_cpubind)
return topology->get_thisproc_cpubind(topology, set, flags);
else if (topology->get_thisthread_cpubind)
return topology->get_thisthread_cpubind(topology, set, flags);
}
errno = ENOSYS;
return -1;
}
int
hwloc_set_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t set, int flags)
{
set = hwloc_fix_cpubind(topology, set);
if (!set)
return -1;
if (topology->set_proc_cpubind)
return topology->set_proc_cpubind(topology, pid, set, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t set, int flags)
{
if (topology->get_proc_cpubind)
return topology->get_proc_cpubind(topology, pid, set, flags);
errno = ENOSYS;
return -1;
}
#ifdef hwloc_thread_t
int
hwloc_set_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_bitmap_t set, int flags)
{
set = hwloc_fix_cpubind(topology, set);
if (!set)
return -1;
if (topology->set_thread_cpubind)
return topology->set_thread_cpubind(topology, tid, set, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_bitmap_t set, int flags)
{
if (topology->get_thread_cpubind)
return topology->get_thread_cpubind(topology, tid, set, flags);
errno = ENOSYS;
return -1;
}
#endif
int
hwloc_get_last_cpu_location(hwloc_topology_t topology, hwloc_bitmap_t set, int flags)
{
if (flags & HWLOC_CPUBIND_PROCESS) {
if (topology->get_thisproc_last_cpu_location)
return topology->get_thisproc_last_cpu_location(topology, set, flags);
} else if (flags & HWLOC_CPUBIND_THREAD) {
if (topology->get_thisthread_last_cpu_location)
return topology->get_thisthread_last_cpu_location(topology, set, flags);
} else {
if (topology->get_thisproc_last_cpu_location)
return topology->get_thisproc_last_cpu_location(topology, set, flags);
else if (topology->get_thisthread_last_cpu_location)
return topology->get_thisthread_last_cpu_location(topology, set, flags);
}
errno = ENOSYS;
return -1;
}
int
hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t set, int flags)
{
if (topology->get_proc_last_cpu_location)
return topology->get_proc_last_cpu_location(topology, pid, set, flags);
errno = ENOSYS;
return -1;
}
static hwloc_const_nodeset_t
hwloc_fix_membind(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
{
hwloc_const_bitmap_t topology_nodeset = hwloc_topology_get_topology_nodeset(topology);
hwloc_const_bitmap_t complete_nodeset = hwloc_topology_get_complete_nodeset(topology);
if (!hwloc_topology_get_topology_cpuset(topology)) {
/* The topology is composed of several systems, the nodeset is thus
* ambiguous. */
errno = EXDEV;
return NULL;
}
if (!complete_nodeset) {
/* There is no NUMA node */
errno = ENODEV;
return NULL;
}
if (hwloc_bitmap_iszero(nodeset)) {
errno = EINVAL;
return NULL;
}
if (!hwloc_bitmap_isincluded(nodeset, complete_nodeset)) {
errno = EINVAL;
return NULL;
}
if (hwloc_bitmap_isincluded(topology_nodeset, nodeset))
return complete_nodeset;
return nodeset;
}
static int
hwloc_fix_membind_cpuset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_const_cpuset_t cpuset)
{
hwloc_const_bitmap_t topology_set = hwloc_topology_get_topology_cpuset(topology);
hwloc_const_bitmap_t complete_set = hwloc_topology_get_complete_cpuset(topology);
hwloc_const_bitmap_t complete_nodeset = hwloc_topology_get_complete_nodeset(topology);
if (!topology_set) {
/* The topology is composed of several systems, the cpuset is thus
* ambiguous. */
errno = EXDEV;
return -1;
}
if (!complete_nodeset) {
/* There is no NUMA node */
errno = ENODEV;
return -1;
}
if (hwloc_bitmap_iszero(cpuset)) {
errno = EINVAL;
return -1;
}
if (!hwloc_bitmap_isincluded(cpuset, complete_set)) {
errno = EINVAL;
return -1;
}
if (hwloc_bitmap_isincluded(topology_set, cpuset)) {
hwloc_bitmap_copy(nodeset, complete_nodeset);
return 0;
}
hwloc_cpuset_to_nodeset(topology, cpuset, nodeset);
return 0;
}
int
hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
{
nodeset = hwloc_fix_membind(topology, nodeset);
if (!nodeset)
return -1;
if (flags & HWLOC_MEMBIND_PROCESS) {
if (topology->set_thisproc_membind)
return topology->set_thisproc_membind(topology, nodeset, policy, flags);
} else if (flags & HWLOC_MEMBIND_THREAD) {
if (topology->set_thisthread_membind)
return topology->set_thisthread_membind(topology, nodeset, policy, flags);
} else {
if (topology->set_thisproc_membind)
return topology->set_thisproc_membind(topology, nodeset, policy, flags);
else if (topology->set_thisthread_membind)
return topology->set_thisthread_membind(topology, nodeset, policy, flags);
}
errno = ENOSYS;
return -1;
}
int
hwloc_set_membind(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
{
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
int ret;
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
ret = -1;
else
ret = hwloc_set_membind_nodeset(topology, nodeset, policy, flags);
hwloc_bitmap_free(nodeset);
return ret;
}
int
hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
{
if (flags & HWLOC_MEMBIND_PROCESS) {
if (topology->get_thisproc_membind)
return topology->get_thisproc_membind(topology, nodeset, policy, flags);
} else if (flags & HWLOC_MEMBIND_THREAD) {
if (topology->get_thisthread_membind)
return topology->get_thisthread_membind(topology, nodeset, policy, flags);
} else {
if (topology->get_thisproc_membind)
return topology->get_thisproc_membind(topology, nodeset, policy, flags);
else if (topology->get_thisthread_membind)
return topology->get_thisthread_membind(topology, nodeset, policy, flags);
}
errno = ENOSYS;
return -1;
}
int
hwloc_get_membind(hwloc_topology_t topology, hwloc_cpuset_t set, hwloc_membind_policy_t * policy, int flags)
{
hwloc_nodeset_t nodeset;
int ret;
nodeset = hwloc_bitmap_alloc();
ret = hwloc_get_membind_nodeset(topology, nodeset, policy, flags);
if (!ret)
hwloc_cpuset_from_nodeset(topology, set, nodeset);
return ret;
}
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)
{
nodeset = hwloc_fix_membind(topology, nodeset);
if (!nodeset)
return -1;
if (topology->set_proc_membind)
return topology->set_proc_membind(topology, pid, nodeset, policy, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_set_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
{
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
int ret;
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
ret = -1;
else
ret = hwloc_set_proc_membind_nodeset(topology, pid, nodeset, policy, flags);
hwloc_bitmap_free(nodeset);
return ret;
}
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)
{
if (topology->get_proc_membind)
return topology->get_proc_membind(topology, pid, nodeset, policy, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_get_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, hwloc_membind_policy_t * policy, int flags)
{
hwloc_nodeset_t nodeset;
int ret;
nodeset = hwloc_bitmap_alloc();
ret = hwloc_get_proc_membind_nodeset(topology, pid, nodeset, policy, flags);
if (!ret)
hwloc_cpuset_from_nodeset(topology, set, nodeset);
return ret;
}
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)
{
nodeset = hwloc_fix_membind(topology, nodeset);
if (!nodeset)
return -1;
if (topology->set_area_membind)
return topology->set_area_membind(topology, addr, len, nodeset, policy, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_set_area_membind(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
{
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
int ret;
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
ret = -1;
else
ret = hwloc_set_area_membind_nodeset(topology, addr, len, nodeset, policy, flags);
hwloc_bitmap_free(nodeset);
return ret;
}
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)
{
if (topology->get_area_membind)
return topology->get_area_membind(topology, addr, len, nodeset, policy, flags);
errno = ENOSYS;
return -1;
}
int
hwloc_get_area_membind(hwloc_topology_t topology, const void *addr, size_t len, hwloc_cpuset_t set, hwloc_membind_policy_t * policy, int flags)
{
hwloc_nodeset_t nodeset;
int ret;
nodeset = hwloc_bitmap_alloc();
ret = hwloc_get_area_membind_nodeset(topology, addr, len, nodeset, policy, flags);
if (!ret)
hwloc_cpuset_from_nodeset(topology, set, nodeset);
return ret;
}
void *
hwloc_alloc_heap(hwloc_topology_t topology __hwloc_attribute_unused, size_t len)
{
void *p;
#if defined(HAVE_GETPAGESIZE) && defined(HAVE_POSIX_MEMALIGN)
errno = posix_memalign(&p, getpagesize(), len);
if (errno)
p = NULL;
#elif defined(HAVE_GETPAGESIZE) && defined(HAVE_MEMALIGN)
p = memalign(getpagesize(), len);
#else
p = malloc(len);
#endif
return p;
}
#ifdef MAP_ANONYMOUS
void *
hwloc_alloc_mmap(hwloc_topology_t topology __hwloc_attribute_unused, size_t len)
{
return mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
}
#endif
int
hwloc_free_heap(hwloc_topology_t topology __hwloc_attribute_unused, void *addr, size_t len __hwloc_attribute_unused)
{
free(addr);
return 0;
}
#ifdef MAP_ANONYMOUS
int
hwloc_free_mmap(hwloc_topology_t topology __hwloc_attribute_unused, void *addr, size_t len)
{
if (!addr)
return 0;
return munmap(addr, len);
}
#endif
void *
hwloc_alloc(hwloc_topology_t topology, size_t len)
{
if (topology->alloc)
return topology->alloc(topology, len);
return hwloc_alloc_heap(topology, len);
}
void *
hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
{
void *p;
nodeset = hwloc_fix_membind(topology, nodeset);
if (!nodeset)
goto fallback;
if (flags & HWLOC_MEMBIND_MIGRATE) {
errno = EINVAL;
goto fallback;
}
if (topology->alloc_membind)
return topology->alloc_membind(topology, len, nodeset, policy, flags);
else if (topology->set_area_membind) {
p = hwloc_alloc(topology, len);
if (!p)
return NULL;
if (topology->set_area_membind(topology, p, len, nodeset, policy, flags) && flags & HWLOC_MEMBIND_STRICT) {
int error = errno;
free(p);
errno = error;
return NULL;
}
return p;
} else {
errno = ENOSYS;
}
fallback:
if (flags & HWLOC_MEMBIND_STRICT)
/* Report error */
return NULL;
/* Never mind, allocate anyway */
return hwloc_alloc(topology, len);
}
void *
hwloc_alloc_membind(hwloc_topology_t topology, size_t len, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
{
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
void *ret;
if (!hwloc_fix_membind_cpuset(topology, nodeset, set)) {
if (flags & HWLOC_MEMBIND_STRICT)
ret = NULL;
else
ret = hwloc_alloc(topology, len);
} else
ret = hwloc_alloc_membind_nodeset(topology, len, nodeset, policy, flags);
hwloc_bitmap_free(nodeset);
return ret;
}
int
hwloc_free(hwloc_topology_t topology, void *addr, size_t len)
{
if (topology->free_membind)
return topology->free_membind(topology, addr, len);
return hwloc_free_heap(topology, addr, len);
}
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2011 INRIA. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* cpuset.h converts from the old cpuset API to the new bitmap API, we don't want it here */
#ifndef HWLOC_CPUSET_H
/* make sure cpuset.h will not be automatically included here */
#define HWLOC_CPUSET_H 1
#else
#error Do not include cpuset.h in cpuset.c
#endif
#include <private/autogen/config.h>
#include <private/misc.h>
#include <private/private.h>
#include <hwloc/bitmap.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <ctype.h>
/* TODO
* - have a way to change the initial allocation size
* - preallocate inside the bitmap structure (so that the whole structure is a cacheline for instance)
* and allocate a dedicated array only later when reallocating larger
*/
/* magic number */
#define HWLOC_BITMAP_MAGIC 0x20091007
/* actual opaque type internals */
struct hwloc_bitmap_s {
unsigned ulongs_count; /* how many ulong bitmasks are valid, >= 1 */
unsigned ulongs_allocated; /* how many ulong bitmasks are allocated, >= ulongs_count */
unsigned long *ulongs;
int infinite; /* set to 1 if all bits beyond ulongs are set */
#ifdef HWLOC_DEBUG
int magic;
#endif
};
/* overzealous check in debug-mode, not as powerful as valgrind but still useful */
#ifdef HWLOC_DEBUG
#define HWLOC__BITMAP_CHECK(set) do { \
assert((set)->magic == HWLOC_BITMAP_MAGIC); \
assert((set)->ulongs_count >= 1); \
assert((set)->ulongs_allocated >= (set)->ulongs_count); \
} while (0)
#else
#define HWLOC__BITMAP_CHECK(set)
#endif
/* extract a subset from a set using an index or a cpu */
#define HWLOC_SUBBITMAP_INDEX(cpu) ((cpu)/(HWLOC_BITS_PER_LONG))
#define HWLOC_SUBBITMAP_CPU_ULBIT(cpu) ((cpu)%(HWLOC_BITS_PER_LONG))
/* Read from a bitmap ulong without knowing whether x is valid.
* Writers should make sure that x is valid and modify set->ulongs[x] directly.
*/
#define HWLOC_SUBBITMAP_READULONG(set,x) ((x) < (set)->ulongs_count ? (set)->ulongs[x] : (set)->infinite ? HWLOC_SUBBITMAP_FULL : HWLOC_SUBBITMAP_ZERO)
/* predefined subset values */
#define HWLOC_SUBBITMAP_ZERO 0UL
#define HWLOC_SUBBITMAP_FULL (~0UL)
#define HWLOC_SUBBITMAP_ULBIT(bit) (1UL<<(bit))
#define HWLOC_SUBBITMAP_CPU(cpu) HWLOC_SUBBITMAP_ULBIT(HWLOC_SUBBITMAP_CPU_ULBIT(cpu))
#define HWLOC_SUBBITMAP_ULBIT_TO(bit) (HWLOC_SUBBITMAP_FULL>>(HWLOC_BITS_PER_LONG-1-(bit)))
#define HWLOC_SUBBITMAP_ULBIT_FROM(bit) (HWLOC_SUBBITMAP_FULL<<(bit))
#define HWLOC_SUBBITMAP_ULBIT_FROMTO(begin,end) (HWLOC_SUBBITMAP_ULBIT_TO(end) & HWLOC_SUBBITMAP_ULBIT_FROM(begin))
struct hwloc_bitmap_s * hwloc_bitmap_alloc(void)
{
struct hwloc_bitmap_s * set;
set = malloc(sizeof(struct hwloc_bitmap_s));
if (!set)
return NULL;
set->ulongs_count = 1;
set->ulongs_allocated = 64/sizeof(unsigned long);
set->ulongs = malloc(64);
if (!set->ulongs) {
free(set);
return NULL;
}
set->ulongs[0] = HWLOC_SUBBITMAP_ZERO;
set->infinite = 0;
#ifdef HWLOC_DEBUG
set->magic = HWLOC_BITMAP_MAGIC;
#endif
return set;
}
struct hwloc_bitmap_s * hwloc_bitmap_alloc_full(void)
{
struct hwloc_bitmap_s * set = hwloc_bitmap_alloc();
if (set) {
set->infinite = 1;
set->ulongs[0] = HWLOC_SUBBITMAP_FULL;
}
return set;
}
void hwloc_bitmap_free(struct hwloc_bitmap_s * set)
{
if (!set)
return;
HWLOC__BITMAP_CHECK(set);
#ifdef HWLOC_DEBUG
set->magic = 0;
#endif
free(set->ulongs);
free(set);
}
/* enlarge until it contains at least needed_count ulongs.
*/
static void
hwloc_bitmap_enlarge_by_ulongs(struct hwloc_bitmap_s * set, unsigned needed_count)
{
unsigned tmp = 1 << hwloc_flsl((unsigned long) needed_count - 1);
if (tmp > set->ulongs_allocated) {
set->ulongs = realloc(set->ulongs, tmp * sizeof(unsigned long));
assert(set->ulongs);
set->ulongs_allocated = tmp;
}
}
/* enlarge until it contains at least needed_count ulongs,
* and update new ulongs according to the infinite field.
*/
static void
hwloc_bitmap_realloc_by_ulongs(struct hwloc_bitmap_s * set, unsigned needed_count)
{
unsigned i;
HWLOC__BITMAP_CHECK(set);
if (needed_count <= set->ulongs_count)
return;
/* realloc larger if needed */
hwloc_bitmap_enlarge_by_ulongs(set, needed_count);
/* fill the newly allocated subset depending on the infinite flag */
for(i=set->ulongs_count; i<needed_count; i++)
set->ulongs[i] = set->infinite ? HWLOC_SUBBITMAP_FULL : HWLOC_SUBBITMAP_ZERO;
set->ulongs_count = needed_count;
}
/* realloc until it contains at least cpu+1 bits */
#define hwloc_bitmap_realloc_by_cpu_index(set, cpu) hwloc_bitmap_realloc_by_ulongs(set, ((cpu)/HWLOC_BITS_PER_LONG)+1)
/* reset a bitmap to exactely the needed size.
* the caller must reinitialize all ulongs and the infinite flag later.
*/
static void
hwloc_bitmap_reset_by_ulongs(struct hwloc_bitmap_s * set, unsigned needed_count)
{
hwloc_bitmap_enlarge_by_ulongs(set, needed_count);
set->ulongs_count = needed_count;
}
/* reset until it contains exactly cpu+1 bits (roundup to a ulong).
* the caller must reinitialize all ulongs and the infinite flag later.
*/
#define hwloc_bitmap_reset_by_cpu_index(set, cpu) hwloc_bitmap_reset_by_ulongs(set, ((cpu)/HWLOC_BITS_PER_LONG)+1)
struct hwloc_bitmap_s * hwloc_bitmap_dup(const struct hwloc_bitmap_s * old)
{
struct hwloc_bitmap_s * new;
if (!old)
return NULL;
HWLOC__BITMAP_CHECK(old);
new = malloc(sizeof(struct hwloc_bitmap_s));
if (!new)
return NULL;
new->ulongs = malloc(old->ulongs_allocated * sizeof(unsigned long));
if (!new->ulongs) {
free(new);
return NULL;
}
new->ulongs_allocated = old->ulongs_allocated;
new->ulongs_count = old->ulongs_count;
memcpy(new->ulongs, old->ulongs, new->ulongs_count * sizeof(unsigned long));
new->infinite = old->infinite;
#ifdef HWLOC_DEBUG
new->magic = HWLOC_BITMAP_MAGIC;
#endif
return new;
}
void hwloc_bitmap_copy(struct hwloc_bitmap_s * dst, const struct hwloc_bitmap_s * src)
{
HWLOC__BITMAP_CHECK(dst);
HWLOC__BITMAP_CHECK(src);
hwloc_bitmap_reset_by_ulongs(dst, src->ulongs_count);
memcpy(dst->ulongs, src->ulongs, src->ulongs_count * sizeof(unsigned long));
dst->infinite = src->infinite;
}
/* Strings always use 32bit groups */
#define HWLOC_PRIxSUBBITMAP "%08lx"
#define HWLOC_BITMAP_SUBSTRING_SIZE 32
#define HWLOC_BITMAP_SUBSTRING_LENGTH (HWLOC_BITMAP_SUBSTRING_SIZE/4)
#define HWLOC_BITMAP_STRING_PER_LONG (HWLOC_BITS_PER_LONG/HWLOC_BITMAP_SUBSTRING_SIZE)
int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
ssize_t size = buflen;
char *tmp = buf;
int res, ret = 0;
int needcomma = 0;
int i;
unsigned long accum = 0;
int accumed = 0;
#if HWLOC_BITS_PER_LONG == HWLOC_BITMAP_SUBSTRING_SIZE
const unsigned long accum_mask = ~0UL;
#else /* HWLOC_BITS_PER_LONG != HWLOC_BITMAP_SUBSTRING_SIZE */
const unsigned long accum_mask = ((1UL << HWLOC_BITMAP_SUBSTRING_SIZE) - 1) << (HWLOC_BITS_PER_LONG - HWLOC_BITMAP_SUBSTRING_SIZE);
#endif /* HWLOC_BITS_PER_LONG != HWLOC_BITMAP_SUBSTRING_SIZE */
HWLOC__BITMAP_CHECK(set);
/* mark the end in case we do nothing later */
if (buflen > 0)
tmp[0] = '\0';
if (set->infinite) {
res = hwloc_snprintf(tmp, size, "0xf...f");
needcomma = 1;
if (res < 0)
return -1;
ret += res;
if (res >= size)
res = size>0 ? size - 1 : 0;
tmp += res;
size -= res;
/* optimize a common case: full bitmap should appear as 0xf...f instead of 0xf...f,0xffffffff */
if (set->ulongs_count == 1 && set->ulongs[0] == HWLOC_SUBBITMAP_FULL)
return ret;
}
i=set->ulongs_count-1;
while (i>=0 || accumed) {
/* Refill accumulator */
if (!accumed) {
accum = set->ulongs[i--];
accumed = HWLOC_BITS_PER_LONG;
}
if (accum & accum_mask) {
/* print the whole subset if not empty */
res = hwloc_snprintf(tmp, size, needcomma ? ",0x" HWLOC_PRIxSUBBITMAP : "0x" HWLOC_PRIxSUBBITMAP,
(accum & accum_mask) >> (HWLOC_BITS_PER_LONG - HWLOC_BITMAP_SUBSTRING_SIZE));
needcomma = 1;
} else if (i == -1 && accumed == HWLOC_BITMAP_SUBSTRING_SIZE) {
/* print a single 0 to mark the last subset */
res = hwloc_snprintf(tmp, size, needcomma ? ",0x0" : "0x0");
} else if (needcomma) {
res = hwloc_snprintf(tmp, size, ",");
} else {
res = 0;
}
if (res < 0)
return -1;
ret += res;
#if HWLOC_BITS_PER_LONG == HWLOC_BITMAP_SUBSTRING_SIZE
accum = 0;
accumed = 0;
#else
accum <<= HWLOC_BITMAP_SUBSTRING_SIZE;
accumed -= HWLOC_BITMAP_SUBSTRING_SIZE;
#endif
if (res >= size)
res = size>0 ? size - 1 : 0;
tmp += res;
size -= res;
}
return ret;
}
int hwloc_bitmap_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
int len;
char *buf;
HWLOC__BITMAP_CHECK(set);
len = hwloc_bitmap_snprintf(NULL, 0, set);
buf = malloc(len+1);
*strp = buf;
return hwloc_bitmap_snprintf(buf, len+1, set);
}
int hwloc_bitmap_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string)
{
const char * current = string;
unsigned long accum = 0;
int count=0;
int infinite = 0;
/* count how many substrings there are */
count++;
while ((current = strchr(current+1, ',')) != NULL)
count++;
current = string;
if (!strncmp("0xf...f", current, 7)) {
current += 7;
if (*current != ',') {
/* special case for infinite/full cpuset */
hwloc_bitmap_fill(set);
return 0;
}
current++;
infinite = 1;
count--;
}
hwloc_bitmap_reset_by_ulongs(set, (count + HWLOC_BITMAP_STRING_PER_LONG - 1) / HWLOC_BITMAP_STRING_PER_LONG);
set->infinite = 0;
while (*current != '\0') {
unsigned long val;
char *next;
val = strtoul(current, &next, 16);
assert(count > 0);
count--;
accum |= (val << ((count * HWLOC_BITMAP_SUBSTRING_SIZE) % HWLOC_BITS_PER_LONG));
if (!(count % HWLOC_BITMAP_STRING_PER_LONG)) {
set->ulongs[count / HWLOC_BITMAP_STRING_PER_LONG] = accum;
accum = 0;
}
if (*next != ',') {
if (*next || count > 0)
goto failed;
else
break;
}
current = (const char*) next+1;
}
set->infinite = infinite; /* set at the end, to avoid spurious realloc with filled new ulongs */
return 0;
failed:
/* failure to parse */
hwloc_bitmap_zero(set);
return -1;
}
int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
int prev = -1;
hwloc_bitmap_t reverse;
ssize_t size = buflen;
char *tmp = buf;
int res, ret = 0;
int needcomma = 0;
HWLOC__BITMAP_CHECK(set);
reverse = hwloc_bitmap_alloc(); /* FIXME: add hwloc_bitmap_alloc_size() + hwloc_bitmap_init_allocated() to avoid malloc? */
hwloc_bitmap_not(reverse, set);
/* mark the end in case we do nothing later */
if (buflen > 0)
tmp[0] = '\0';
while (1) {
int begin, end;
begin = hwloc_bitmap_next(set, prev);
if (begin == -1)
break;
end = hwloc_bitmap_next(reverse, begin);
if (end == begin+1) {
res = hwloc_snprintf(tmp, size, needcomma ? ",%d" : "%d", begin);
} else if (end == -1) {
res = hwloc_snprintf(tmp, size, needcomma ? ",%d-" : "%d-", begin);
} else {
res = hwloc_snprintf(tmp, size, needcomma ? ",%d-%d" : "%d-%d", begin, end-1);
}
if (res < 0) {
hwloc_bitmap_free(reverse);
return -1;
}
ret += res;
if (res >= size)
res = size>0 ? size - 1 : 0;
tmp += res;
size -= res;
needcomma = 1;
if (end == -1)
break;
else
prev = end - 1;
}
hwloc_bitmap_free(reverse);
return ret;
}
int hwloc_bitmap_list_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
int len;
char *buf;
HWLOC__BITMAP_CHECK(set);
len = hwloc_bitmap_list_snprintf(NULL, 0, set);
buf = malloc(len+1);
*strp = buf;
return hwloc_bitmap_list_snprintf(buf, len+1, set);
}
int hwloc_bitmap_list_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string)
{
const char * current = string;
char *next;
long begin = -1, val;
hwloc_bitmap_zero(set);
while (*current != '\0') {
/* ignore empty ranges */
while (*current == ',')
current++;
val = strtoul(current, &next, 0);
/* make sure we got at least one digit */
if (next == current)
goto failed;
if (begin != -1) {
/* finishing a range */
hwloc_bitmap_set_range(set, begin, val);
begin = -1;
} else if (*next == '-') {
/* starting a new range */
if (*(next+1) == '\0') {
/* infinite range */
hwloc_bitmap_set_range(set, val, -1);
break;
} else {
/* normal range */
begin = val;
}
} else if (*next == ',' || *next == '\0') {
/* single digit */
hwloc_bitmap_set(set, val);
}
if (*next == '\0')
break;
current = next+1;
}
return 0;
failed:
/* failure to parse */
hwloc_bitmap_zero(set);
return -1;
}
int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
ssize_t size = buflen;
char *tmp = buf;
int res, ret = 0;
int started = 0;
int i;
HWLOC__BITMAP_CHECK(set);
/* mark the end in case we do nothing later */
if (buflen > 0)
tmp[0] = '\0';
if (set->infinite) {
res = hwloc_snprintf(tmp, size, "0xf...f");
started = 1;
if (res < 0)
return -1;
ret += res;
if (res >= size)
res = size>0 ? size - 1 : 0;
tmp += res;
size -= res;
/* optimize a common case: full bitmap should appear as 0xf...f instead of 0xf...fffffffff */
if (set->ulongs_count == 1 && set->ulongs[0] == HWLOC_SUBBITMAP_FULL)
return ret;
}
i=set->ulongs_count-1;
while (i>=0) {
unsigned long val = set->ulongs[i--];
if (started) {
/* print the whole subset */
#if HWLOC_BITS_PER_LONG == 64
res = hwloc_snprintf(tmp, size, "%016lx", val);
#else
res = hwloc_snprintf(tmp, size, "%08lx", val);
#endif
} else if (val || i == -1) {
res = hwloc_snprintf(tmp, size, "0x%lx", val);
started = 1;
} else {
res = 0;
}
if (res < 0)
return -1;
ret += res;
if (res >= size)
res = size>0 ? size - 1 : 0;
tmp += res;
size -= res;
}
return ret;
}
int hwloc_bitmap_taskset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set)
{
int len;
char *buf;
HWLOC__BITMAP_CHECK(set);
len = hwloc_bitmap_taskset_snprintf(NULL, 0, set);
buf = malloc(len+1);
*strp = buf;
return hwloc_bitmap_taskset_snprintf(buf, len+1, set);
}
int hwloc_bitmap_taskset_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string)
{
const char * current = string;
int chars;
int count;
int infinite = 0;
current = string;
if (!strncmp("0xf...f", current, 7)) {
/* infinite bitmap */
infinite = 1;
current += 7;
if (*current == '\0') {
/* special case for infinite/full bitmap */
hwloc_bitmap_fill(set);
return 0;
}
} else {
/* finite bitmap */
if (!strncmp("0x", current, 2))
current += 2;
if (*current == '\0') {
/* special case for empty bitmap */
hwloc_bitmap_zero(set);
return 0;
}
}
/* we know there are other characters now */
chars = strlen(current);
count = (chars * 4 + HWLOC_BITS_PER_LONG - 1) / HWLOC_BITS_PER_LONG;
hwloc_bitmap_reset_by_ulongs(set, count);
set->infinite = 0;
while (*current != '\0') {
int tmpchars;
char ustr[17];
unsigned long val;
char *next;
tmpchars = chars % (HWLOC_BITS_PER_LONG/4);
if (!tmpchars)
tmpchars = (HWLOC_BITS_PER_LONG/4);
memcpy(ustr, current, tmpchars);
ustr[tmpchars] = '\0';
val = strtoul(ustr, &next, 16);
if (*next != '\0')
goto failed;
set->ulongs[count-1] = val;
current += tmpchars;
chars -= tmpchars;
count--;
}
set->infinite = infinite; /* set at the end, to avoid spurious realloc with filled new ulongs */
return 0;
failed:
/* failure to parse */
hwloc_bitmap_zero(set);
return -1;
}
static void hwloc_bitmap__zero(struct hwloc_bitmap_s *set)
{
unsigned i;
for(i=0; i<set->ulongs_count; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
set->infinite = 0;
}
void hwloc_bitmap_zero(struct hwloc_bitmap_s * set)
{
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_ulongs(set, 1);
hwloc_bitmap__zero(set);
}
static void hwloc_bitmap__fill(struct hwloc_bitmap_s * set)
{
unsigned i;
for(i=0; i<set->ulongs_count; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_FULL;
set->infinite = 1;
}
void hwloc_bitmap_fill(struct hwloc_bitmap_s * set)
{
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_ulongs(set, 1);
hwloc_bitmap__fill(set);
}
void hwloc_bitmap_from_ulong(struct hwloc_bitmap_s *set, unsigned long mask)
{
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_ulongs(set, 1);
set->ulongs[0] = mask; /* there's always at least one ulong allocated */
set->infinite = 0;
}
void hwloc_bitmap_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask)
{
unsigned j;
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_ulongs(set, i+1);
set->ulongs[i] = mask;
for(j=0; j<i; j++)
set->ulongs[j] = HWLOC_SUBBITMAP_ZERO;
set->infinite = 0;
}
unsigned long hwloc_bitmap_to_ulong(const struct hwloc_bitmap_s *set)
{
HWLOC__BITMAP_CHECK(set);
return set->ulongs[0]; /* there's always at least one ulong allocated */
}
unsigned long hwloc_bitmap_to_ith_ulong(const struct hwloc_bitmap_s *set, unsigned i)
{
HWLOC__BITMAP_CHECK(set);
return HWLOC_SUBBITMAP_READULONG(set, i);
}
void hwloc_bitmap_only(struct hwloc_bitmap_s * set, unsigned cpu)
{
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_cpu_index(set, cpu);
hwloc_bitmap__zero(set);
set->ulongs[index_] |= HWLOC_SUBBITMAP_CPU(cpu);
}
void hwloc_bitmap_allbut(struct hwloc_bitmap_s * set, unsigned cpu)
{
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_reset_by_cpu_index(set, cpu);
hwloc_bitmap__fill(set);
set->ulongs[index_] &= ~HWLOC_SUBBITMAP_CPU(cpu);
}
void hwloc_bitmap_set(struct hwloc_bitmap_s * set, unsigned cpu)
{
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
HWLOC__BITMAP_CHECK(set);
/* nothing to do if setting inside the infinite part of the bitmap */
if (set->infinite && cpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
hwloc_bitmap_realloc_by_cpu_index(set, cpu);
set->ulongs[index_] |= HWLOC_SUBBITMAP_CPU(cpu);
}
void hwloc_bitmap_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, int _endcpu)
{
unsigned i;
unsigned beginset,endset;
unsigned endcpu = (unsigned) _endcpu;
HWLOC__BITMAP_CHECK(set);
if (_endcpu == -1) {
set->infinite = 1;
/* keep endcpu == -1 since this unsigned is actually larger than anything else */
}
if (set->infinite) {
/* truncate the range according to the infinite part of the bitmap */
if (endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
if (begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
}
if (endcpu < begincpu)
return;
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_FULL;
if (beginset == endset) {
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
set->ulongs[beginset] |= HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] |= HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
}
}
void hwloc_bitmap_set_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask)
{
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_realloc_by_ulongs(set, i+1);
set->ulongs[i] = mask;
}
void hwloc_bitmap_clr(struct hwloc_bitmap_s * set, unsigned cpu)
{
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
HWLOC__BITMAP_CHECK(set);
/* nothing to do if clearing inside the infinitely-unset part of the bitmap */
if (!set->infinite && cpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
hwloc_bitmap_realloc_by_cpu_index(set, cpu);
set->ulongs[index_] &= ~HWLOC_SUBBITMAP_CPU(cpu);
}
void hwloc_bitmap_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, int _endcpu)
{
unsigned i;
unsigned beginset,endset;
unsigned endcpu = (unsigned) _endcpu;
HWLOC__BITMAP_CHECK(set);
if (_endcpu == -1) {
set->infinite = 0;
/* keep endcpu == -1 since this unsigned is actually larger than anything else */
}
if (!set->infinite) {
/* truncate the range according to the infinitely-unset part of the bitmap */
if (endcpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
endcpu = set->ulongs_count * HWLOC_BITS_PER_LONG - 1;
if (begincpu >= set->ulongs_count * HWLOC_BITS_PER_LONG)
return;
}
if (endcpu < begincpu)
return;
hwloc_bitmap_realloc_by_cpu_index(set, endcpu);
beginset = HWLOC_SUBBITMAP_INDEX(begincpu);
endset = HWLOC_SUBBITMAP_INDEX(endcpu);
for(i=beginset+1; i<endset; i++)
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
if (beginset == endset) {
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROMTO(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu), HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
} else {
set->ulongs[beginset] &= ~HWLOC_SUBBITMAP_ULBIT_FROM(HWLOC_SUBBITMAP_CPU_ULBIT(begincpu));
set->ulongs[endset] &= ~HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(endcpu));
}
}
int hwloc_bitmap_isset(const struct hwloc_bitmap_s * set, unsigned cpu)
{
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
HWLOC__BITMAP_CHECK(set);
return (HWLOC_SUBBITMAP_READULONG(set, index_) & HWLOC_SUBBITMAP_CPU(cpu)) != 0;
}
int hwloc_bitmap_iszero(const struct hwloc_bitmap_s *set)
{
unsigned i;
HWLOC__BITMAP_CHECK(set);
if (set->infinite)
return 0;
for(i=0; i<set->ulongs_count; i++)
if (set->ulongs[i] != HWLOC_SUBBITMAP_ZERO)
return 0;
return 1;
}
int hwloc_bitmap_isfull(const struct hwloc_bitmap_s *set)
{
unsigned i;
HWLOC__BITMAP_CHECK(set);
if (!set->infinite)
return 0;
for(i=0; i<set->ulongs_count; i++)
if (set->ulongs[i] != HWLOC_SUBBITMAP_FULL)
return 0;
return 1;
}
int hwloc_bitmap_isequal (const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
unsigned i;
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
for(i=0; i<set1->ulongs_count || i<set2->ulongs_count; i++)
if (HWLOC_SUBBITMAP_READULONG(set1, i) != HWLOC_SUBBITMAP_READULONG(set2, i))
return 0;
if (set1->infinite != set2->infinite)
return 0;
return 1;
}
int hwloc_bitmap_intersects (const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
unsigned i;
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
for(i=0; i<set1->ulongs_count || i<set2->ulongs_count; i++)
if ((HWLOC_SUBBITMAP_READULONG(set1, i) & HWLOC_SUBBITMAP_READULONG(set2, i)) != HWLOC_SUBBITMAP_ZERO)
return 1;
if (set1->infinite && set2->infinite)
return 0;
return 0;
}
int hwloc_bitmap_isincluded (const struct hwloc_bitmap_s *sub_set, const struct hwloc_bitmap_s *super_set)
{
unsigned i;
HWLOC__BITMAP_CHECK(sub_set);
HWLOC__BITMAP_CHECK(super_set);
for(i=0; i<sub_set->ulongs_count; i++)
if (HWLOC_SUBBITMAP_READULONG(super_set, i) != (HWLOC_SUBBITMAP_READULONG(super_set, i) | HWLOC_SUBBITMAP_READULONG(sub_set, i)))
return 0;
if (sub_set->infinite && !super_set->infinite)
return 0;
return 1;
}
void hwloc_bitmap_or (struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
const struct hwloc_bitmap_s *largest = set1->ulongs_count > set2->ulongs_count ? set1 : set2;
unsigned i;
HWLOC__BITMAP_CHECK(res);
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
hwloc_bitmap_realloc_by_ulongs(res, largest->ulongs_count); /* cannot reset since the output may also be an input */
for(i=0; i<res->ulongs_count; i++)
res->ulongs[i] = HWLOC_SUBBITMAP_READULONG(set1, i) | HWLOC_SUBBITMAP_READULONG(set2, i);
res->infinite = set1->infinite || set2->infinite;
}
void hwloc_bitmap_and (struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
const struct hwloc_bitmap_s *largest = set1->ulongs_count > set2->ulongs_count ? set1 : set2;
unsigned i;
HWLOC__BITMAP_CHECK(res);
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
hwloc_bitmap_realloc_by_ulongs(res, largest->ulongs_count); /* cannot reset since the output may also be an input */
for(i=0; i<res->ulongs_count; i++)
res->ulongs[i] = HWLOC_SUBBITMAP_READULONG(set1, i) & HWLOC_SUBBITMAP_READULONG(set2, i);
res->infinite = set1->infinite && set2->infinite;
}
void hwloc_bitmap_andnot (struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
const struct hwloc_bitmap_s *largest = set1->ulongs_count > set2->ulongs_count ? set1 : set2;
unsigned i;
HWLOC__BITMAP_CHECK(res);
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
hwloc_bitmap_realloc_by_ulongs(res, largest->ulongs_count); /* cannot reset since the output may also be an input */
for(i=0; i<res->ulongs_count; i++)
res->ulongs[i] = HWLOC_SUBBITMAP_READULONG(set1, i) & ~HWLOC_SUBBITMAP_READULONG(set2, i);
res->infinite = set1->infinite && !set2->infinite;
}
void hwloc_bitmap_xor (struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2)
{
const struct hwloc_bitmap_s *largest = set1->ulongs_count > set2->ulongs_count ? set1 : set2;
unsigned i;
HWLOC__BITMAP_CHECK(res);
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
hwloc_bitmap_realloc_by_ulongs(res, largest->ulongs_count); /* cannot reset since the output may also be an input */
for(i=0; i<res->ulongs_count; i++)
res->ulongs[i] = HWLOC_SUBBITMAP_READULONG(set1, i) ^ HWLOC_SUBBITMAP_READULONG(set2, i);
res->infinite = (!set1->infinite) != (!set2->infinite);
}
void hwloc_bitmap_not (struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set)
{
unsigned i;
HWLOC__BITMAP_CHECK(res);
HWLOC__BITMAP_CHECK(set);
hwloc_bitmap_realloc_by_ulongs(res, set->ulongs_count); /* cannot reset since the output may also be an input */
for(i=0; i<res->ulongs_count; i++)
res->ulongs[i] = ~HWLOC_SUBBITMAP_READULONG(set, i);
res->infinite = !set->infinite;
}
int hwloc_bitmap_first(const struct hwloc_bitmap_s * set)
{
unsigned i;
HWLOC__BITMAP_CHECK(set);
for(i=0; i<set->ulongs_count; i++) {
/* subsets are unsigned longs, use ffsl */
unsigned long w = set->ulongs[i];
if (w)
return hwloc_ffsl(w) - 1 + HWLOC_BITS_PER_LONG*i;
}
if (set->infinite)
return set->ulongs_count * HWLOC_BITS_PER_LONG;
return -1;
}
int hwloc_bitmap_last(const struct hwloc_bitmap_s * set)
{
int i;
HWLOC__BITMAP_CHECK(set);
if (set->infinite)
return -1;
for(i=set->ulongs_count-1; i>=0; i--) {
/* subsets are unsigned longs, use flsl */
unsigned long w = set->ulongs[i];
if (w)
return hwloc_flsl(w) - 1 + HWLOC_BITS_PER_LONG*i;
}
return -1;
}
int hwloc_bitmap_next(const struct hwloc_bitmap_s * set, int prev_cpu)
{
unsigned i = HWLOC_SUBBITMAP_INDEX(prev_cpu + 1);
HWLOC__BITMAP_CHECK(set);
if (i >= set->ulongs_count) {
if (set->infinite)
return prev_cpu + 1;
else
return -1;
}
for(; i<set->ulongs_count; i++) {
/* subsets are unsigned longs, use ffsl */
unsigned long w = set->ulongs[i];
/* if the prev cpu is in the same word as the possible next one,
we need to mask out previous cpus */
if (prev_cpu >= 0 && HWLOC_SUBBITMAP_INDEX((unsigned) prev_cpu) == i)
w &= ~HWLOC_SUBBITMAP_ULBIT_TO(HWLOC_SUBBITMAP_CPU_ULBIT(prev_cpu));
if (w)
return hwloc_ffsl(w) - 1 + HWLOC_BITS_PER_LONG*i;
}
if (set->infinite)
return set->ulongs_count * HWLOC_BITS_PER_LONG;
return -1;
}
void hwloc_bitmap_singlify(struct hwloc_bitmap_s * set)
{
unsigned i;
int found = 0;
HWLOC__BITMAP_CHECK(set);
for(i=0; i<set->ulongs_count; i++) {
if (found) {
set->ulongs[i] = HWLOC_SUBBITMAP_ZERO;
continue;
} else {
/* subsets are unsigned longs, use ffsl */
unsigned long w = set->ulongs[i];
if (w) {
int _ffs = hwloc_ffsl(w);
set->ulongs[i] = HWLOC_SUBBITMAP_CPU(_ffs-1);
found = 1;
}
}
}
if (set->infinite) {
if (found) {
set->infinite = 0;
} else {
/* set the first non allocated bit */
unsigned first = set->ulongs_count * HWLOC_BITS_PER_LONG;
set->infinite = 0; /* do not let realloc fill the newly allocated sets */
hwloc_bitmap_set(set, first);
}
}
}
int hwloc_bitmap_compare_first(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2)
{
unsigned i;
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
for(i=0; i<set1->ulongs_count || i<set2->ulongs_count; i++) {
unsigned long w1 = HWLOC_SUBBITMAP_READULONG(set1, i);
unsigned long w2 = HWLOC_SUBBITMAP_READULONG(set2, i);
if (w1 || w2) {
int _ffs1 = hwloc_ffsl(w1);
int _ffs2 = hwloc_ffsl(w2);
/* if both have a bit set, compare for real */
if (_ffs1 && _ffs2)
return _ffs1-_ffs2;
/* one is empty, and it is considered higher, so reverse-compare them */
return _ffs2-_ffs1;
}
}
if ((!set1->infinite) != (!set2->infinite))
return !!set1->infinite - !!set2->infinite;
return 0;
}
int hwloc_bitmap_compare(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2)
{
const struct hwloc_bitmap_s *largest = set1->ulongs_count > set2->ulongs_count ? set1 : set2;
int i;
HWLOC__BITMAP_CHECK(set1);
HWLOC__BITMAP_CHECK(set2);
if ((!set1->infinite) != (!set2->infinite))
return !!set1->infinite - !!set2->infinite;
for(i=largest->ulongs_count-1; i>=0; i--) {
unsigned long val1 = HWLOC_SUBBITMAP_READULONG(set1, (unsigned) i);
unsigned long val2 = HWLOC_SUBBITMAP_READULONG(set2, (unsigned) i);
if (val1 == val2)
continue;
return val1 < val2 ? -1 : 1;
}
return 0;
}
int hwloc_bitmap_weight(const struct hwloc_bitmap_s * set)
{
int weight = 0;
unsigned i;
HWLOC__BITMAP_CHECK(set);
if (set->infinite)
return -1;
for(i=0; i<set->ulongs_count; i++)
weight += hwloc_weight_long(set->ulongs[i]);
return weight;
}
/********************************************************************
* everything below should be dropped when hwloc/cpuset.h is dropped
*/
/* for HWLOC_DECLSPEC */
#include <hwloc/autogen/config.h>
/* forward declarations (public headers do not export this API anymore) */
HWLOC_DECLSPEC struct hwloc_bitmap_s * hwloc_cpuset_alloc(void);
HWLOC_DECLSPEC void hwloc_cpuset_free(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC struct hwloc_bitmap_s * hwloc_cpuset_dup(const struct hwloc_bitmap_s * old);
HWLOC_DECLSPEC void hwloc_cpuset_copy(struct hwloc_bitmap_s * dst, const struct hwloc_bitmap_s * src);
HWLOC_DECLSPEC int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_from_string(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set);
HWLOC_DECLSPEC int hwloc_cpuset_taskset_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string);
HWLOC_DECLSPEC void hwloc_cpuset_zero(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC void hwloc_cpuset_fill(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC void hwloc_cpuset_from_ulong(struct hwloc_bitmap_s *set, unsigned long mask);
HWLOC_DECLSPEC void hwloc_cpuset_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask);
HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ulong(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_bitmap_s *set, unsigned i);
HWLOC_DECLSPEC void hwloc_cpuset_cpu(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_all_but_cpu(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_set(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu);
HWLOC_DECLSPEC void hwloc_cpuset_set_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask);
HWLOC_DECLSPEC void hwloc_cpuset_clr(struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC void hwloc_cpuset_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu);
HWLOC_DECLSPEC int hwloc_cpuset_isset(const struct hwloc_bitmap_s * set, unsigned cpu);
HWLOC_DECLSPEC int hwloc_cpuset_iszero(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_isfull(const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_isequal(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC int hwloc_cpuset_intersects(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC int hwloc_cpuset_isincluded(const struct hwloc_bitmap_s *sub_set, const struct hwloc_bitmap_s *super_set);
HWLOC_DECLSPEC void hwloc_cpuset_or(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_and(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_andnot(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_xor(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2);
HWLOC_DECLSPEC void hwloc_cpuset_not(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set);
HWLOC_DECLSPEC int hwloc_cpuset_first(const struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_last(const struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_next(const struct hwloc_bitmap_s * set, unsigned prev_cpu);
HWLOC_DECLSPEC void hwloc_cpuset_singlify(struct hwloc_bitmap_s * set);
HWLOC_DECLSPEC int hwloc_cpuset_compare_first(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2);
HWLOC_DECLSPEC int hwloc_cpuset_compare(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2);
HWLOC_DECLSPEC int hwloc_cpuset_weight(const struct hwloc_bitmap_s * set);
/* actual symbols converting from cpuset ABI into bitmap ABI */
struct hwloc_bitmap_s * hwloc_cpuset_alloc(void) { return hwloc_bitmap_alloc(); }
void hwloc_cpuset_free(struct hwloc_bitmap_s * set) { hwloc_bitmap_free(set); }
struct hwloc_bitmap_s * hwloc_cpuset_dup(const struct hwloc_bitmap_s * old) { return hwloc_bitmap_dup(old); }
void hwloc_cpuset_copy(struct hwloc_bitmap_s * dst, const struct hwloc_bitmap_s * src) { hwloc_bitmap_copy(dst, src); }
int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_snprintf(buf, buflen, set); }
int hwloc_cpuset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_asprintf(strp, set); }
int hwloc_cpuset_from_string(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string) { return hwloc_bitmap_sscanf(set, string); }
int hwloc_cpuset_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_taskset_snprintf(buf, buflen, set); }
int hwloc_cpuset_taskset_asprintf(char ** strp, const struct hwloc_bitmap_s * __hwloc_restrict set) { return hwloc_bitmap_taskset_asprintf(strp, set); }
int hwloc_cpuset_taskset_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_restrict string) { return hwloc_bitmap_taskset_sscanf(set, string); }
void hwloc_cpuset_zero(struct hwloc_bitmap_s * set) { hwloc_bitmap_zero(set); }
void hwloc_cpuset_fill(struct hwloc_bitmap_s * set) { hwloc_bitmap_fill(set); }
void hwloc_cpuset_from_ulong(struct hwloc_bitmap_s *set, unsigned long mask) { hwloc_bitmap_from_ulong(set, mask); }
void hwloc_cpuset_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask) { hwloc_bitmap_from_ith_ulong(set, i, mask); }
unsigned long hwloc_cpuset_to_ulong(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_to_ulong(set); }
unsigned long hwloc_cpuset_to_ith_ulong(const struct hwloc_bitmap_s *set, unsigned i) { return hwloc_bitmap_to_ith_ulong(set, i); }
void hwloc_cpuset_cpu(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_only(set, cpu); }
void hwloc_cpuset_all_but_cpu(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_allbut(set, cpu); }
void hwloc_cpuset_set(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_set(set, cpu); }
void hwloc_cpuset_set_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu) { hwloc_bitmap_set_range(set, begincpu, endcpu); }
void hwloc_cpuset_set_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned long mask) { hwloc_bitmap_set_ith_ulong(set, i, mask); }
void hwloc_cpuset_clr(struct hwloc_bitmap_s * set, unsigned cpu) { hwloc_bitmap_clr(set, cpu); }
void hwloc_cpuset_clr_range(struct hwloc_bitmap_s * set, unsigned begincpu, unsigned endcpu) { hwloc_bitmap_clr_range(set, begincpu, endcpu); }
int hwloc_cpuset_isset(const struct hwloc_bitmap_s * set, unsigned cpu) { return hwloc_bitmap_isset(set, cpu); }
int hwloc_cpuset_iszero(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_iszero(set); }
int hwloc_cpuset_isfull(const struct hwloc_bitmap_s *set) { return hwloc_bitmap_isfull(set); }
int hwloc_cpuset_isequal(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { return hwloc_bitmap_isequal(set1, set2); }
int hwloc_cpuset_intersects(const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { return hwloc_bitmap_intersects(set1, set2); }
int hwloc_cpuset_isincluded(const struct hwloc_bitmap_s *sub_set, const struct hwloc_bitmap_s *super_set) { return hwloc_bitmap_isincluded(sub_set, super_set); }
void hwloc_cpuset_or(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_or(res, set1, set2); }
void hwloc_cpuset_and(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_and(res, set1, set2); }
void hwloc_cpuset_andnot(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_andnot(res, set1, set2); }
void hwloc_cpuset_xor(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set1, const struct hwloc_bitmap_s *set2) { hwloc_bitmap_xor(res, set1, set2); }
void hwloc_cpuset_not(struct hwloc_bitmap_s *res, const struct hwloc_bitmap_s *set) { hwloc_bitmap_not(res, set); }
int hwloc_cpuset_first(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_first(set); }
int hwloc_cpuset_last(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_last(set); }
int hwloc_cpuset_next(const struct hwloc_bitmap_s * set, unsigned prev_cpu) { return hwloc_bitmap_next(set, prev_cpu); }
void hwloc_cpuset_singlify(struct hwloc_bitmap_s * set) { hwloc_bitmap_singlify(set); }
int hwloc_cpuset_compare_first(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2) { return hwloc_bitmap_compare_first(set1, set2); }
int hwloc_cpuset_compare(const struct hwloc_bitmap_s * set1, const struct hwloc_bitmap_s * set2) { return hwloc_bitmap_compare(set1, set2); }
int hwloc_cpuset_weight(const struct hwloc_bitmap_s * set) { return hwloc_bitmap_weight(set); }
/*
* end of everything to be dropped when hwloc/cpuset.h is dropped
*****************************************************************/
/*
* Copyright © 2010-2011 INRIA. All rights reserved.
* Copyright © 2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#include <float.h>
/* called during topology init */
void hwloc_topology_distances_init(struct hwloc_topology *topology)
{
unsigned i;
for (i=0; i < HWLOC_OBJ_TYPE_MAX; i++) {
/* no distances yet */
topology->os_distances[i].nbobjs = 0;
topology->os_distances[i].objs = NULL;
topology->os_distances[i].indexes = NULL;
topology->os_distances[i].distances = NULL;
}
}
/* called when reloading a topology.
* keep initial parameters (from set_distances and environment),
* but drop what was generated during previous load().
*/
void hwloc_topology_distances_clear(struct hwloc_topology *topology)
{
unsigned i;
for (i=0; i < HWLOC_OBJ_TYPE_MAX; i++) {
/* remove final distance matrices, but keep physically-ordered ones */
free(topology->os_distances[i].objs);
topology->os_distances[i].objs = NULL;
}
}
/* called during topology destroy */
void hwloc_topology_distances_destroy(struct hwloc_topology *topology)
{
unsigned i;
for (i=0; i < HWLOC_OBJ_TYPE_MAX; i++) {
/* remove final distance matrics AND physically-ordered ones */
free(topology->os_distances[i].indexes);
topology->os_distances[i].indexes = NULL;
free(topology->os_distances[i].objs);
topology->os_distances[i].objs = NULL;
free(topology->os_distances[i].distances);
topology->os_distances[i].distances = NULL;
}
}
/* insert a distance matrix in the topology.
* the caller gives us those pointers, we take care of freeing them later and so on.
*/
void hwloc_topology__set_distance_matrix(hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs, float *distances)
{
free(topology->os_distances[type].indexes);
free(topology->os_distances[type].objs);
free(topology->os_distances[type].distances);
topology->os_distances[type].nbobjs = nbobjs;
topology->os_distances[type].indexes = indexes;
topology->os_distances[type].objs = objs;
topology->os_distances[type].distances = distances;
}
/* make sure a user-given distance matrix is sane */
static int hwloc_topology__check_distance_matrix(hwloc_topology_t __hwloc_restrict topology __hwloc_attribute_unused, hwloc_obj_type_t type __hwloc_attribute_unused,
unsigned nbobjs, unsigned *indexes, hwloc_obj_t *objs __hwloc_attribute_unused, float *distances __hwloc_attribute_unused)
{
unsigned i,j;
/* make sure we don't have the same index twice */
for(i=0; i<nbobjs; i++)
for(j=i+1; j<nbobjs; j++)
if (indexes[i] == indexes[j]) {
errno = EINVAL;
return -1;
}
return 0;
}
static hwloc_obj_t hwloc_find_obj_by_type_and_os_index(hwloc_obj_t root, hwloc_obj_type_t type, unsigned os_index)
{
hwloc_obj_t child;
if (root->type == type && root->os_index == os_index)
return root;
child = root->first_child;
while (child) {
hwloc_obj_t found = hwloc_find_obj_by_type_and_os_index(child, type, os_index);
if (found)
return found;
child = child->next_sibling;
}
return NULL;
}
static void hwloc_get_type_distances_from_string(struct hwloc_topology *topology,
hwloc_obj_type_t type, char *string)
{
/* the string format is: "index[0],...,index[N-1]:distance[0],...,distance[N*N-1]"
* or "index[0],...,index[N-1]:X*Y" or "index[0],...,index[N-1]:X*Y*Z"
*/
char *tmp = string, *next;
unsigned *indexes;
float *distances;
unsigned nbobjs = 0, i, j, x, y, z;
/* count indexes */
while (1) {
size_t size = strspn(tmp, "0123456789");
if (tmp[size] != ',') {
/* last element */
tmp += size;
nbobjs++;
break;
}
/* another index */
tmp += size+1;
nbobjs++;
}
if (*tmp != ':') {
fprintf(stderr, "Ignoring %s distances from environment variable, missing colon\n",
hwloc_obj_type_string(type));
return;
}
indexes = calloc(nbobjs, sizeof(unsigned));
distances = calloc(nbobjs*nbobjs, sizeof(float));
tmp = string;
/* parse indexes */
for(i=0; i<nbobjs; i++) {
indexes[i] = strtoul(tmp, &next, 0);
tmp = next+1;
}
/* parse distances */
z=1; /* default if sscanf finds only 2 values below */
if (sscanf(tmp, "%u*%u*%u", &x, &y, &z) >= 2) {
/* generate the matrix to create x groups of y elements */
if (x*y*z != nbobjs) {
fprintf(stderr, "Ignoring %s distances from environment variable, invalid grouping (%u*%u*%u=%u instead of %u)\n",
hwloc_obj_type_string(type), x, y, z, x*y*z, nbobjs);
free(indexes);
free(distances);
return;
}
for(i=0; i<nbobjs; i++)
for(j=0; j<nbobjs; j++)
if (i==j)
distances[i*nbobjs+j] = 1;
else if (i/z == j/z)
distances[i*nbobjs+j] = 2;
else if (i/z/y == j/z/y)
distances[i*nbobjs+j] = 4;
else
distances[i*nbobjs+j] = 8;
} else {
/* parse a comma separated list of distances */
for(i=0; i<nbobjs*nbobjs; i++) {
distances[i] = atof(tmp);
next = strchr(tmp, ',');
if (next) {
tmp = next+1;
} else if (i!=nbobjs*nbobjs-1) {
fprintf(stderr, "Ignoring %s distances from environment variable, not enough values (%u out of %u)\n",
hwloc_obj_type_string(type), i+1, nbobjs*nbobjs);
free(indexes);
free(distances);
return;
}
}
}
if (hwloc_topology__check_distance_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0) {
fprintf(stderr, "Ignoring invalid %s distances from environment variable\n", hwloc_obj_type_string(type));
free(indexes);
free(distances);
return;
}
hwloc_topology__set_distance_matrix(topology, type, nbobjs, indexes, NULL, distances);
}
/* take distances in the environment, store them as is in the topology.
* we'll convert them into object later once the tree is filled
*/
void hwloc_store_distances_from_env(struct hwloc_topology *topology)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
char *env, envname[64];
snprintf(envname, sizeof(envname), "HWLOC_%s_DISTANCES", hwloc_obj_type_string(type));
env = getenv(envname);
if (env)
hwloc_get_type_distances_from_string(topology, type, env);
}
}
/* take the given distance, store them as is in the topology.
* we'll convert them into object later once the tree is filled.
*/
int hwloc_topology_set_distance_matrix(hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type,
unsigned nbobjs, unsigned *indexes, float *distances)
{
unsigned *_indexes;
float *_distances;
if (hwloc_topology__check_distance_matrix(topology, type, nbobjs, indexes, NULL, distances) < 0)
return -1;
/* copy the input arrays and give them to the topology */
_indexes = malloc(nbobjs*sizeof(unsigned));
memcpy(_indexes, indexes, nbobjs*sizeof(unsigned));
_distances = malloc(nbobjs*nbobjs*sizeof(float));
memcpy(_distances, distances, nbobjs*nbobjs*sizeof(float));
hwloc_topology__set_distance_matrix(topology, type, nbobjs, _indexes, NULL, _distances);
return 0;
}
/* cleanup everything we created from distances so that we may rebuild them
* at the end of restrict()
*/
void hwloc_restrict_distances(struct hwloc_topology *topology, unsigned long flags)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
/* remove the objs array, we'll rebuild it from the indexes
* depending on remaining objects */
free(topology->os_distances[type].objs);
topology->os_distances[type].objs = NULL;
/* if not adapting distances, drop everything */
if (!(flags & HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES)) {
free(topology->os_distances[type].indexes);
topology->os_distances[type].indexes = NULL;
free(topology->os_distances[type].distances);
topology->os_distances[type].distances = NULL;
topology->os_distances[type].nbobjs = 0;
}
}
}
/* convert distance indexes that were previously stored in the topology
* into actual objects if not done already.
* it's already done when distances come from backends.
* it's not done when distances come from the user.
*/
void hwloc_convert_distances_indexes_into_objects(struct hwloc_topology *topology)
{
hwloc_obj_type_t type;
for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
unsigned nbobjs = topology->os_distances[type].nbobjs;
unsigned *indexes = topology->os_distances[type].indexes;
float *distances = topology->os_distances[type].distances;
unsigned i, j;
if (!topology->os_distances[type].objs) {
hwloc_obj_t *objs = calloc(nbobjs, sizeof(hwloc_obj_t));
/* traverse the topology and look for the relevant objects */
for(i=0; i<nbobjs; i++) {
hwloc_obj_t obj = hwloc_find_obj_by_type_and_os_index(topology->levels[0][0], type, indexes[i]);
if (!obj) {
/* shift the matrix */
#define OLDPOS(i,j) (distances+(i)*nbobjs+(j))
#define NEWPOS(i,j) (distances+(i)*(nbobjs-1)+(j))
if (i>0) {
/** no need to move beginning of 0th line */
for(j=0; j<i-1; j++)
/** move end of jth line + beginning of (j+1)th line */
memmove(NEWPOS(j,i), OLDPOS(j,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (i-1)th line */
memmove(NEWPOS(i-1,i), OLDPOS(i-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
if (i<nbobjs-1) {
/** move beginning of (i+1)th line */
memmove(NEWPOS(i,0), OLDPOS(i+1,0), i*sizeof(*distances));
/** move end of jth line + beginning of (j+1)th line */
for(j=i; j<nbobjs-1; j++)
memmove(NEWPOS(j,i), OLDPOS(j+1,i+1), (nbobjs-1)*sizeof(*distances));
/** move end of (nbobjs-2)th line */
memmove(NEWPOS(nbobjs-2,i), OLDPOS(nbobjs-1,i+1), (nbobjs-i-1)*sizeof(*distances));
}
/* shift the indexes array */
memmove(indexes+i, indexes+i+1, (nbobjs-i-1)*sizeof(*indexes));
/* update counters */
nbobjs--;
i--;
continue;
}
objs[i] = obj;
}
topology->os_distances[type].nbobjs = nbobjs;
if (!nbobjs) {
/* the whole matrix was invalid */
free(objs);
free(topology->os_distances[type].indexes);
topology->os_distances[type].indexes = NULL;
free(topology->os_distances[type].distances);
topology->os_distances[type].distances = NULL;
} else {
/* setup the objs array */
topology->os_distances[type].objs = objs;
}
}
}
}
static void
hwloc_setup_distances_from_os_matrix(struct hwloc_topology *topology,
unsigned nbobjs,
hwloc_obj_t *objs, float *osmatrix)
{
unsigned i, j, li, lj, minl;
float min = FLT_MAX, max = FLT_MIN;
hwloc_obj_t root;
float *matrix;
hwloc_cpuset_t set;
unsigned relative_depth;
int idx;
/* find the root */
set = hwloc_bitmap_alloc();
for(i=0; i<nbobjs; i++)
hwloc_bitmap_or(set, set, objs[i]->cpuset);
root = hwloc_get_obj_covering_cpuset(topology, set);
assert(root);
if (!hwloc_bitmap_isequal(set, root->cpuset)) {
/* partial distance matrix not including all the children of a single object */
/* TODO insert an intermediate object (group?) covering only these children ? */
hwloc_bitmap_free(set);
return;
}
hwloc_bitmap_free(set);
relative_depth = objs[0]->depth - root->depth; /* this assume that we have distances between objects of the same level */
/* get the logical index offset, it's the min of all logical indexes */
minl = UINT_MAX;
for(i=0; i<nbobjs; i++)
if (minl > objs[i]->logical_index)
minl = objs[i]->logical_index;
/* compute/check min/max values */
for(i=0; i<nbobjs; i++)
for(j=0; j<nbobjs; j++) {
float val = osmatrix[i*nbobjs+j];
if (val < min)
min = val;
if (val > max)
max = val;
}
if (!min) {
/* Linux up to 2.6.36 reports ACPI SLIT distances, which should be memory latencies.
* Except of SGI IP27 (SGI Origin 200/2000 with MIPS processors) where the distances
* are the number of hops between routers.
*/
hwloc_debug("%s", "minimal distance is 0, matrix does not seem to contain latencies, ignoring\n");
return;
}
/* store the normalized latency matrix in the root object */
idx = root->distances_count++;
root->distances = realloc(root->distances, root->distances_count * sizeof(struct hwloc_distances_s *));
root->distances[idx] = malloc(sizeof(struct hwloc_distances_s));
root->distances[idx]->relative_depth = relative_depth;
root->distances[idx]->nbobjs = nbobjs;
root->distances[idx]->latency = matrix = malloc(nbobjs*nbobjs*sizeof(float));
root->distances[idx]->latency_base = (float) min;
#define NORMALIZE_LATENCY(d) ((d)/(min))
root->distances[idx]->latency_max = NORMALIZE_LATENCY(max);
for(i=0; i<nbobjs; i++) {
li = objs[i]->logical_index - minl;
matrix[li*nbobjs+li] = NORMALIZE_LATENCY(osmatrix[i*nbobjs+i]);
for(j=i+1; j<nbobjs; j++) {
lj = objs[j]->logical_index - minl;
matrix[li*nbobjs+lj] = NORMALIZE_LATENCY(osmatrix[i*nbobjs+j]);
matrix[lj*nbobjs+li] = NORMALIZE_LATENCY(osmatrix[j*nbobjs+i]);
}
}
}
/* convert internal distances into logically-ordered distances
* that can be exposed in the API
*/
void
hwloc_finalize_logical_distances(struct hwloc_topology *topology)
{
unsigned nbobjs;
hwloc_obj_type_t type;
int depth;
for (type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
nbobjs = topology->os_distances[type].nbobjs;
if (!nbobjs)
continue;
depth = hwloc_get_type_depth(topology, type);
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
continue;
if (topology->os_distances[type].objs) {
assert(topology->os_distances[type].distances);
hwloc_setup_distances_from_os_matrix(topology, nbobjs,
topology->os_distances[type].objs,
topology->os_distances[type].distances);
}
}
}
/* destroy a object distances structure */
void
hwloc_free_logical_distances(struct hwloc_distances_s * dist)
{
free(dist->latency);
free(dist);
}
static void hwloc_report_user_distance_error(const char *msg, int line)
{
static int reported = 0;
if (!reported) {
fprintf(stderr, "****************************************************************************\n");
fprintf(stderr, "* Hwloc has encountered what looks like an error from user-given distances.\n");
fprintf(stderr, "*\n");
fprintf(stderr, "* %s\n", msg);
fprintf(stderr, "* Error occurred in topology.c line %d\n", line);
fprintf(stderr, "*\n");
fprintf(stderr, "* Please make sure that distances given through the interface or environment\n");
fprintf(stderr, "* variables do not contradict any other topology information.\n");
fprintf(stderr, "****************************************************************************\n");
reported = 1;
}
}
/*
* Place objects in groups if they are in a transitive graph of minimal distances.
* Return how many groups were created, or 0 if some incomplete distance graphs were found.
*/
static unsigned
hwloc_setup_group_from_min_distance(unsigned nbobjs,
float *_distances,
unsigned *groupids)
{
float min_distance = FLT_MAX;
unsigned groupid = 1;
unsigned i,j,k;
unsigned skipped = 0;
#define DISTANCE(i, j) _distances[(i) * nbobjs + (j)]
memset(groupids, 0, nbobjs*sizeof(*groupids));
/* find the minimal distance */
for(i=0; i<nbobjs; i++)
for(j=i+1; j<nbobjs; j++)
if (DISTANCE(i, j) < min_distance)
min_distance = DISTANCE(i, j);
hwloc_debug("found minimal distance %f between objects\n", min_distance);
if (min_distance == FLT_MAX)
return 0;
/* build groups of objects connected with this distance */
for(i=0; i<nbobjs; i++) {
unsigned size;
int firstfound;
/* if already grouped, skip */
if (groupids[i])
continue;
/* start a new group */
groupids[i] = groupid;
size = 1;
firstfound = i;
while (firstfound != -1) {
/* we added new objects to the group, the first one was firstfound.
* rescan all connections from these new objects (starting at first found) to any other objects,
* so as to find new objects minimally-connected by transivity.
*/
int newfirstfound = -1;
for(j=firstfound; j<nbobjs; j++)
if (groupids[j] == groupid)
for(k=0; k<nbobjs; k++)
if (!groupids[k] && DISTANCE(j, k) == min_distance) {
groupids[k] = groupid;
size++;
if (newfirstfound == -1)
newfirstfound = k;
if (i == j)
hwloc_debug("object %u is minimally connected to %u\n", k, i);
else
hwloc_debug("object %u is minimally connected to %u through %u\n", k, i, j);
}
firstfound = newfirstfound;
}
if (size == 1) {
/* cancel this useless group, ignore this object and try from the next one */
groupids[i] = 0;
skipped++;
continue;
}
/* valid this group */
groupid++;
hwloc_debug("found transitive graph with %u objects with minimal distance %f\n",
size, min_distance);
}
if (groupid == 2 && !skipped)
/* we created a single group containing all objects, ignore it */
return 0;
/* return the last id, since it's also the number of used group ids */
return groupid-1;
}
/*
* Look at object physical distances to group them,
* after having done some basic sanity checks.
*/
static void
hwloc__setup_groups_from_distances(struct hwloc_topology *topology,
unsigned nbobjs,
struct hwloc_obj **objs,
float *_distances,
int fromuser)
{
unsigned *groupids = NULL;
unsigned nbgroups;
unsigned i,j;
hwloc_debug("trying to group %s objects into Group objects according to physical distances\n",
hwloc_obj_type_string(objs[0]->type));
if (nbobjs <= 2) {
return;
}
groupids = malloc(sizeof(unsigned) * nbobjs);
if (NULL == groupids) {
return;
}
nbgroups = hwloc_setup_group_from_min_distance(nbobjs, _distances, groupids);
if (!nbgroups) {
goto outter_free;
}
/* For convenience, put these declarations inside a block. It's a
crying shame we can't use C99 syntax here, and have to do a bunch
of mallocs. :-( */
{
hwloc_obj_t *groupobjs = NULL;
unsigned *groupsizes = NULL;
float *groupdistances = NULL;
groupobjs = malloc(sizeof(hwloc_obj_t) * nbgroups);
groupsizes = malloc(sizeof(unsigned) * nbgroups);
groupdistances = malloc(sizeof(float) * nbgroups * nbgroups);
if (NULL == groupobjs || NULL == groupsizes || NULL == groupdistances) {
goto inner_free;
}
/* create new Group objects and record their size */
memset(&(groupsizes[0]), 0, sizeof(groupsizes[0]) * nbgroups);
for(i=0; i<nbgroups; i++) {
/* create the Group object */
hwloc_obj_t group_obj;
group_obj = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, -1);
group_obj->cpuset = hwloc_bitmap_alloc();
group_obj->attr->group.depth = topology->next_group_depth;
for (j=0; j<nbobjs; j++)
if (groupids[j] == i+1) {
hwloc_bitmap_or(group_obj->cpuset, group_obj->cpuset, objs[j]->cpuset);
groupsizes[i]++;
}
hwloc_debug_1arg_bitmap("adding Group object with %u objects and cpuset %s\n",
groupsizes[i], group_obj->cpuset);
hwloc__insert_object_by_cpuset(topology, group_obj,
fromuser ? hwloc_report_user_distance_error : hwloc_report_os_error);
groupobjs[i] = group_obj;
}
/* factorize distances */
memset(&(groupdistances[0]), 0, sizeof(groupdistances[0]) * nbgroups * nbgroups);
#undef DISTANCE
#define DISTANCE(i, j) _distances[(i) * nbobjs + (j)]
#define GROUP_DISTANCE(i, j) groupdistances[(i) * nbgroups + (j)]
for(i=0; i<nbobjs; i++)
if (groupids[i])
for(j=0; j<nbobjs; j++)
if (groupids[j])
GROUP_DISTANCE(groupids[i]-1, groupids[j]-1) += DISTANCE(i, j);
for(i=0; i<nbgroups; i++)
for(j=0; j<nbgroups; j++)
GROUP_DISTANCE(i, j) /= groupsizes[i]*groupsizes[j];
#ifdef HWLOC_DEBUG
hwloc_debug("%s", "generated new distance matrix between groups:\n");
hwloc_debug("%s", " index");
for(j=0; j<nbgroups; j++)
hwloc_debug(" % 5d", (int) j); /* print index because os_index is -1 fro Groups */
hwloc_debug("%s", "\n");
for(i=0; i<nbgroups; i++) {
hwloc_debug(" % 5d", (int) i);
for(j=0; j<nbgroups; j++)
hwloc_debug(" %2.3f", GROUP_DISTANCE(i, j));
hwloc_debug("%s", "\n");
}
#endif
topology->next_group_depth++;
hwloc__setup_groups_from_distances(topology, nbgroups, groupobjs, (float*) groupdistances, fromuser);
inner_free:
/* Safely free everything */
if (NULL != groupobjs) {
free(groupobjs);
}
if (NULL != groupsizes) {
free(groupsizes);
}
if (NULL != groupdistances) {
free(groupdistances);
}
}
outter_free:
if (NULL != groupids) {
free(groupids);
}
}
/*
* Look at object physical distances to group them.
*/
static void
hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
unsigned nbobjs,
struct hwloc_obj **objs,
float *_distances,
int fromuser)
{
unsigned i,j;
if (getenv("HWLOC_IGNORE_DISTANCES"))
return;
#ifdef HWLOC_DEBUG
hwloc_debug("%s", "trying to group objects using distance matrix:\n");
hwloc_debug("%s", " index");
for(j=0; j<nbobjs; j++)
hwloc_debug(" % 5d", (int) objs[j]->os_index);
hwloc_debug("%s", "\n");
for(i=0; i<nbobjs; i++) {
hwloc_debug(" % 5d", (int) objs[i]->os_index);
for(j=0; j<nbobjs; j++)
hwloc_debug(" %2.3f", DISTANCE(i, j));
hwloc_debug("%s", "\n");
}
#endif
/* check that the matrix is ok */
for(i=0; i<nbobjs; i++) {
for(j=i+1; j<nbobjs; j++) {
/* should be symmetric */
if (DISTANCE(i, j) != DISTANCE(j, i)) {
hwloc_debug("distance matrix asymmetric ([%u,%u]=%f != [%u,%u]=%f), aborting\n",
i, j, DISTANCE(i, j), j, i, DISTANCE(j, i));
return;
}
/* diagonal is smaller than everything else */
if (DISTANCE(i, j) <= DISTANCE(i, i)) {
hwloc_debug("distance to self not strictly minimal ([%u,%u]=%f <= [%u,%u]=%f), aborting\n",
i, j, DISTANCE(i, j), i, i, DISTANCE(i, i));
return;
}
}
}
hwloc__setup_groups_from_distances(topology, nbobjs, objs, _distances, fromuser);
}
void
hwloc_group_by_distances(struct hwloc_topology *topology)
{
unsigned nbobjs;
hwloc_obj_type_t type;
for (type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) {
nbobjs = topology->os_distances[type].nbobjs;
if (!nbobjs)
continue;
if (topology->os_distances[type].objs) {
/* if we have objs, we must have distances as well,
* thanks to hwloc_convert_distances_indexes_into_objects()
*/
assert(topology->os_distances[type].distances);
hwloc_setup_groups_from_distances(topology, nbobjs,
topology->os_distances[type].objs,
topology->os_distances[type].distances,
topology->os_distances[type].indexes != NULL);
}
}
}
/*
* Copyright © 2009 CNRS
* Copyright © 2009 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* See COPYING in top-level directory.
*/
/* Wrapper to avoid msys' tendency to turn / into \ and : into ; */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
char *prog, *arch, *def, *name, *lib;
char s[1024];
if (argc != 6) {
fprintf(stderr,"bad number of arguments");
exit(EXIT_FAILURE);
}
prog = argv[1];
arch = argv[2];
def = argv[3];
name = argv[4];
lib = argv[5];
snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib);
if (system(s)) {
fprintf(stderr, "%s failed\n", s);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
<!ELEMENT topology (object)+>
<!ELEMENT root (object)+>
<!ELEMENT object (page_type*,info*,distances*,object*)>
<!ATTLIST object type (System | Machine | Misc | Group | NUMANode | Socket| Cache | Core | PU) #REQUIRED>
<!ATTLIST object os_level CDATA "-1" >
<!ATTLIST object os_index CDATA "-1" >
<!ATTLIST object name CDATA "" >
<!ATTLIST object local_memory CDATA "0" >
<!ATTLIST object cache_size CDATA "0" >
<!ATTLIST object cache_linesize CDATA "0" >
<!ATTLIST object huge_page_size_kB CDATA "0" >
<!ATTLIST object huge_page_free CDATA "0" >
<!ATTLIST object depth CDATA "-1" >
<!ATTLIST object cpuset CDATA "0" >
<!ATTLIST object complete_cpuset CDATA "" >
<!ATTLIST object online_cpuset CDATA "" >
<!ATTLIST object allowed_cpuset CDATA "" >
<!ATTLIST object nodeset CDATA "" >
<!ATTLIST object complete_nodeset CDATA "" >
<!ATTLIST object allowed_nodeset CDATA "" >
<!ELEMENT page_type EMPTY>
<!ATTLIST page_type size CDATA #REQUIRED>
<!ATTLIST page_type count CDATA #REQUIRED>
<!ELEMENT info EMPTY>
<!ATTLIST info name CDATA #REQUIRED>
<!ATTLIST info value CDATA #REQUIRED>
<!ELEMENT distances (latency*)>
<!ATTLIST distances nbobjs CDATA #REQUIRED>
<!ATTLIST distances relative_depth CDATA #REQUIRED>
<!ATTLIST distances latency_base CDATA #REQUIRED>
<!ELEMENT latency EMPTY>
<!ATTLIST latency value CDATA #REQUIRED>
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#include <private/misc.h>
#include <stdarg.h>
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
int hwloc_snprintf(char *str, size_t size, const char *format, ...)
{
int ret;
va_list ap;
static char bin;
size_t fakesize;
char *fakestr;
/* Some systems crash on str == NULL */
if (!size) {
str = &bin;
size = 1;
}
va_start(ap, format);
ret = vsnprintf(str, size, format, ap);
va_end(ap);
if (ret >= 0 && (size_t) ret != size-1)
return ret;
/* vsnprintf returned size-1 or -1. That could be a system which reports the
* written data and not the actually required room. Try increasing buffer
* size to get the latter. */
fakesize = size;
fakestr = NULL;
do {
fakesize *= 2;
free(fakestr);
fakestr = malloc(fakesize);
if (NULL == fakestr)
return -1;
va_start(ap, format);
errno = 0;
ret = vsnprintf(fakestr, fakesize, format, ap);
va_end(ap);
} while ((size_t) ret == fakesize-1 || (ret < 0 && (!errno || errno == ERANGE)));
if (ret >= 0 && size) {
if (size > (size_t) ret+1)
size = ret+1;
memcpy(str, fakestr, size-1);
str[size-1] = 0;
}
free(fakestr);
return ret;
}
int hwloc_namecoloncmp(const char *haystack, const char *needle, size_t n)
{
size_t i = 0;
while (*haystack && *haystack != ':') {
int ha = *haystack++;
int low_h = tolower(ha);
int ne = *needle++;
int low_n = tolower(ne);
if (low_h != low_n)
return 1;
i++;
}
return i < n;
}
void hwloc_add_uname_info(struct hwloc_topology *topology __hwloc_attribute_unused)
{
#ifdef HAVE_UNAME
struct utsname utsname;
if (uname(&utsname) < 0)
return;
hwloc_add_object_info(topology->levels[0][0], "OSName", utsname.sysname);
hwloc_add_object_info(topology->levels[0][0], "OSRelease", utsname.release);
hwloc_add_object_info(topology->levels[0][0], "OSVersion", utsname.version);
hwloc_add_object_info(topology->levels[0][0], "HostName", utsname.nodename);
hwloc_add_object_info(topology->levels[0][0], "Architecture", utsname.machine);
#endif /* HAVE_UNAME */
}
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux 1
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* TODO: use SIGRECONFIG & dr_reconfig for state change */
#include <private/autogen/config.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#include <sys/rset.h>
#include <sys/processor.h>
#include <sys/thread.h>
#include <sys/mman.h>
#include <sys/systemcfg.h>
static int
hwloc_aix_set_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_const_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
rsethandle_t rad;
int res;
unsigned cpu;
if (flags & HWLOC_CPUBIND_NOMEMBIND) {
errno = ENOSYS;
return -1;
}
/* The resulting binding is always strict */
if (hwloc_bitmap_isequal(hwloc_set, hwloc_topology_get_complete_cpuset(topology))) {
if (ra_detachrset(what, who, 0))
return -1;
return 0;
}
rad = rs_alloc(RS_EMPTY);
hwloc_bitmap_foreach_begin(cpu, hwloc_set)
rs_op(RS_ADDRESOURCE, rad, NULL, R_PROCS, cpu);
hwloc_bitmap_foreach_end();
res = ra_attachrset(what, who, rad, 0);
rs_free(rad);
return res;
}
static int
hwloc_aix_get_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_bitmap_t hwloc_set, int flags __hwloc_attribute_unused)
{
rsethandle_t rset;
unsigned cpu, maxcpus;
int res = -1;
rset = rs_alloc(RS_EMPTY);
if (ra_getrset(what, who, 0, rset) == -1)
goto out;
hwloc_bitmap_zero(hwloc_set);
maxcpus = rs_getinfo(rset, R_MAXPROCS, 0);
for (cpu = 0; cpu < maxcpus; cpu++)
if (rs_op(RS_TESTRESOURCE, rset, NULL, R_PROCS, cpu) == 1)
hwloc_bitmap_set(hwloc_set, cpu);
hwloc_bitmap_and(hwloc_set, hwloc_set, hwloc_topology_get_complete_cpuset(topology));
res = 0;
out:
rs_free(rset);
return res;
}
static int
hwloc_aix_set_thisproc_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
}
static int
hwloc_aix_get_thisproc_cpubind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
}
static int
hwloc_aix_set_thisthread_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
}
static int
hwloc_aix_get_thisthread_cpubind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
}
static int
hwloc_aix_set_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
}
static int
hwloc_aix_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t hwloc_set, int flags)
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, flags);
}
#ifdef HWLOC_HAVE_PTHREAD_GETTHRDS_NP
static int
hwloc_aix_set_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread, hwloc_const_bitmap_t hwloc_set, int flags)
{
struct __pthrdsinfo info;
int size;
if ((errno = pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size)))
return -1;
{
rsid_t who = { .at_tid = info.__pi_tid };
return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
}
}
static int
hwloc_aix_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread, hwloc_bitmap_t hwloc_set, int flags)
{
struct __pthrdsinfo info;
int size;
if (pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size))
return -1;
{
rsid_t who;
who.at_tid = info.__pi_tid;
return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, flags);
}
}
#endif /* HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
#ifdef P_DEFAULT
static int
hwloc_aix_membind_policy_from_hwloc(uint_t *aix_policy, int policy)
{
switch (policy) {
case HWLOC_MEMBIND_DEFAULT:
case HWLOC_MEMBIND_BIND:
*aix_policy = P_DEFAULT;
break;
case HWLOC_MEMBIND_FIRSTTOUCH:
*aix_policy = P_FIRST_TOUCH;
break;
case HWLOC_MEMBIND_INTERLEAVE:
*aix_policy = P_BALANCED;
break;
default:
errno = ENOSYS;
return -1;
}
return 0;
}
static int
hwloc_aix_prepare_membind(hwloc_topology_t topology, rsethandle_t *rad, hwloc_const_nodeset_t nodeset, int flags __hwloc_attribute_unused)
{
rsethandle_t rset, noderad;
int MCMlevel;
int node;
MCMlevel = rs_getinfo(NULL, R_MCMSDL, 0);
if ((topology->flags & HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM))
rset = rs_alloc(RS_ALL);
else
rset = rs_alloc(RS_PARTITION);
*rad = rs_alloc(RS_EMPTY);
noderad = rs_alloc(RS_EMPTY);
hwloc_bitmap_foreach_begin(node, nodeset)
rs_getrad(rset, noderad, MCMlevel, node, 0);
rs_op(RS_UNION, noderad, *rad, 0, 0);
hwloc_bitmap_foreach_end();
rs_free(rset);
rs_free(noderad);
return 0;
}
static int
hwloc_aix_set_sth_membind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_const_bitmap_t nodeset, hwloc_membind_policy_t policy, int flags)
{
rsethandle_t rad;
int res;
if (flags & HWLOC_MEMBIND_NOCPUBIND) {
errno = ENOSYS;
return -1;
}
switch (policy) {
case HWLOC_MEMBIND_DEFAULT:
case HWLOC_MEMBIND_BIND:
break;
default:
errno = ENOSYS;
return -1;
}
if (hwloc_aix_prepare_membind(topology, &rad, nodeset, flags))
return -1;
res = ra_attachrset(what, who, rad, 0);
rs_free(rad);
return res;
}
static int
hwloc_aix_get_sth_membind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_bitmap_t nodeset, hwloc_membind_policy_t *policy, int flags __hwloc_attribute_unused)
{
hwloc_bitmap_t hwloc_set;
rsethandle_t rset;
unsigned cpu, maxcpus;
int res = -1;
int depth, n, i;
depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
if (depth < 0) {
errno = EXDEV;
return -1;
}
n = hwloc_get_nbobjs_by_depth(topology, depth);
rset = rs_alloc(RS_EMPTY);
if (ra_getrset(what, who, 0, rset) == -1)
goto out;
hwloc_set = hwloc_bitmap_alloc();
maxcpus = rs_getinfo(rset, R_MAXPROCS, 0);
for (cpu = 0; cpu < maxcpus; cpu++)
if (rs_op(RS_TESTRESOURCE, rset, NULL, R_PROCS, cpu) == 1)
hwloc_bitmap_set(hwloc_set, cpu);
hwloc_bitmap_and(hwloc_set, hwloc_set, hwloc_topology_get_complete_cpuset(topology));
hwloc_bitmap_zero(nodeset);
for (i = 0; i < n; i++) {
hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, depth, i);
if (hwloc_bitmap_isincluded(obj->cpuset, hwloc_set))
hwloc_bitmap_set(nodeset, obj->os_index);
}
*policy = HWLOC_MEMBIND_DEFAULT;
res = 0;
out:
rs_free(rset);
return res;
}
static int
hwloc_aix_set_thisproc_membind(hwloc_topology_t topology, hwloc_const_bitmap_t hwloc_set, hwloc_membind_policy_t policy, int flags)
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
}
static int
hwloc_aix_get_thisproc_membind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, hwloc_membind_policy_t *policy, int flags)
{
rsid_t who;
who.at_pid = getpid();
return hwloc_aix_get_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
}
static int
hwloc_aix_set_thisthread_membind(hwloc_topology_t topology, hwloc_const_bitmap_t hwloc_set, hwloc_membind_policy_t policy, int flags)
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
}
static int
hwloc_aix_get_thisthread_membind(hwloc_topology_t topology, hwloc_bitmap_t hwloc_set, hwloc_membind_policy_t *policy, int flags)
{
rsid_t who;
who.at_tid = thread_self();
return hwloc_aix_get_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
}
static int
hwloc_aix_set_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t hwloc_set, hwloc_membind_policy_t policy, int flags)
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_set_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
}
static int
hwloc_aix_get_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t hwloc_set, hwloc_membind_policy_t *policy, int flags)
{
rsid_t who;
who.at_pid = pid;
return hwloc_aix_get_sth_membind(topology, R_PROCESS, who, hwloc_set, policy, flags);
}
#if 0 /* def HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
static int
hwloc_aix_set_thread_membind(hwloc_topology_t topology, hwloc_thread_t pthread, hwloc_const_bitmap_t hwloc_set, hwloc_membind_policy_t policy, int flags)
{
struct __pthrdsinfo info;
int size;
if ((errno = pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size)))
return -1;
{
rsid_t who;
who.at_tid = info.__pi_tid;
return hwloc_aix_set_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
}
}
static int
hwloc_aix_get_thread_membind(hwloc_topology_t topology, hwloc_thread_t pthread, hwloc_bitmap_t hwloc_set, hwloc_membind_policy_t *policy, int flags)
{
struct __pthrdsinfo info;
int size;
if (pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size))
return -1;
{
rsid_t who;
who.at_tid = info.__pi_tid;
return hwloc_aix_get_sth_membind(topology, R_THREAD, who, hwloc_set, policy, flags);
}
}
#endif /* HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
#if 0
/* TODO: seems to be right, but doesn't seem to be working (EINVAL), even after
* aligning the range on 64K... */
static int
hwloc_aix_set_area_membind(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
{
subrange_t subrange;
rsid_t rsid = { .at_subrange = &subrange };
uint_t aix_policy;
int ret;
fprintf(stderr,"yop\n");
if ((flags & (HWLOC_MEMBIND_MIGRATE|HWLOC_MEMBIND_STRICT))
== (HWLOC_MEMBIND_MIGRATE|HWLOC_MEMBIND_STRICT)) {
errno = ENOSYS;
return -1;
}
subrange.su_offset = (uintptr_t) addr;
subrange.su_length = len;
subrange.su_rstype = R_RSET;
if (hwloc_aix_membind_policy_from_hwloc(&aix_policy, policy))
return -1;
if (hwloc_aix_prepare_membind(topology, &subrange.su_rsid.at_rset, nodeset, flags))
return -1;
subrange.su_policy = aix_policy;
ret = ra_attachrset(R_SUBRANGE, rsid, subrange.su_rsid.at_rset, 0);
rs_free(subrange.su_rsid.at_rset);
return ret;
}
#endif
static void *
hwloc_aix_alloc_membind(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
{
void *ret;
rsid_t rsid;
uint_t aix_policy;
if (hwloc_aix_membind_policy_from_hwloc(&aix_policy, policy))
return hwloc_alloc_or_fail(topology, len, flags);
if (hwloc_aix_prepare_membind(topology, &rsid.at_rset, nodeset, flags))
return hwloc_alloc_or_fail(topology, len, flags);
ret = ra_mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0, R_RSET, rsid, aix_policy);
rs_free(rsid.at_rset);
return ret;
}
#endif /* P_DEFAULT */
static void
look_rset(int sdl, hwloc_obj_type_t type, struct hwloc_topology *topology, int level)
{
rsethandle_t rset, rad;
int i,maxcpus,j;
int nbnodes;
struct hwloc_obj *obj;
if ((topology->flags & HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM))
rset = rs_alloc(RS_ALL);
else
rset = rs_alloc(RS_PARTITION);
rad = rs_alloc(RS_EMPTY);
nbnodes = rs_numrads(rset, sdl, 0);
if (nbnodes == -1) {
perror("rs_numrads");
return;
}
for (i = 0; i < nbnodes; i++) {
if (rs_getrad(rset, rad, sdl, i, 0)) {
fprintf(stderr,"rs_getrad(%d) failed: %s\n", i, strerror(errno));
continue;
}
if (!rs_getinfo(rad, R_NUMPROCS, 0))
continue;
/* It seems logical processors are numbered from 1 here, while the
* bindprocessor functions numbers them from 0... */
obj = hwloc_alloc_setup_object(type, i - (type == HWLOC_OBJ_PU));
obj->cpuset = hwloc_bitmap_alloc();
obj->os_level = sdl;
maxcpus = rs_getinfo(rad, R_MAXPROCS, 0);
for (j = 0; j < maxcpus; j++) {
if (rs_op(RS_TESTRESOURCE, rad, NULL, R_PROCS, j))
hwloc_bitmap_set(obj->cpuset, j);
}
switch(type) {
case HWLOC_OBJ_NODE:
obj->nodeset = hwloc_bitmap_alloc();
hwloc_bitmap_set(obj->nodeset, i);
obj->memory.local_memory = 0; /* TODO: odd, rs_getinfo(rad, R_MEMSIZE, 0) << 10 returns the total memory ... */
obj->memory.page_types_len = 2;
obj->memory.page_types = malloc(2*sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, 2*sizeof(*obj->memory.page_types));
obj->memory.page_types[0].size = getpagesize();
#ifdef HAVE__SC_LARGE_PAGESIZE
obj->memory.page_types[1].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
/* TODO: obj->memory.page_types[1].count = rs_getinfo(rset, R_LGPGFREE, 0) / hugepagesize */
break;
case HWLOC_OBJ_CACHE:
obj->attr->cache.size = _system_configuration.L2_cache_size;
obj->attr->cache.linesize = 0; /* TODO: ? */
obj->attr->cache.depth = 2;
break;
case HWLOC_OBJ_GROUP:
obj->attr->group.depth = level;
break;
case HWLOC_OBJ_CORE:
{
hwloc_obj_t obj2 = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, i);
obj2->cpuset = hwloc_bitmap_dup(obj->cpuset);
obj2->attr->cache.size = _system_configuration.dcache_size;
obj2->attr->cache.linesize = _system_configuration.dcache_line;
obj2->attr->cache.depth = 1;
hwloc_debug("Adding an L1 cache for core %d\n", i);
hwloc_insert_object_by_cpuset(topology, obj2);
break;
}
default:
break;
}
hwloc_debug_2args_bitmap("%s %d has cpuset %s\n",
hwloc_obj_type_string(type),
i, obj->cpuset);
hwloc_insert_object_by_cpuset(topology, obj);
}
rs_free(rset);
rs_free(rad);
}
void
hwloc_look_aix(struct hwloc_topology *topology)
{
int i;
/* TODO: R_LGPGDEF/R_LGPGFREE for large pages */
hwloc_debug("Note: SMPSDL is at %d\n", rs_getinfo(NULL, R_SMPSDL, 0));
for (i=0; i<=rs_getinfo(NULL, R_MAXSDL, 0); i++)
{
int known = 0;
#if 0
if (i == rs_getinfo(NULL, R_SMPSDL, 0))
/* Not enabled for now because I'm not sure what it corresponds to. On
* decrypthon it contains all the cpus. Is it a "machine" or a "system"
* level ?
*/
{
hwloc_debug("looking AIX \"SMP\" sdl %d\n", i);
look_rset(i, HWLOC_OBJ_MACHINE, topology, i);
known = 1;
}
#endif
if (i == rs_getinfo(NULL, R_MCMSDL, 0))
{
hwloc_debug("looking AIX node sdl %d\n", i);
look_rset(i, HWLOC_OBJ_NODE, topology, i);
known = 1;
}
# ifdef R_L2CSDL
if (i == rs_getinfo(NULL, R_L2CSDL, 0))
{
hwloc_debug("looking AIX L2 sdl %d\n", i);
look_rset(i, HWLOC_OBJ_CACHE, topology, i);
known = 1;
}
# endif
# ifdef R_PCORESDL
if (i == rs_getinfo(NULL, R_PCORESDL, 0))
{
hwloc_debug("looking AIX core sdl %d\n", i);
look_rset(i, HWLOC_OBJ_CORE, topology, i);
known = 1;
}
# endif
if (i == rs_getinfo(NULL, R_MAXSDL, 0))
{
hwloc_debug("looking AIX max sdl %d\n", i);
look_rset(i, HWLOC_OBJ_PU, topology, i);
known = 1;
topology->support.discovery->pu = 1;
}
/* Don't know how it should be rendered, make a misc object for it. */
if (!known)
{
hwloc_debug("looking AIX unknown sdl %d\n", i);
look_rset(i, HWLOC_OBJ_GROUP, topology, i);
}
}
hwloc_add_object_info(topology->levels[0][0], "Backend", "AIX");
}
void
hwloc_set_aix_hooks(struct hwloc_topology *topology)
{
topology->set_proc_cpubind = hwloc_aix_set_proc_cpubind;
topology->get_proc_cpubind = hwloc_aix_get_proc_cpubind;
#ifdef HWLOC_HAVE_PTHREAD_GETTHRDS_NP
topology->set_thread_cpubind = hwloc_aix_set_thread_cpubind;
topology->get_thread_cpubind = hwloc_aix_get_thread_cpubind;
#endif /* HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
topology->set_thisproc_cpubind = hwloc_aix_set_thisproc_cpubind;
topology->get_thisproc_cpubind = hwloc_aix_get_thisproc_cpubind;
topology->set_thisthread_cpubind = hwloc_aix_set_thisthread_cpubind;
topology->get_thisthread_cpubind = hwloc_aix_get_thisthread_cpubind;
/* TODO: get_last_cpu_location: use mycpu() */
#ifdef P_DEFAULT
topology->set_proc_membind = hwloc_aix_set_proc_membind;
topology->get_proc_membind = hwloc_aix_get_proc_membind;
#if 0 /* def HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
/* Does it really make sense to set the memory binding of another thread? */
topology->set_thread_membind = hwloc_aix_set_thread_membind;
topology->get_thread_membind = hwloc_aix_get_thread_membind;
#endif /* HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
topology->set_thisproc_membind = hwloc_aix_set_thisproc_membind;
topology->get_thisproc_membind = hwloc_aix_get_thisproc_membind;
topology->set_thisthread_membind = hwloc_aix_set_thisthread_membind;
topology->get_thisthread_membind = hwloc_aix_get_thisthread_membind;
/* topology->set_area_membind = hwloc_aix_set_area_membind; */
/* get_area_membind is not available */
topology->alloc_membind = hwloc_aix_alloc_membind;
topology->alloc = hwloc_alloc_mmap;
topology->free_membind = hwloc_free_mmap;
topology->support.membind->firsttouch_membind = 1;
topology->support.membind->bind_membind = 1;
topology->support.membind->interleave_membind = 1;
#endif /* P_DEFAULT */
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment