@@ -187,12 +187,9 @@ int opal_hwloc_base_get_topology(void)
187187 /* since we are loading this from an external source, we have to
188188 * explicitly set a flag so hwloc sets things up correctly
189189 */
190- if (0 != hwloc_topology_set_flags (opal_hwloc_topology ,
191- (HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
192- #if HWLOC_API_VERSION < 0x20000
193- | HWLOC_TOPOLOGY_FLAG_IO_DEVICES
194- #endif
195- ))) {
190+ if (0 != opal_hwloc_base_topology_set_flags (opal_hwloc_topology ,
191+ HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM ,
192+ true)) {
196193 hwloc_topology_destroy (opal_hwloc_topology );
197194 free (val );
198195 return OPAL_ERROR ;
@@ -206,10 +203,7 @@ int opal_hwloc_base_get_topology(void)
206203 free (val );
207204 } else if (NULL == opal_hwloc_base_topo_file ) {
208205 if (0 != hwloc_topology_init (& opal_hwloc_topology ) ||
209- #if HWLOC_API_VERSION < 0x20000
210- 0 != hwloc_topology_set_flags (opal_hwloc_topology ,
211- HWLOC_TOPOLOGY_FLAG_IO_DEVICES ) ||
212- #endif
206+ 0 != opal_hwloc_base_topology_set_flags (opal_hwloc_topology , 0 , true) ||
213207 0 != hwloc_topology_load (opal_hwloc_topology )) {
214208 return OPAL_ERR_NOT_SUPPORTED ;
215209 }
@@ -253,12 +247,9 @@ int opal_hwloc_base_set_topology(char *topofile)
253247 /* since we are loading this from an external source, we have to
254248 * explicitly set a flag so hwloc sets things up correctly
255249 */
256- if (0 != hwloc_topology_set_flags (opal_hwloc_topology ,
257- (HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
258- #if HWLOC_API_VERSION < 0x20000
259- | HWLOC_TOPOLOGY_FLAG_IO_DEVICES
260- #endif
261- ))) {
250+ if (0 != opal_hwloc_base_topology_set_flags (opal_hwloc_topology ,
251+ HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM ,
252+ true)) {
262253 hwloc_topology_destroy (opal_hwloc_topology );
263254 return OPAL_ERR_NOT_SUPPORTED ;
264255 }
@@ -2346,3 +2337,14 @@ int opal_hwloc_base_topology_export_xmlbuffer(hwloc_topology_t topology, char **
23462337#endif
23472338}
23482339
2340+ int opal_hwloc_base_topology_set_flags (hwloc_topology_t topology , unsigned long flags , bool io ) {
2341+ if (io ) {
2342+ #if HWLOC_API_VERSION < 0x20000
2343+ flags |= HWLOC_TOPOLOGY_FLAG_IO_DEVICES ;
2344+ #else
2345+ int ret = hwloc_topology_set_io_types_filter (topology , HWLOC_TYPE_FILTER_KEEP_IMPORTANT );
2346+ if (0 != ret ) return ret ;
2347+ #endif
2348+ }
2349+ return hwloc_topology_set_flags (topology , flags );
2350+ }
0 commit comments