OpenMPI 0.1.1

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

- File List
- Globals

myriexpress.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2010 inria. All rights reserved.
3 * Copyright © 2011 Cisco Systems, Inc. All rights reserved.
4 * See COPYING in top-level directory.
5 */
6
7 /** \file
8 * \brief Macros to help interaction between hwloc and Myrinet Express.
9 *
10 * Applications that use both hwloc and Myrinet Express verbs may want to
11 * include this file so as to get topology information for Myrinet hardware.
12 *
13 */
14
15 #ifndef HWLOC_MYRIEXPRESS_H
16 #define HWLOC_MYRIEXPRESS_H
17
18 #include <hwloc.h>
19 #include <hwloc/autogen/config.h>
20 #include <hwloc/linux.h>
21
22 #include <myriexpress.h>
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30 /** \defgroup hwlocality_myriexpress Myrinet Express-Specific Functions
31 * @{
32 */
33
34 /** \brief Get the CPU set of logical processors that are physically
35 * close the MX board \p id.
36 *
37 * For the given Myrinet Express board index \p id, read the
38 * OS-provided NUMA node and return the corresponding CPU set.
39 */
40 static __hwloc_inline int
41 hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology,
42 unsigned id, hwloc_cpuset_t set)
43 {
44 uint32_t in, out;
45
46 in = id;
47 if (mx_get_info(NULL, MX_NUMA_NODE, &in, sizeof(in), &out, sizeof(out)) != MX_SUCCESS) {
48 errno = EINVAL;
49 return -1;
50 }
51
52 if (out != (uint32_t) -1) {
53 hwloc_obj_t obj = NULL;
54 while ((obj = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NODE, obj)) != NULL)
55 if (obj->os_index == out) {
56 hwloc_bitmap_copy(set, obj->cpuset);
57 goto out;
58 }
59 }
60 /* fallback to the full topology cpuset */
61 hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
62
63 out:
64 return 0;
65 }
66
67 /** \brief Get the CPU set of logical processors that are physically
68 * close to endpoint \p endpoint.
69 *
70 * For the given Myrinet Express endpoint \p endpoint, read the
71 * OS-provided NUMA node and return the corresponding CPU set.
72 */
73 static __hwloc_inline int
74 hwloc_mx_endpoint_get_device_cpuset(hwloc_topology_t topology,
75 mx_endpoint_t endpoint, hwloc_cpuset_t set)
76 {
77 uint64_t nid;
78 uint32_t nindex, eid;
79 mx_endpoint_addr_t eaddr;
80
81 if (mx_get_endpoint_addr(endpoint, &eaddr) != MX_SUCCESS) {
82 errno = EINVAL;
83 return -1;
84 }
85
86 if (mx_decompose_endpoint_addr(eaddr, &nid, &eid) != MX_SUCCESS) {
87 errno = EINVAL;
88 return -1;
89 }
90
91 if (mx_nic_id_to_board_number(nid, &nindex) != MX_SUCCESS) {
92 errno = EINVAL;
93 return -1;
94 }
95
96 return hwloc_mx_board_get_device_cpuset(topology, nindex, set);
97 }
98
99 /** @} */
100
101
102 #ifdef __cplusplus
103 } /* extern "C" */
104 #endif
105
106
107 #endif /* HWLOC_MYRIEXPRESS_H */
hwloc_bitmap_copy
HWLOC_DECLSPEC void hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src)
Copy the contents of bitmap src into the already allocated bitmap dst.
hwloc_obj::os_index
unsigned os_index
OS-provided physical index number.
Definition: hwloc.h:332
hwloc_mx_endpoint_get_device_cpuset
static __hwloc_inline int hwloc_mx_endpoint_get_device_cpuset(hwloc_topology_t topology, mx_endpoint_t endpoint, hwloc_cpuset_t set)
Get the CPU set of logical processors that are physically close to endpoint endpoint.
Definition: myriexpress.h:74
hwloc_topology_get_complete_cpuset
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure hwloc_topology_get_complete_cpuset(hwloc_topology_t topology)
Get complete CPU set.
Definition: helper.h:729
myriexpress.h
Macros to help interaction between hwloc and Myrinet Express.
hwloc_mx_board_get_device_cpuset
static __hwloc_inline int hwloc_mx_board_get_device_cpuset(hwloc_topology_t topology, unsigned id, hwloc_cpuset_t set)
Get the CPU set of logical processors that are physically close the MX board id.
Definition: myriexpress.h:41
hwloc_obj
Structure of a topology object.
Definition: hwloc.h:329
linux.h
Macros to help interaction between hwloc and Linux.
HWLOC_OBJ_NODE
NUMA node.
Definition: hwloc.h:184
hwloc_get_next_obj_by_type
static __hwloc_inline hwloc_obj_t hwloc_get_next_obj_by_type(hwloc_topology_t topology, hwloc_obj_type_t type, hwloc_obj_t prev)
Returns the next object of type type.
Definition: helper.h:158
hwloc_obj::cpuset
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition: hwloc.h:366
hwloc_topology
Definition: private.h:56
hwloc_bitmap_s
Definition: cpuset.c:38