Open MPI logo

Portable Hardware Locality (hwloc) Documentation: v0.9.3

  |   Home   |   Support   |   FAQ   |  

hwloc.h File Reference

The hwloc API. More...

#include <sys/types.h>
#include <stdio.h>
#include <limits.h>
#include <hwloc/cpuset.h>
#include <hwloc/helper.h>

Go to the source code of this file.

Data Structures

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_memory_attr_s
 Node-specific Object Attributes. More...
struct  hwloc_obj_attr_u::hwloc_machine_attr_s
 Machine-specific Object Attributes. More...
struct  hwloc_obj_attr_u::hwloc_misc_attr_s
 Misc-specific Object Attributes. More...

Defines

#define HWLOC_TYPE_UNORDERED   INT_MAX
 Value returned by hwloc_compare_types when types can not be compared.
#define HWLOC_TYPE_DEPTH_UNKNOWN   -1
 No object of given type exists in the topology.
#define HWLOC_TYPE_DEPTH_MULTIPLE   -2
 Objects of given type exist at different depth in the topology.

Typedefs

typedef struct hwloc_topology * hwloc_topology_t
 Topology context.
typedef struct hwloc_objhwloc_obj_t

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_PROC, HWLOC_OBJ_MISC
}
 

Type of topology object.

More...
enum  hwloc_topology_flags_e { HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM = (1<<0), HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM = (1<<1) }
 

Flags to be set onto a topology context before load.

More...
enum  hwloc_cpubind_policy_t { HWLOC_CPUBIND_PROCESS = (1<<0), HWLOC_CPUBIND_THREAD = (1<<1), HWLOC_CPUBIND_STRICT = (1<<2) }
 

Process/Thread binding policy.

More...

Functions

int hwloc_compare_types (hwloc_obj_type_t type1, hwloc_obj_type_t type2)
 Compare the depth of two object types.
int hwloc_topology_init (hwloc_topology_t *topologyp)
 Allocate a topology context.
int hwloc_topology_load (hwloc_topology_t topology)
 Build the actual topology.
void hwloc_topology_destroy (hwloc_topology_t topology)
 Terminate and free a topology context.
void hwloc_topology_check (hwloc_topology_t topology)
 Run internal checks on a topology structure.
int hwloc_topology_ignore_type (hwloc_topology_t topology, hwloc_obj_type_t type)
 Ignore an object type.
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.
int hwloc_topology_ignore_all_keep_structure (hwloc_topology_t topology)
 Ignore all objects that do not bring any structure.
int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags)
 Set OR'ed flags to non-yet-loaded topology.
int hwloc_topology_set_fsroot (hwloc_topology_t restrict topology, const char *restrict fsroot_path)
 Change the file-system root path when building the topology from sysfs/procfs.
int hwloc_topology_set_synthetic (hwloc_topology_t restrict topology, const char *restrict description)
 Enable synthetic topology.
int hwloc_topology_set_xml (hwloc_topology_t restrict topology, const char *restrict xmlpath)
 Enable XML-file based topology.
unsigned hwloc_topology_get_depth (hwloc_topology_t restrict topology)
 Get the depth of the hierachical tree of objects.
int hwloc_get_type_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
 Returns the depth of objects of type type.
hwloc_obj_type_t hwloc_get_depth_type (hwloc_topology_t topology, unsigned depth)
 Returns the type of objects at depth depth.
unsigned hwloc_get_nbobjs_by_depth (hwloc_topology_t topology, unsigned depth)
 Returns the width of level at depth depth.
static inline int hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
 Returns the width of level type type.
int hwloc_topology_is_thissystem (hwloc_topology_t restrict topology)
 Does the topology context come from this system?
hwloc_obj_t hwloc_get_obj_by_depth (hwloc_topology_t topology, unsigned depth, unsigned idx)
 Returns the topology object at index index from depth depth.
static inline hwloc_obj_t hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
 Returns the topology object at index index with type type.
const char * hwloc_obj_type_string (hwloc_obj_type_t type)
 Return a stringified topology object type.
hwloc_obj_type_t hwloc_obj_type_of_string (const char *string)
 Return an object type from the string.
int hwloc_obj_snprintf (char *restrict string, size_t size, hwloc_topology_t topology, hwloc_obj_t obj, const char *restrict indexprefix, int verbose)
 Stringify a given topology object into a human-readable form.
int hwloc_obj_cpuset_snprintf (char *restrict str, size_t size, size_t nobj, const hwloc_obj_t *restrict objs)
 Stringify the cpuset containing a set of objects.
int hwloc_set_cpubind (hwloc_topology_t topology, const hwloc_cpuset_t set, int policy)
 Bind current process or thread on cpus given in cpuset set.
int hwloc_set_proc_cpubind (hwloc_topology_t topology, hwloc_pid_t pid, const hwloc_cpuset_t set, int policy)
 Bind a process pid on cpus given in cpuset set.

Detailed Description

The hwloc API.

See hwloc/cpuset.h for CPU set specific macros. See hwloc/helper.h for high-level topology traversal helpers.