@@ -189,7 +189,7 @@ int opal_hwloc_base_get_topology(void)
189
189
*/
190
190
if (0 != hwloc_topology_set_flags (opal_hwloc_topology ,
191
191
(HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
192
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
192
+ #if HWLOC_API_VERSION < 0x20000
193
193
| HWLOC_TOPOLOGY_FLAG_IO_DEVICES
194
194
#endif
195
195
))) {
@@ -206,7 +206,7 @@ int opal_hwloc_base_get_topology(void)
206
206
free (val );
207
207
} else if (NULL == opal_hwloc_base_topo_file ) {
208
208
if (0 != hwloc_topology_init (& opal_hwloc_topology ) ||
209
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
209
+ #if HWLOC_API_VERSION < 0x20000
210
210
0 != hwloc_topology_set_flags (opal_hwloc_topology ,
211
211
HWLOC_TOPOLOGY_FLAG_IO_DEVICES ) ||
212
212
#endif
@@ -255,7 +255,7 @@ int opal_hwloc_base_set_topology(char *topofile)
255
255
*/
256
256
if (0 != hwloc_topology_set_flags (opal_hwloc_topology ,
257
257
(HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
258
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
258
+ #if HWLOC_API_VERSION < 0x20000
259
259
| HWLOC_TOPOLOGY_FLAG_IO_DEVICES
260
260
#endif
261
261
))) {
@@ -508,7 +508,7 @@ unsigned int opal_hwloc_base_get_obj_idx(hwloc_topology_t topo,
508
508
return data -> idx ;
509
509
}
510
510
511
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
511
+ #if HWLOC_API_VERSION < 0x20000
512
512
/* determine the number of objects of this type */
513
513
if (HWLOC_OBJ_CACHE == obj -> type ) {
514
514
cache_level = obj -> attr -> cache .depth ;
@@ -564,7 +564,7 @@ static hwloc_obj_t df_search(hwloc_topology_t topo,
564
564
opal_hwloc_obj_data_t * data ;
565
565
566
566
if (target == start -> type ) {
567
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
567
+ #if HWLOC_API_VERSION < 0x20000
568
568
if (HWLOC_OBJ_CACHE == start -> type && cache_level != start -> attr -> cache .depth ) {
569
569
goto notfound ;
570
570
}
@@ -675,7 +675,7 @@ unsigned int opal_hwloc_base_get_nbobjs_by_type(hwloc_topology_t topo,
675
675
* as these are treated as special cases
676
676
*/
677
677
if (OPAL_HWLOC_LOGICAL == rtype
678
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
678
+ #if HWLOC_API_VERSION < 0x20000
679
679
&& HWLOC_OBJ_CACHE != target
680
680
#endif
681
681
) {
@@ -747,7 +747,7 @@ static hwloc_obj_t df_search_min_bound(hwloc_topology_t topo,
747
747
if (0 == (k = opal_hwloc_base_get_npus (topo , start ))) {
748
748
goto notfound ;
749
749
}
750
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
750
+ #if HWLOC_API_VERSION < 0x20000
751
751
if (HWLOC_OBJ_CACHE == start -> type && cache_level != start -> attr -> cache .depth ) {
752
752
goto notfound ;
753
753
}
@@ -814,7 +814,7 @@ hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t top
814
814
/* again, we have to treat caches differently as
815
815
* the levels distinguish them
816
816
*/
817
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
817
+ #if HWLOC_API_VERSION < 0x20000
818
818
if (HWLOC_OBJ_CACHE == target &&
819
819
cache_level < obj -> attr -> cache .depth ) {
820
820
goto moveon ;
@@ -832,7 +832,7 @@ hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t top
832
832
loc = df_search_min_bound (topo , obj , target , cache_level , & min_bound );
833
833
834
834
if (NULL != loc ) {
835
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
835
+ #if HWLOC_API_VERSION < 0x20000
836
836
if (HWLOC_OBJ_CACHE == target ) {
837
837
OPAL_OUTPUT_VERBOSE ((5 , opal_hwloc_base_framework .framework_output ,
838
838
"hwloc:base:min_bound_under_obj found min bound of %u on %s:%u:%u" ,
@@ -870,7 +870,7 @@ hwloc_obj_t opal_hwloc_base_get_obj_by_type(hwloc_topology_t topo,
870
870
* as these are treated as special cases
871
871
*/
872
872
if (OPAL_HWLOC_LOGICAL == rtype
873
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
873
+ #if HWLOC_API_VERSION < 0x20000
874
874
&& HWLOC_OBJ_CACHE != target
875
875
#endif
876
876
) {
@@ -1258,7 +1258,7 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
1258
1258
/* if it isn't one of interest, then ignore it */
1259
1259
if (HWLOC_OBJ_NODE != type &&
1260
1260
HWLOC_OBJ_SOCKET != type &&
1261
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
1261
+ #if HWLOC_API_VERSION < 0x20000
1262
1262
HWLOC_OBJ_CACHE != type &&
1263
1263
#else
1264
1264
HWLOC_OBJ_L3CACHE != type &&
@@ -1291,7 +1291,7 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
1291
1291
case HWLOC_OBJ_SOCKET :
1292
1292
locality |= OPAL_PROC_ON_SOCKET ;
1293
1293
break ;
1294
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
1294
+ #if HWLOC_API_VERSION < 0x20000
1295
1295
case HWLOC_OBJ_CACHE :
1296
1296
if (3 == obj -> attr -> cache .depth ) {
1297
1297
locality |= OPAL_PROC_ON_L3CACHE ;
@@ -1847,13 +1847,14 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
1847
1847
{
1848
1848
hwloc_obj_t device_obj = NULL ;
1849
1849
hwloc_obj_t obj = NULL , root = NULL ;
1850
- const struct hwloc_distances_s * distances ;
1850
+ struct hwloc_distances_s * distances ;
1851
1851
opal_rmaps_numa_node_t * numa_node ;
1852
1852
int close_node_index ;
1853
1853
float latency ;
1854
1854
unsigned int j ;
1855
1855
int depth ;
1856
1856
unsigned i ;
1857
+ unsigned distances_nr = 0 ;
1857
1858
1858
1859
for (device_obj = hwloc_get_obj_by_type (topo , HWLOC_OBJ_OS_DEVICE , 0 ); device_obj ; device_obj = hwloc_get_next_osdev (topo , device_obj )) {
1859
1860
if (device_obj -> attr -> osdev .type == HWLOC_OBJ_OSDEV_OPENFABRICS
@@ -1874,6 +1875,7 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
1874
1875
}
1875
1876
1876
1877
/* find distance matrix for all numa nodes */
1878
+ #if HWLOC_API_VERSION < 0x20000
1877
1879
distances = hwloc_get_whole_distance_matrix_by_type (topo , HWLOC_OBJ_NODE );
1878
1880
if (NULL == distances ) {
1879
1881
/* we can try to find distances under group object. This info can be there. */
@@ -1910,6 +1912,22 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
1910
1912
numa_node -> dist_from_closed = latency ;
1911
1913
opal_list_append (sorted_list , & numa_node -> super );
1912
1914
}
1915
+ #else
1916
+ if (0 != hwloc_distances_get_by_type (topo , HWLOC_OBJ_NODE , & distances_nr , & distances , 0 , 0 ) || 0 == distances_nr ) {
1917
+ opal_output_verbose (5 , opal_hwloc_base_framework .framework_output ,
1918
+ "hwloc:base:get_sorted_numa_list: There is no information about distances on the node." );
1919
+ return ;
1920
+ }
1921
+ /* fill list of numa nodes */
1922
+ for (j = 0 ; j < distances -> nbobjs ; j ++ ) {
1923
+ latency = distances -> values [close_node_index + distances -> nbobjs * j ];
1924
+ numa_node = OBJ_NEW (opal_rmaps_numa_node_t );
1925
+ numa_node -> index = j ;
1926
+ numa_node -> dist_from_closed = latency ;
1927
+ opal_list_append (sorted_list , & numa_node -> super );
1928
+ }
1929
+ hwloc_distances_release (topo , distances );
1930
+ #endif
1913
1931
/* sort numa nodes by distance from the closest one to PCI */
1914
1932
opal_list_sort (sorted_list , dist_cmp_fn );
1915
1933
return ;
@@ -2067,7 +2085,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
2067
2085
/* if it isn't one of interest, then ignore it */
2068
2086
if (HWLOC_OBJ_NODE != type &&
2069
2087
HWLOC_OBJ_SOCKET != type &&
2070
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
2088
+ #if HWLOC_API_VERSION < 0x20000
2071
2089
HWLOC_OBJ_CACHE != type &&
2072
2090
#else
2073
2091
HWLOC_OBJ_L1CACHE != type &&
@@ -2115,7 +2133,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
2115
2133
}
2116
2134
locality = t2 ;
2117
2135
break ;
2118
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
2136
+ #if HWLOC_API_VERSION < 0x20000
2119
2137
case HWLOC_OBJ_CACHE :
2120
2138
if (3 == obj -> attr -> cache .depth ) {
2121
2139
asprintf (& t2 , "%sL3%s:" , (NULL == locality ) ? "" : locality , tmp );
@@ -2213,7 +2231,7 @@ char* opal_hwloc_base_get_location(char *locality,
2213
2231
case HWLOC_OBJ_SOCKET :
2214
2232
srch = "SK" ;
2215
2233
break ;
2216
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
2234
+ #if HWLOC_API_VERSION < 0x20000
2217
2235
case HWLOC_OBJ_CACHE :
2218
2236
if (3 == index ) {
2219
2237
srch = "L3" ;
@@ -2321,7 +2339,7 @@ opal_hwloc_locality_t opal_hwloc_compute_relative_locality(char *loc1, char *loc
2321
2339
}
2322
2340
2323
2341
int opal_hwloc_base_topology_export_xmlbuffer (hwloc_topology_t topology , char * * xmlpath , int * buflen ) {
2324
- #if OPAL_HAVE_HWLOC_OBJ_CACHE
2342
+ #if HWLOC_API_VERSION < 0x20000
2325
2343
return hwloc_topology_export_xmlbuffer (topology , xmlpath , buflen );
2326
2344
#else
2327
2345
return hwloc_topology_export_xmlbuffer (topology , xmlpath , buflen , 0 );
0 commit comments