1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/**
* Copyright (C) NVIDIA Corporation. 2019. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/* Upper limit on system device id */
/* Indicate that the ucs_sys_device_t for the device has no real bus_id
* e.g. virtual devices like CMA/knem */
/* Maximal size of BDF string */
typedef struct ucs_sys_bus_id ucs_sys_bus_id_t;
/**
* @ingroup UCS_RESOURCE
* System Device Index
* Obtained from a translation of the device bus id into a short integer
* Refer ucs_topo_find_device_by_bus_id()
*/
typedef uint8_t ucs_sys_device_t;
/*
* Captures the estimated latency and bandwidth between two system devices
* referred by ucs_sys_device_t handle.
*/
typedef struct ucs_sys_dev_distance ucs_sys_dev_distance_t;
extern const ucs_sys_dev_distance_t ucs_topo_default_distance;
/**
* Find system device by pci bus id.
*
* @param [in] bus_id pointer to bus id of the device of interest.
* @param [out] sys_dev system device index associated with the bus_id.
*
* @return UCS_OK or error in case device cannot be found.
*/
ucs_status_t ;
/**
* Find pci bus id of the given system device.
*
* @param [in] sys_dev system device index.
* @param [out] bus_id pointer to bus id to be populated.
*
* @return UCS_OK or error in case system device or its bus id cannot be found.
*/
ucs_status_t ;
/**
* Find the distance between two system devices (in terms of latency,
* bandwidth, hops, etc).
*
* @param [in] device1 System device index of the first device.
* @param [in] device2 System device index of the second device.
* @param [out] distance Result populated with distance details between the two
* devices.
*
* @return UCS_OK or error in case distance cannot be determined.
*/
ucs_status_t ;
/**
* Convert the distance to a human-readable string.
*
* @param [in] distance Distance between two devices.
* @param [out] buffer String buffer to fill with distance string.
* @param [in] max Maximal size of the string buffer.
*
* @return Pointer to the distance string.
*/
const char *;
/**
* Return system device name in BDF format: "<domain>:<bus>:<device>.<function>".
*
* @param [in] sys_dev System device id, as returned from
* @ref ucs_topo_find_device_by_bus_id.
* @param [out] buffer String buffer, filled the device name.
* @param [in] max Maximal size of @a buffer.
*/
const char *
;
/**
* Find a system device by its BDF name: "[<domain>:]<bus>:<device>.<function>".
*
* @param [in] name BDF name to search for.
* @param [out] sys_dev Filled with system device id, if found.
*
* @return UCS_OK if the device was found, error otherwise.
*/
ucs_status_t
;
/**
* Set a name for a given system device. If the name was set previously, the new
* name will replace the old one.
*
* @param [in] sys_dev System device to set the name for.
* @param [in] name Name to set for this system device. Note: the name can
* be released after this call.
*
* @return UCS_OK if the name was set, error otherwise.
*/
ucs_status_t
;
/**
* Get the name of a given system device. If the name was never set, it defaults
* to the BDF representation of the system device bus id.
*
* @param [in] sys_dev System device to set the name for.
*
* @return The name of the system device, or NULL if the system device is
* invalid.
*/
const char *;
/**
* Get the number of registered system devices.
*
* @return Number of system devices.
*/
unsigned ;
/**
* Print a map indicating the topology information between system devices
* discovered.
*/
void ;
/**
* Initialize UCS topology subsystem.
*/
void ;
/**
* Cleanup UCS topology subsystem.
*/
void ;