Skip to content

Commit 6994d74

Browse files
committed
mpiext/affinity: #if OPAL_HAVE_HWLOC most parts of the code
that allow this extension to compile if configure'd with --without-hwloc
1 parent e0dd9bd commit 6994d74

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ompi/mpiext/affinity/c/mpiext_affinity_str.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ static const char FUNC_NAME[] = "OMPI_Affinity";
3838
static const char ompi_nobind_str[] = "Open MPI did not bind this process";
3939
static const char not_bound_str[] = "Not bound (i.e., bound to all processors)";
4040

41+
#if OPAL_HAVE_HWLOC
4142
static int get_rsrc_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]);
4243
static int get_rsrc_current_binding(char str[OMPI_AFFINITY_STRING_MAX]);
4344
static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX]);
4445
static int get_layout_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]);
4546
static int get_layout_current_binding(char str[OMPI_AFFINITY_STRING_MAX]);
4647
static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX]);
48+
#endif /* OPAL_HAVE_HWLOC */
4749

4850
/*---------------------------------------------------------------------------*/
4951

@@ -52,19 +54,25 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
5254
char current_binding[OMPI_AFFINITY_STRING_MAX],
5355
char exists[OMPI_AFFINITY_STRING_MAX])
5456
{
57+
#if OPAL_HAVE_HWLOC
5558
int ret;
59+
#endif /* OPAL_HAVE_HWLOC */
5660

5761
memset(ompi_bound, 0, OMPI_AFFINITY_STRING_MAX);
5862
memset(current_binding, 0, OMPI_AFFINITY_STRING_MAX);
5963

6064
/* If we have no hwloc support, return nothing */
61-
if (NULL == opal_hwloc_topology) {
65+
#if OPAL_HAVE_HWLOC
66+
if (NULL == opal_hwloc_topology)
67+
#endif /* OPAL_HAVE_HWLOC */
68+
{
6269
strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX);
6370
strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX);
6471
strncpy(exists, "Not supported", OMPI_AFFINITY_STRING_MAX);
6572
return MPI_SUCCESS;
6673
}
6774

75+
#if OPAL_HAVE_HWLOC
6876
/* Otherwise, return useful information */
6977
switch (fmt_type) {
7078
case OMPI_AFFINITY_RSRC_STRING_FMT:
@@ -86,8 +94,10 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
8694
}
8795

8896
return MPI_SUCCESS;
97+
#endif /* OPAL_HAVE_HWLOC */
8998
}
9099

100+
#if OPAL_HAVE_HWLOC
91101
/*---------------------------------------------------------------------------*/
92102

93103
/*
@@ -275,7 +285,7 @@ static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX])
275285
}
276286
}
277287
}
278-
}
288+
}
279289

280290
return OMPI_SUCCESS;
281291
}
@@ -418,3 +428,4 @@ static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX])
418428

419429
return OMPI_SUCCESS;
420430
}
431+
#endif /* OPAL_HAVE_HWLOC */

0 commit comments

Comments
 (0)