MPC_Topology

API

group General Topology Interface

This module provides the general topology getters for MPC.

These functions are the initialization and release points for the topology interface.

Functions

void mpc_topology_init(void)

Initialize the topology module.

void mpc_topology_init_distance_simulation_factors(int*, int)
void mpc_topology_destroy(void)

Destroy the topology module.

These functions are used to retrieve topology for current process in MPC.

Enums

enum mpc_topology_split_hardware_type_t

Values:

enumerator MPC_LOWCOMM_HW_NODE = 0
enumerator MPC_LOWCOMM_HW_PACKAGE
enumerator MPC_LOWCOMM_HW_NUMANODE
enumerator MPC_LOWCOMM_HW_CACHEL3
enumerator MPC_LOWCOMM_HW_CACHEL2
enumerator MPC_LOWCOMM_HW_CACHEL1
enumerator MPC_LOWCOMM_HW_TYPE_COUNT

Functions

hwloc_topology_t mpc_topology_get(void)

Retrieve the Main Topology Object from MPC.

Returns:

hwloc_topology_t MPC’s main topology object

hwloc_topology_t mpc_topology_global_get(void)

Retrieve the Main not restricted Topology Object from MPC.

Returns:

hwloc_topology_t MPC’s main topology object

void mpc_topology_get_pu_neighborhood(int cpuid, unsigned int nb_cpus, int *neighborhood)

Return the closest core_id.

Parameters:
  • cpuid – Main core_id

  • nb_cpus – Number of neighbor

  • neighborhood – Neighbor list

int mpc_topology_get_numa_node_from_cpu(const int cpuid)

return the Numa node associated with a given CPUID

Parameters:
  • cpuid – The target CPUID (logical)

Returns:

identifier of the numa node matching cpuid (0 if none)

int mpc_topology_get_numa_node_count(void)

Return the number of NUMA nodes.

int mpc_topology_has_numa_nodes(void)

Return 1 if the current node is a NUMA node, 0 otherwise.

int mpc_topology_get_socket_count(void)

Return the number of sockets.

int mpc_topology_bind_to_cpu(int i)

Bind the current thread @ param i The cpu_id to bind.

void mpc_topology_bind_to_process_cpuset()

Bind the current thread to the whole process.

void mpc_topology_print(FILE *fd)

Print the topology tree into a file.

Parameters:
  • fd – Destination file descriptor

int mpc_topology_get_pu_count(void)

get the number of processing units (PU) as seen by MPC

Number of active PU for the topology.

Returns:

Number of PUs in current MPC topology

Returns:

int number of active PUs

int mpc_topology_get_current_cpu(void)

Return the current core_id.

int mpc_topology_is_loaded(void)
int mpc_topology_get_global_current_cpu(void)

Return the current global core_id.

static inline int mpc_topology_get_pu(void)

Return the PU executing current thread.

Note

This version relies on HWLOC as MPC has no scheduler

Returns:

int current PU executing this thread

static inline int mpc_topology_get_global_pu(void)
int mpc_topology_convert_os_pu_to_logical(int pu_os_id)

Convert a PU id from OS to logical numbering.

Parameters:
  • pu_os_id – OS id of the source PU

Returns:

int Logical ID of the PU (used in Hwloc)

int mpc_topology_convert_logical_pu_to_os(int cpuid)

Convert a PU id from logical to OS numbering.

Parameters:
  • cpuid – logical id of the source PU

Returns:

int OS ID of the PU

hwloc_const_cpuset_t mpc_topology_get_process_cpuset()

Return the overall cpuset of the MPC process.

Returns:

hwloc_const_cpuset_t process cpuset

hwloc_cpuset_t mpc_topology_get_parent_numa_cpuset(int cpuid)

Return the numa node (or whole machine if none) of cpuid.

Parameters:
  • cpuid – PU id to query for

Returns:

hwloc_cpuset_t corresponding NUMA cpuset

hwloc_cpuset_t mpc_topology_get_parent_socket_cpuset(int cpuid)

Return the socket of cpuid.

Parameters:
  • cpuid – PU id to query for

Returns:

hwloc_cpuset_t corresponding socket cpuset

hwloc_cpuset_t mpc_topology_get_pu_cpuset(int cpuid)

Return the PU cupset of cpuid.

Parameters:
  • cpuid – PU id to query for

Returns:

hwloc_cpuset_t corresponding PU cpuset

hwloc_cpuset_t mpc_topology_get_parent_core_cpuset(int cpuid)

Return the core cupset of cpuid.

Parameters:
  • cpuid – PU id to query for

Returns:

hwloc_cpuset_t corresponding core cpuset

hwloc_cpuset_t mpc_topology_get_first_pu_for_level(hwloc_obj_type_t type)

Return the first PU in the given node level.

Parameters:
  • type – Type of level to search for

Returns:

hwloc_cpuset_t cpuset with a single core according to level

int mpc_topology_get_ht_per_core(void)

Number of processing units per core (Hyperhtreads)

Returns:

int number of PU per CORE

void mpc_topology_clear_cpu_pinning_cache()
int mpc_topology_set_pu_count(int n)

Set the number of core usable for the current process.

Parameters:
  • n – Number of cores used for ethread

int mpc_topology_get_mcdram_node()

Return the node ID for the MCDRAM.

Returns:

int MCDRAM node ID (-1 if none)

int mpc_topology_has_nvdimm()

Check if the machine has NVDIMMs.

Returns:

int non zero if NVDIMMs are found

int mpc_topology_guided_compute_color(char*)

Return logical id of a hardware instance for guided topological split.

int mpc_topology_unguided_compute_color(int*, int*, int)

Return logical id of a hardware instance for unguided topological split.

Variables

static const char *const mpc_topology_split_hardware_type_name[MPC_LOWCOMM_HW_TYPE_COUNT] = {"Node", "Package", "NUMANode", "L3Cache", "L2Cache", "L1Cache"}
static const hwloc_obj_type_t mpc_topology_split_hardware_hwloc_type[MPC_LOWCOMM_HW_TYPE_COUNT] = {HWLOC_OBJ_MACHINE, HWLOC_OBJ_PACKAGE, HWLOC_OBJ_NUMANODE, HWLOC_OBJ_CACHE, HWLOC_OBJ_CACHE, HWLOC_OBJ_CACHE}