OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Enumerations | Functions
hwloc.h File Reference

The hwloc API. More...

`#include <hwloc/autogen/config.h>`
`#include <sys/types.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <limits.h>`
`#include <hwloc/rename.h>`
`#include <hwloc/bitmap.h>`
`#include <hwloc/cpuset.h>`
`#include <hwloc/helper.h>`

Go to the source code of this file.

## Data Structures
struct | hwloc_obj_memory_s
| Object memory. More...
struct | hwloc_obj_memory_s::hwloc_obj_memory_page_type_s
| Array of local memory page types, `NULL` if no local memory and `page_types` is 0. More...
struct | hwloc_obj
| Structure of a topology object. More...
union | hwloc_obj_attr_u
| Object type-specific Attributes. More...
struct | hwloc_obj_attr_u::hwloc_cache_attr_s
| Cache-specific Object Attributes. More...
struct | hwloc_obj_attr_u::hwloc_group_attr_s
| Group-specific Object Attributes. More...
struct | hwloc_obj_attr_u::hwloc_pcidev_attr_s
| PCI Device specific Object Attributes. More...
struct | hwloc_obj_attr_u::hwloc_bridge_attr_s
| Bridge specific Object Attribues. More...
struct | hwloc_obj_attr_u::hwloc_osdev_attr_s
| OS Device specific Object Attributes. More...
struct | hwloc_distances_s
| Distances between objects. More...
struct | hwloc_obj_info_s
| Object info. More...
struct | hwloc_topology_discovery_support
| Flags describing actual discovery support for this topology. More...
struct | hwloc_topology_cpubind_support
| Flags describing actual PU binding support for this topology. More...
struct | hwloc_topology_membind_support
| Flags describing actual memory binding support for this topology. More...
struct | hwloc_topology_support
| Set of flags describing actual support for this topology. More...

## Macros
#define | HWLOC_API_VERSION 0x00010300
| Indicate at build time which hwloc API version is being used. More...

## Typedefs
typedef struct hwloc_topology * | hwloc_topology_t
| Topology context. More...
typedef hwloc_bitmap_t | hwloc_cpuset_t
| A CPU set is a bitmap whose bits are set according to CPU physical OS indexes. More...
typedef hwloc_const_bitmap_t | hwloc_const_cpuset_t
| A non-modifiable hwloc_cpuset_t. More...
typedef hwloc_bitmap_t | hwloc_nodeset_t
| A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes. More...
typedef hwloc_const_bitmap_t | hwloc_const_nodeset_t
| A non-modifiable hwloc_nodeset_t.
typedef enum hwloc_obj_bridge_type_e | hwloc_obj_bridge_type_t
| Type of one side (upstream or downstream) of an I/O bridge. More...
typedef enum hwloc_obj_osdev_type_e | hwloc_obj_osdev_type_t
| Type of a OS device. More...
typedef struct hwloc_obj * | hwloc_obj_t
| Convenience typedef; a pointer to a struct hwloc_obj.

## Enumerations
enum | hwloc_obj_type_t { HWLOC_OBJ_SYSTEM, HWLOC_OBJ_MACHINE, HWLOC_OBJ_NODE, HWLOC_OBJ_SOCKET, HWLOC_OBJ_CACHE, HWLOC_OBJ_CORE, HWLOC_OBJ_PU, HWLOC_OBJ_GROUP, HWLOC_OBJ_MISC, HWLOC_OBJ_BRIDGE, HWLOC_OBJ_PCI_DEVICE, HWLOC_OBJ_OS_DEVICE, HWLOC_OBJ_TYPE_MAX }
| Type of topology object. More...
enum | hwloc_obj_bridge_type_e { HWLOC_OBJ_BRIDGE_HOST, HWLOC_OBJ_BRIDGE_PCI }
| Type of one side (upstream or downstream) of an I/O bridge. More...
enum | hwloc_obj_osdev_type_e { HWLOC_OBJ_OSDEV_BLOCK, HWLOC_OBJ_OSDEV_GPU, HWLOC_OBJ_OSDEV_NETWORK, HWLOC_OBJ_OSDEV_OPENFABRICS, HWLOC_OBJ_OSDEV_DMA }
| Type of a OS device. More...
enum | hwloc_compare_types_e { HWLOC_TYPE_UNORDERED }
enum | hwloc_topology_flags_e { HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM, HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM, HWLOC_TOPOLOGY_FLAG_IO_DEVICES = (1<<2), HWLOC_TOPOLOGY_FLAG_IO_BRIDGES = (1<<3), HWLOC_TOPOLOGY_FLAG_WHOLE_IO = (1<<4) }
| Flags to be set onto a topology context before load. More...
enum | hwloc_restrict_flags_e { HWLOC_RESTRICT_FLAG_ADAPT_DISTANCES, HWLOC_RESTRICT_FLAG_ADAPT_MISC, HWLOC_RESTRICT_FLAG_ADAPT_IO }
| Flags to be given to hwloc_topology_restrict(). More...
enum | hwloc_get_type_depth_e { HWLOC_TYPE_DEPTH_UNKNOWN, HWLOC_TYPE_DEPTH_MULTIPLE, HWLOC_TYPE_DEPTH_BRIDGE, HWLOC_TYPE_DEPTH_PCI_DEVICE, HWLOC_TYPE_DEPTH_OS_DEVICE }
enum | hwloc_cpubind_flags_t { HWLOC_CPUBIND_PROCESS, HWLOC_CPUBIND_THREAD, HWLOC_CPUBIND_STRICT, HWLOC_CPUBIND_NOMEMBIND }
| Process/Thread binding flags. More...
enum | hwloc_membind_policy_t { HWLOC_MEMBIND_DEFAULT, HWLOC_MEMBIND_FIRSTTOUCH, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_INTERLEAVE, HWLOC_MEMBIND_REPLICATE, HWLOC_MEMBIND_NEXTTOUCH, HWLOC_MEMBIND_MIXED }
| Memory binding policy. More...
enum | hwloc_membind_flags_t { HWLOC_MEMBIND_PROCESS, HWLOC_MEMBIND_THREAD, HWLOC_MEMBIND_STRICT, HWLOC_MEMBIND_MIGRATE, HWLOC_MEMBIND_NOCPUBIND }
| Memory binding flags. More...

## Functions
HWLOC_DECLSPEC unsigned | hwloc_get_api_version (void)
| Indicate at runtime which hwloc API version was used at build time. More...
HWLOC_DECLSPEC int | hwloc_compare_types (hwloc_obj_type_t type1, hwloc_obj_type_t type2) __hwloc_attribute_const
| Compare the depth of two object types. More...
HWLOC_DECLSPEC int | hwloc_topology_init (hwloc_topology_t *topologyp)
| Allocate a topology context. More...
HWLOC_DECLSPEC int | hwloc_topology_load (hwloc_topology_t topology)
| Build the actual topology. More...
HWLOC_DECLSPEC void | hwloc_topology_destroy (hwloc_topology_t topology)
| Terminate and free a topology context. More...
HWLOC_DECLSPEC void | hwloc_topology_check (hwloc_topology_t topology)
| Run internal checks on a topology structure. More...
HWLOC_DECLSPEC int | hwloc_topology_ignore_type (hwloc_topology_t topology, hwloc_obj_type_t type)
| Ignore an object type. More...
HWLOC_DECLSPEC int | hwloc_topology_ignore_type_keep_structure (hwloc_topology_t topology, hwloc_obj_type_t type)
| Ignore an object type if it does not bring any structure. More...
HWLOC_DECLSPEC int | hwloc_topology_ignore_all_keep_structure (hwloc_topology_t topology)
| Ignore all objects that do not bring any structure. More...
HWLOC_DECLSPEC int | hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags)
| Set OR'ed flags to non-yet-loaded topology. More...
HWLOC_DECLSPEC int | hwloc_topology_set_fsroot (hwloc_topology_t __hwloc_restrict topology, const char *__hwloc_restrict fsroot_path)
| Change the file-system root path when building the topology from sysfs/procfs. More...
HWLOC_DECLSPEC int | hwloc_topology_set_pid (hwloc_topology_t __hwloc_restrict topology, hwloc_pid_t pid)
| Change which pid the topology is viewed from. More...
HWLOC_DECLSPEC int | hwloc_topology_set_synthetic (hwloc_topology_t __hwloc_restrict topology, const char *__hwloc_restrict description)
| Enable synthetic topology. More...
HWLOC_DECLSPEC int | hwloc_topology_set_xml (hwloc_topology_t __hwloc_restrict topology, const char *__hwloc_restrict xmlpath)
| Enable XML-file based topology. More...
HWLOC_DECLSPEC int | hwloc_topology_set_xmlbuffer (hwloc_topology_t __hwloc_restrict topology, const char *__hwloc_restrict buffer, int size)
| Enable XML based topology using a memory buffer (instead of a file, as with hwloc_topology_set_xml()). More...
HWLOC_DECLSPEC int | hwloc_topology_set_distance_matrix (hwloc_topology_t __hwloc_restrict topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned *os_index, float *distances)
| Provide a distance matrix. More...
HWLOC_DECLSPEC const struct hwloc_topology_support * | hwloc_topology_get_support (hwloc_topology_t __hwloc_restrict topology)
| Retrieve the topology support. More...
HWLOC_DECLSPEC int | hwloc_topology_export_xml (hwloc_topology_t topology, const char *xmlpath)
| Export the topology into an XML file. More...
HWLOC_DECLSPEC int | hwloc_topology_export_xmlbuffer (hwloc_topology_t topology, char **xmlbuffer, int *buflen)
| Export the topology into a newly-allocated XML memory buffer. More...
HWLOC_DECLSPEC void | hwloc_free_xmlbuffer (hwloc_topology_t topology, char *xmlbuffer)
| Free a buffer allocated by hwloc_topology_export_xmlbuffer()
HWLOC_DECLSPEC hwloc_obj_t | hwloc_topology_insert_misc_object_by_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, const char *name)
| Add a MISC object to the topology. More...
HWLOC_DECLSPEC hwloc_obj_t | hwloc_topology_insert_misc_object_by_parent (hwloc_topology_t topology, hwloc_obj_t parent, const char *name)
| Add a MISC object as a leaf of the topology. More...
HWLOC_DECLSPEC int | hwloc_topology_restrict (hwloc_topology_t __hwloc_restrict topology, hwloc_const_cpuset_t cpuset, unsigned long flags)
| Restrict the topology to the given CPU set. More...
HWLOC_DECLSPEC unsigned | hwloc_topology_get_depth (hwloc_topology_t __hwloc_restrict topology) __hwloc_attribute_pure
| Get the depth of the hierarchical tree of objects. More...
HWLOC_DECLSPEC int | hwloc_get_type_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
| Returns the depth of objects of type `type`. More...
HWLOC_DECLSPEC hwloc_obj_type_t | hwloc_get_depth_type (hwloc_topology_t topology, unsigned depth) __hwloc_attribute_pure
| Returns the type of objects at depth `depth`. More...
HWLOC_DECLSPEC unsigned | hwloc_get_nbobjs_by_depth (hwloc_topology_t topology, unsigned depth) __hwloc_attribute_pure
| Returns the width of level at depth `depth`.
static __hwloc_inline int __hwloc_attribute_pure | hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
| Returns the width of level type `type`. More...
HWLOC_DECLSPEC int | hwloc_topology_is_thissystem (hwloc_topology_t __hwloc_restrict topology) __hwloc_attribute_pure
| Does the topology context come from this system? More...
HWLOC_DECLSPEC hwloc_obj_t | hwloc_get_obj_by_depth (hwloc_topology_t topology, unsigned depth, unsigned idx) __hwloc_attribute_pure
| Returns the topology object at logical index `idx` from depth `depth`.
static __hwloc_inline hwloc_obj_t __hwloc_attribute_pure | hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
| Returns the topology object at logical index `idx` with type `type`. More...
HWLOC_DECLSPEC const char * | hwloc_obj_type_string (hwloc_obj_type_t type) __hwloc_attribute_const
| Return a stringified topology object type.
HWLOC_DECLSPEC hwloc_obj_type_t | hwloc_obj_type_of_string (const char *string) __hwloc_attribute_pure
| Return an object type from the string. More...
HWLOC_DECLSPEC int | hwloc_obj_type_snprintf (char *__hwloc_restrict string, size_t size, hwloc_obj_t obj, int verbose)
| Stringify the type of a given topology object into a human-readable form. More...
HWLOC_DECLSPEC int | hwloc_obj_attr_snprintf (char *__hwloc_restrict string, size_t size, hwloc_obj_t obj, const char *__hwloc_restrict separator, int verbose)
| Stringify the attributes of a given topology object into a human-readable form. More...
HWLOC_DECLSPEC int | hwloc_obj_snprintf (char *__hwloc_restrict string, size_t size, hwloc_topology_t topology, hwloc_obj_t obj, const char *__hwloc_restrict indexprefix, int verbose)
| Stringify a given topology object into a human-readable form. More...
HWLOC_DECLSPEC int | hwloc_obj_cpuset_snprintf (char *__hwloc_restrict str, size_t size, size_t nobj, const hwloc_obj_t *__hwloc_restrict objs)
| Stringify the cpuset containing a set of objects. More...
static __hwloc_inline const char *__hwloc_attribute_pure | hwloc_obj_get_info_by_name (hwloc_obj_t obj, const char *name)
| Search the given key name in object infos and return the corresponding value. More...
HWLOC_DECLSPEC void | hwloc_obj_add_info (hwloc_obj_t obj, const char *name, const char *value)
| Add the given info name and value pair to the given object. More...
HWLOC_DECLSPEC int | hwloc_set_cpubind (hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags)
| Bind current process or thread on cpus given in physical bitmap `set`. More...
HWLOC_DECLSPEC int | hwloc_get_cpubind (hwloc_topology_t topology, hwloc_cpuset_t set, int flags)
| Get current process or thread binding. More...
HWLOC_DECLSPEC int | hwloc_set_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t set, int flags)
| Bind a process `pid` on cpus given in physical bitmap `set`. More...
HWLOC_DECLSPEC int | hwloc_get_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags)
| Get the current physical binding of process `pid`. More...
HWLOC_DECLSPEC int | hwloc_get_last_cpu_location (hwloc_topology_t topology, hwloc_cpuset_t set, int flags)
| Get the last physical CPU where the current process or thread ran. More...
HWLOC_DECLSPEC int | hwloc_get_proc_last_cpu_location (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags)
| Get the last physical CPU where a process ran. More...
HWLOC_DECLSPEC int | hwloc_set_membind_nodeset (hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
| Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) specified by physical `nodeset`. More...
HWLOC_DECLSPEC int | hwloc_set_membind (hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, hwloc_membind_policy_t policy, int flags)
| Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) near the specified physical `cpuset`. More...
HWLOC_DECLSPEC int | hwloc_get_membind_nodeset (hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t *policy, int flags)
| Query the default memory binding policy and physical locality of the current process or thread. More...
HWLOC_DECLSPEC int | hwloc_get_membind (hwloc_topology_t topology, hwloc_cpuset_t cpuset, hwloc_membind_policy_t *policy, int flags)
| Query the default memory binding policy and physical locality of the current process or thread (the locality is returned in `cpuset` as CPUs near the locality's actual NUMA node(s)). More...
HWLOC_DECLSPEC 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)
| Set the default memory binding policy of the specified process to prefer the NUMA node(s) specified by physical `nodeset`. More...
HWLOC_DECLSPEC int | hwloc_set_proc_membind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t cpuset, hwloc_membind_policy_t policy, int flags)
| Set the default memory binding policy of the specified process to prefer the NUMA node(s) near the specified physical `cpuset`. More...
HWLOC_DECLSPEC 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)
| Query the default memory binding policy and physical locality of the specified process. More...
HWLOC_DECLSPEC int | hwloc_get_proc_membind (hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t cpuset, hwloc_membind_policy_t *policy, int flags)
| Query the default memory binding policy and physical locality of the specified process (the locality is returned in `cpuset` as CPUs near the locality's actual NUMA node(s)). More...
HWLOC_DECLSPEC 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)
| Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) in physical `nodeset`. More...
HWLOC_DECLSPEC int | hwloc_set_area_membind (hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_cpuset_t cpuset, hwloc_membind_policy_t policy, int flags)
| Bind the already-allocated memory identified by (addr, len) to the NUMA node(s) near physical `cpuset`. More...
HWLOC_DECLSPEC 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)
| Query the physical NUMA node(s) and binding policy of the memory identified by (`addr`, `len` ). More...
HWLOC_DECLSPEC int | hwloc_get_area_membind (hwloc_topology_t topology, const void *addr, size_t len, hwloc_cpuset_t cpuset, hwloc_membind_policy_t *policy, int flags)
| Query the CPUs near the physical NUMA node(s) and binding policy of the memory identified by (`addr`, `len` ). More...
HWLOC_DECLSPEC void * | hwloc_alloc (hwloc_topology_t topology, size_t len)
| Allocate some memory. More...
HWLOC_DECLSPEC void * | hwloc_alloc_membind_nodeset (hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc
| Allocate some memory on the given physical nodeset `nodeset`. More...
HWLOC_DECLSPEC void * | hwloc_alloc_membind (hwloc_topology_t topology, size_t len, hwloc_const_cpuset_t cpuset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc
| Allocate some memory on memory nodes near the given physical cpuset `cpuset`. More...
HWLOC_DECLSPEC int | hwloc_free (hwloc_topology_t topology, void *addr, size_t len)
| Free memory that was previously allocated by hwloc_alloc() or hwloc_alloc_membind().

## Detailed Description

The hwloc API.

See hwloc/bitmap.h for bitmap specific macros. See hwloc/helper.h for high-level topology traversal helpers.