Skip to content

Commit c5a8a78

Browse files
committed
Don't use hwloc v2 structures unless we have that version or above
Protect the logic that uses v2 structures from compiling with hwloc v1.x Signed-off-by: Ralph Castain <[email protected]>
1 parent 8a446f6 commit c5a8a78

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

opal/mca/common/ofi/common_ofi.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ static int compute_dev_distances(pmix_device_distance_t **distances,
480480
PMIX_CPUSET_CONSTRUCT(&cpuset);
481481
ret = PMIx_Get_cpuset(&cpuset, PMIX_CPUBIND_THREAD);
482482
if (PMIX_SUCCESS != ret) {
483+
/* we are not bound */
484+
ret = OPAL_ERR_NOT_BOUND;
483485
goto out;
484486
}
485487
/* if we are not bound, then we cannot compute distances */
@@ -499,7 +501,7 @@ static int compute_dev_distances(pmix_device_distance_t **distances,
499501
ninfo = 1;
500502
info = PMIx_Info_create(ninfo);
501503
PMIx_Info_load(&info[0], PMIX_DEVICE_TYPE, &type, PMIX_DEVTYPE);
502-
ret = PMIx_Compute_distances(pmix_topo, &cpuset, info, ninfo, distances,
504+
ret = PMIx_Compute_distances(&pmix_topo, &cpuset, info, ninfo, distances,
503505
ndist);
504506
PMIx_Info_free(info, ninfo);
505507

@@ -603,6 +605,15 @@ get_nearest_nics(int *num_distances, pmix_value_t **valin)
603605
* distances array is not provided. False otherwise.
604606
*
605607
*/
608+
#if HWLOC_API_VERSION < 0x00020000
609+
static bool is_near(pmix_device_distance_t *distances,
610+
int num_distances,
611+
hwloc_topology_t topology,
612+
struct fi_pci_attr pci)
613+
{
614+
return true;
615+
}
616+
#else
606617
static bool is_near(pmix_device_distance_t *distances,
607618
int num_distances,
608619
hwloc_topology_t topology,
@@ -665,6 +676,7 @@ static bool is_near(pmix_device_distance_t *distances,
665676
return false;
666677
}
667678
#endif
679+
#endif // OPAL_OFI_PCI_DATA_AVAILABLE
668680

669681
/* Count providers returns the number of providers present in an fi_info list
670682
* @param (IN) provider_list struct fi_info* list of providers available
@@ -779,8 +791,8 @@ struct fi_info *opal_common_ofi_select_provider(struct fi_info *provider_list,
779791
pmix_value_t *pmix_val;
780792
struct fi_pci_attr pci;
781793
int num_distances = 0;
782-
bool near;
783794
#endif
795+
bool near;
784796
int ret;
785797
unsigned int num_provider = 0, provider_limit = 0;
786798
bool provider_found = false;

0 commit comments

Comments
 (0)