@@ -118,7 +118,6 @@ hwloc_obj_t opal_hwloc_base_get_pu(hwloc_topology_t topo,
118118 return obj ;
119119}
120120
121- #if HWLOC_API_VERSION < 0x20000
122121/* determine the node-level available cpuset based on
123122 * online vs allowed vs user-specified cpus
124123 */
@@ -146,8 +145,12 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
146145 /* process any specified default cpu set against this topology */
147146 if (NULL == opal_hwloc_base_cpu_list ) {
148147 /* get the root available cpuset */
149- avail = hwloc_bitmap_alloc ();
150- hwloc_bitmap_and (avail , root -> online_cpuset , root -> allowed_cpuset );
148+ #if HWLOC_API_VERSION < 0x20000
149+ avail = hwloc_bitmap_alloc ();
150+ hwloc_bitmap_and (avail , root -> online_cpuset , root -> allowed_cpuset );
151+ #else
152+ avail = hwloc_bitmap_dup (root -> allowed_cpuset );
153+ #endif
151154 OPAL_OUTPUT_VERBOSE ((5 , opal_hwloc_base_framework .framework_output ,
152155 "hwloc:base: no cpus specified - using root available cpuset" ));
153156 } else {
@@ -166,7 +169,12 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
166169 /* only one cpu given - get that object */
167170 cpu = strtoul (range [0 ], NULL , 10 );
168171 if (NULL != (pu = opal_hwloc_base_get_pu (topo , cpu , OPAL_HWLOC_LOGICAL ))) {
169- hwloc_bitmap_and (pucpus , pu -> online_cpuset , pu -> allowed_cpuset );
172+ #if HWLOC_API_VERSION < 0x20000
173+ hwloc_bitmap_and (pucpus , pu -> online_cpuset , pu -> allowed_cpuset );
174+ #else
175+ hwloc_bitmap_free (pucpus );
176+ pucpus = hwloc_bitmap_dup (pu -> allowed_cpuset );
177+ #endif
170178 hwloc_bitmap_or (res , avail , pucpus );
171179 hwloc_bitmap_copy (avail , res );
172180 data = (opal_hwloc_obj_data_t * )pu -> userdata ;
@@ -183,7 +191,12 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
183191 end = strtoul (range [1 ], NULL , 10 );
184192 for (cpu = start ; cpu <= end ; cpu ++ ) {
185193 if (NULL != (pu = opal_hwloc_base_get_pu (topo , cpu , OPAL_HWLOC_LOGICAL ))) {
186- hwloc_bitmap_and (pucpus , pu -> online_cpuset , pu -> allowed_cpuset );
194+ #if HWLOC_API_VERSION < 0x20000
195+ hwloc_bitmap_and (pucpus , pu -> online_cpuset , pu -> allowed_cpuset );
196+ #else
197+ hwloc_bitmap_free (pucpus );
198+ pucpus = hwloc_bitmap_dup (pu -> allowed_cpuset );
199+ #endif
187200 hwloc_bitmap_or (res , avail , pucpus );
188201 hwloc_bitmap_copy (avail , res );
189202 data = (opal_hwloc_obj_data_t * )pu -> userdata ;
@@ -212,7 +225,6 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
212225
213226 return OPAL_SUCCESS ;
214227}
215- #endif
216228
217229static void fill_cache_line_size (void )
218230{
@@ -345,54 +357,22 @@ int opal_hwloc_base_get_topology(void)
345357 return OPAL_ERROR ;
346358 }
347359 free (val );
348- #if HWLOC_API_VERSION < 0x20000
349360 /* filter the cpus thru any default cpu set */
350361 if (OPAL_SUCCESS != (rc = opal_hwloc_base_filter_cpus (opal_hwloc_topology ))) {
351362 hwloc_topology_destroy (opal_hwloc_topology );
352363 return rc ;
353364 }
354- #else
355- /* setup the summary cpuset to make things consistent */
356- root = hwloc_get_root_obj (opal_hwloc_topology );
357-
358- if (NULL == root -> userdata ) {
359- root -> userdata = (void * )OBJ_NEW (opal_hwloc_topo_data_t );
360- }
361- sum = (opal_hwloc_topo_data_t * )root -> userdata ;
362-
363- /* should only ever enter here once, but check anyway */
364- if (NULL == sum -> available ) {
365- sum -> available = hwloc_bitmap_dup (root -> allowed_cpuset );
366- return OPAL_SUCCESS ;
367- }
368- #endif
369365 } else if (NULL == opal_hwloc_base_topo_file ) {
370366 if (0 != hwloc_topology_init (& opal_hwloc_topology ) ||
371367 0 != opal_hwloc_base_topology_set_flags (opal_hwloc_topology , 0 , true) ||
372368 0 != hwloc_topology_load (opal_hwloc_topology )) {
373369 return OPAL_ERR_NOT_SUPPORTED ;
374370 }
375- #if HWLOC_API_VERSION < 0x20000
376371 /* filter the cpus thru any default cpu set */
377372 if (OPAL_SUCCESS != (rc = opal_hwloc_base_filter_cpus (opal_hwloc_topology ))) {
378373 hwloc_topology_destroy (opal_hwloc_topology );
379374 return rc ;
380375 }
381- #else
382- /* setup the summary cpuset to make things consistent */
383- root = hwloc_get_root_obj (opal_hwloc_topology );
384-
385- if (NULL == root -> userdata ) {
386- root -> userdata = (void * )OBJ_NEW (opal_hwloc_topo_data_t );
387- }
388- sum = (opal_hwloc_topo_data_t * )root -> userdata ;
389-
390- /* should only ever enter here once, but check anyway */
391- if (NULL == sum -> available ) {
392- sum -> available = hwloc_bitmap_dup (root -> allowed_cpuset );
393- return OPAL_SUCCESS ;
394- }
395- #endif
396376 } else {
397377 if (OPAL_SUCCESS != (rc = opal_hwloc_base_set_topology (opal_hwloc_base_topo_file ))) {
398378 return rc ;
0 commit comments