OpenMPI  0.1.1
Conversion between cpuset and nodeset

There are two semantics for converting cpusets to nodesets depending on how non-NUMA machines are handled. More...

Functions

static __hwloc_inline void hwloc_cpuset_to_nodeset (hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, hwloc_nodeset_t nodeset)
 Convert a CPU set into a NUMA node set and handle non-NUMA cases. More...
 
static __hwloc_inline void hwloc_cpuset_to_nodeset_strict (struct hwloc_topology *topology, hwloc_const_cpuset_t cpuset, hwloc_nodeset_t nodeset)
 Convert a CPU set into a NUMA node set without handling non-NUMA cases. More...
 
static __hwloc_inline void hwloc_cpuset_from_nodeset (hwloc_topology_t topology, hwloc_cpuset_t cpuset, hwloc_const_nodeset_t nodeset)
 Convert a NUMA node set into a CPU set and handle non-NUMA cases. More...
 
static __hwloc_inline void hwloc_cpuset_from_nodeset_strict (struct hwloc_topology *topology, hwloc_cpuset_t cpuset, hwloc_const_nodeset_t nodeset)
 Convert a NUMA node set into a CPU set without handling non-NUMA cases. More...
 

Detailed Description

There are two semantics for converting cpusets to nodesets depending on how non-NUMA machines are handled.

When manipulating nodesets for memory binding, non-NUMA machines should be considered as having a single NUMA node. The standard conversion routines below should be used so that marking the first bit of the nodeset means that memory should be bound to a non-NUMA whole machine.

When manipulating nodesets as an actual list of NUMA nodes without any need to handle memory binding on non-NUMA machines, the strict conversion routines may be used instead.

Function Documentation

static __hwloc_inline void hwloc_cpuset_from_nodeset ( hwloc_topology_t  topology,
hwloc_cpuset_t  cpuset,
hwloc_const_nodeset_t  nodeset 
)
static

Convert a NUMA node set into a CPU set and handle non-NUMA cases.

If the topology contains no NUMA nodes, the machine is considered as a single memory node, and the following behavior is used: If nodeset is empty, cpuset will be emptied as well. Otherwise cpuset will be entirely filled. This is useful for manipulating memory binding sets.

References hwloc_obj::cpuset, hwloc_obj::depth, hwloc_bitmap_fill(), hwloc_bitmap_isset(), hwloc_bitmap_iszero(), hwloc_bitmap_or(), hwloc_bitmap_zero(), hwloc_get_next_obj_by_depth(), hwloc_get_type_depth(), HWLOC_OBJ_NODE, HWLOC_TYPE_DEPTH_UNKNOWN, and hwloc_obj::os_index.

Referenced by hwloc_get_area_membind(), hwloc_get_membind(), and hwloc_get_proc_membind().

static __hwloc_inline void hwloc_cpuset_from_nodeset_strict ( struct hwloc_topology topology,
hwloc_cpuset_t  cpuset,
hwloc_const_nodeset_t  nodeset 
)
static

Convert a NUMA node set into a CPU set without handling non-NUMA cases.

This is the strict variant of hwloc_cpuset_from_nodeset. It does not fix non-NUMA cases. If the topology contains some NUMA nodes, behave exactly the same. However, if the topology contains no NUMA nodes, return an empty cpuset.

References hwloc_obj::cpuset, hwloc_obj::depth, hwloc_bitmap_isset(), hwloc_bitmap_or(), hwloc_bitmap_zero(), hwloc_get_next_obj_by_depth(), hwloc_get_type_depth(), HWLOC_OBJ_NODE, HWLOC_TYPE_DEPTH_UNKNOWN, and hwloc_obj::os_index.

static __hwloc_inline void hwloc_cpuset_to_nodeset ( hwloc_topology_t  topology,
hwloc_const_cpuset_t  cpuset,
hwloc_nodeset_t  nodeset 
)
static

Convert a CPU set into a NUMA node set and handle non-NUMA cases.

If some NUMA nodes have no CPUs at all, this function never sets their indexes in the output node set, even if a full CPU set is given in input.

If the topology contains no NUMA nodes, the machine is considered as a single memory node, and the following behavior is used: If cpuset is empty, nodeset will be emptied as well. Otherwise nodeset will be entirely filled.

References hwloc_obj::depth, hwloc_bitmap_fill(), hwloc_bitmap_iszero(), hwloc_bitmap_set(), hwloc_bitmap_zero(), hwloc_get_next_obj_covering_cpuset_by_depth(), hwloc_get_type_depth(), HWLOC_OBJ_NODE, HWLOC_TYPE_DEPTH_UNKNOWN, and hwloc_obj::os_index.

static __hwloc_inline void hwloc_cpuset_to_nodeset_strict ( struct hwloc_topology topology,
hwloc_const_cpuset_t  cpuset,
hwloc_nodeset_t  nodeset 
)
static

Convert a CPU set into a NUMA node set without handling non-NUMA cases.

This is the strict variant of hwloc_cpuset_to_nodeset. It does not fix non-NUMA cases. If the topology contains some NUMA nodes, behave exactly the same. However, if the topology contains no NUMA nodes, return an empty nodeset.

References hwloc_obj::depth, hwloc_bitmap_set(), hwloc_bitmap_zero(), hwloc_get_next_obj_covering_cpuset_by_depth(), hwloc_get_type_depth(), HWLOC_OBJ_NODE, HWLOC_TYPE_DEPTH_UNKNOWN, and hwloc_obj::os_index.