Skip to content

Commit e330595

Browse files
committed
Merge pull request open-mpi#766 from hppritcha/topic/fix_869
Topic/fix 869: force the use of hwloc
2 parents 762b8e4 + 0f9f7f3 commit e330595

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+668
-1167
lines changed

ompi/dpm/dpm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
857857
opal_list_append(&job_info, &info->super);
858858
}
859859

860-
#if OPAL_HAVE_HWLOC
861860
/* check for 'bind_to' - job-level key */
862861
ompi_info_get(array_of_info[i], "bind_to", sizeof(slot_list) - 1, slot_list, &flag);
863862
if ( flag ) {
@@ -866,7 +865,6 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
866865
opal_value_load(info, slot_list, OPAL_STRING);
867866
opal_list_append(&job_info, &info->super);
868867
}
869-
#endif
870868

871869
/* check for 'preload_binary' - job-level key */
872870
ompi_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag);

ompi/mca/coll/sm/coll_sm_module.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* All rights reserved.
1616
* Copyright (c) 2014-2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2015 Intel, Inc. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -245,9 +246,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
245246
mca_coll_sm_comm_t *data = NULL;
246247
size_t control_size, frag_size;
247248
mca_coll_sm_component_t *c = &mca_coll_sm_component;
248-
#if OPAL_HAVE_HWLOC
249249
opal_hwloc_base_memory_segment_t *maffinity;
250-
#endif
251250
int parent, min_child, num_children;
252251
unsigned char *base = NULL;
253252
const int num_barrier_buffers = 2;
@@ -258,7 +257,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
258257
}
259258
sm_module->enabled = true;
260259

261-
#if OPAL_HAVE_HWLOC
262260
/* Get some space to setup memory affinity (just easier to try to
263261
alloc here to handle the error case) */
264262
maffinity = (opal_hwloc_base_memory_segment_t*)
@@ -270,7 +268,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
270268
comm->c_contextid, comm->c_name);
271269
return OMPI_ERR_OUT_OF_RESOURCE;
272270
}
273-
#endif
274271

275272
/* Allocate data to hang off the communicator. The memory we
276273
alloc will be laid out as follows:
@@ -292,9 +289,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
292289
(sizeof(mca_coll_sm_tree_node_t) +
293290
(sizeof(mca_coll_sm_tree_node_t*) * c->sm_tree_degree))));
294291
if (NULL == data) {
295-
#if OPAL_HAVE_HWLOC
296292
free(maffinity);
297-
#endif
298293
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
299294
"coll:sm:enable (%d/%s): malloc failed (2)",
300295
comm->c_contextid, comm->c_name);
@@ -359,9 +354,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
359354
/* Attach to this communicator's shmem data segment */
360355
if (OMPI_SUCCESS != (ret = bootstrap_comm(comm, sm_module))) {
361356
free(data);
362-
#if OPAL_HAVE_HWLOC
363357
free(maffinity);
364-
#endif
365358
sm_module->sm_comm_data = NULL;
366359
return ret;
367360
}
@@ -407,11 +400,9 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
407400
that they're marked as unused. */
408401
j = 0;
409402
if (0 == rank) {
410-
#if OPAL_HAVE_HWLOC
411403
maffinity[j].mbs_start_addr = base;
412404
maffinity[j].mbs_len = c->sm_control_size *
413405
c->sm_comm_num_in_use_flags;
414-
#endif
415406
/* Set the op counts to 1 (actually any nonzero value will do)
416407
so that the first time children/leaf processes come
417408
through, they don't see a value of 0 and think that the
@@ -436,7 +427,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
436427
(((char*) data->mcb_data_index[i].mcbmi_control) +
437428
control_size);
438429

439-
#if OPAL_HAVE_HWLOC
440430
/* Memory affinity: control */
441431

442432
maffinity[j].mbs_len = c->sm_control_size;
@@ -452,15 +442,12 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
452442
((char*) data->mcb_data_index[i].mcbmi_data) +
453443
(rank * c->sm_control_size);
454444
++j;
455-
#endif
456445
}
457446

458-
#if OPAL_HAVE_HWLOC
459447
/* Setup memory affinity so that the pages that belong to this
460448
process are local to this process */
461449
opal_hwloc_base_memory_set(maffinity, j);
462450
free(maffinity);
463-
#endif
464451

465452
/* Zero out the control structures that belong to this process */
466453
memset(data->mcb_barrier_control_me, 0,

ompi/mpiext/affinity/c/mpiext_affinity_str.c

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* reserved.
1010
* Copyright (c) 2015 Research Organization for Information Science
1111
* and Technology (RIST). All rights reserved.
12+
* Copyright (c) 2015 Intel, Inc. All rights reserved.
1213
* $COPYRIGHT$
1314
*
1415
* Additional copyrights may follow
@@ -41,43 +42,6 @@ static const char FUNC_NAME[] = "OMPI_Affinity";
4142
static const char ompi_nobind_str[] = "Open MPI did not bind this process";
4243
static const char not_bound_str[] = "Not bound (i.e., bound to all processors)";
4344

44-
/**************************************************************************
45-
* Utility routine
46-
**************************************************************************/
47-
48-
static void no_hwloc_support(char ompi_bound[OMPI_AFFINITY_STRING_MAX],
49-
char current_binding[OMPI_AFFINITY_STRING_MAX],
50-
char exists[OMPI_AFFINITY_STRING_MAX])
51-
{
52-
strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX);
53-
strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX);
54-
strncpy(exists, "Not supported", OMPI_AFFINITY_STRING_MAX);
55-
}
56-
57-
/**************************************************************************
58-
* If we have no hwloc support compiled in, do almost nothing.
59-
**************************************************************************/
60-
61-
#if !OPAL_HAVE_HWLOC
62-
/*
63-
* If hwloc support was not compiled in, then just return "Not
64-
* supported".
65-
*/
66-
int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
67-
char ompi_bound[OMPI_AFFINITY_STRING_MAX],
68-
char current_binding[OMPI_AFFINITY_STRING_MAX],
69-
char exists[OMPI_AFFINITY_STRING_MAX])
70-
{
71-
no_hwloc_support(ompi_bound, current_binding, exists);
72-
return MPI_SUCCESS;
73-
}
74-
#endif // !OPAL_HAVE_HWLOC
75-
76-
/**************************************************************************
77-
* If we have hwloc support compiled in, do the actual work.
78-
**************************************************************************/
79-
80-
#if OPAL_HAVE_HWLOC
8145

8246
static int get_rsrc_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]);
8347
static int get_rsrc_current_binding(char str[OMPI_AFFINITY_STRING_MAX]);
@@ -99,29 +63,27 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
9963

10064
/* If we have no hwloc support, return nothing */
10165
if (NULL == opal_hwloc_topology) {
102-
no_hwloc_support(ompi_bound, current_binding, exists);
103-
10466
return MPI_SUCCESS;
10567
}
10668

10769
/* Otherwise, return useful information */
10870
switch (fmt_type) {
10971
case OMPI_AFFINITY_RSRC_STRING_FMT:
110-
if (OMPI_SUCCESS != (ret = get_rsrc_ompi_bound(ompi_bound)) ||
111-
OMPI_SUCCESS != (ret = get_rsrc_current_binding(current_binding)) ||
112-
OMPI_SUCCESS != (ret = get_rsrc_exists(exists))) {
113-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
114-
}
115-
break;
72+
if (OMPI_SUCCESS != (ret = get_rsrc_ompi_bound(ompi_bound)) ||
73+
OMPI_SUCCESS != (ret = get_rsrc_current_binding(current_binding)) ||
74+
OMPI_SUCCESS != (ret = get_rsrc_exists(exists))) {
75+
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
76+
}
77+
break;
11678
case OMPI_AFFINITY_LAYOUT_FMT:
117-
if (OMPI_SUCCESS != (ret = get_layout_ompi_bound(ompi_bound)) ||
118-
OMPI_SUCCESS != (ret = get_layout_current_binding(current_binding)) ||
119-
OMPI_SUCCESS != (ret = get_layout_exists(exists))) {
120-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
121-
}
122-
break;
79+
if (OMPI_SUCCESS != (ret = get_layout_ompi_bound(ompi_bound)) ||
80+
OMPI_SUCCESS != (ret = get_layout_current_binding(current_binding)) ||
81+
OMPI_SUCCESS != (ret = get_layout_exists(exists))) {
82+
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
83+
}
84+
break;
12385
default:
124-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
86+
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
12587
}
12688

12789
return MPI_SUCCESS;
@@ -457,4 +419,3 @@ static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX])
457419

458420
return OMPI_SUCCESS;
459421
}
460-
#endif /* OPAL_HAVE_HWLOC */

ompi/runtime/ompi_mpi_init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
494494
/* check for timing request - get stop time and report elapsed time if so */
495495
OPAL_TIMING_MNEXT((&tm,"time from completion of rte_init to modex"));
496496

497-
#if OPAL_HAVE_HWLOC
498497
/* if hwloc is available but didn't get setup for some
499498
* reason, do so now
500499
*/
@@ -504,7 +503,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
504503
goto error;
505504
}
506505
}
507-
#endif
508506

509507
/* Register the default errhandler callback - RTE will ignore if it
510508
* doesn't support this capability

ompi/tools/ompi_info/param.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1414
* Copyright (c) 2014-2015 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
16+
* Copyright (c) 2015 Intel, Inc. All rights reserved
1617
* $COPYRIGHT$
1718
*
1819
* Additional copyrights may follow
@@ -266,7 +267,7 @@ void ompi_info_do_config(bool want_all)
266267
have_mpi_io = OMPI_PROVIDE_MPI_FILE_INTERFACE ? "yes" : "no";
267268
wtime_support = OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday";
268269
symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no";
269-
topology_support = OPAL_HAVE_HWLOC ? "yes" : "no";
270+
topology_support = "yes";
270271

271272
/* setup strings that require allocation */
272273
if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) {

opal/mca/btl/openib/btl_openib.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Copyright (c) 2006-2007 Voltaire All rights reserved.
1818
* Copyright (c) 2008-2012 Oracle and/or its affiliates. All rights reserved.
1919
* Copyright (c) 2009 IBM Corporation. All rights reserved.
20-
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
20+
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
2121
* Copyright (c) 2013-2015 NVIDIA Corporation. All rights reserved.
2222
* Copyright (c) 2014-2015 Research Organization for Information Science
2323
* and Technology (RIST). All rights reserved.
@@ -84,9 +84,7 @@
8484
#ifdef HAVE_UNISTD_H
8585
#include <unistd.h>
8686
#endif
87-
#ifdef OPAL_HAVE_HWLOC
8887
#include "opal/mca/hwloc/hwloc.h"
89-
#endif
9088

9189
#ifndef MIN
9290
#define MIN(a,b) ((a)<(b)?(a):(b))

opal/mca/btl/openib/btl_openib_component.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,6 @@ static uint64_t read_module_param(char *file, uint64_t value, uint64_t max)
14851485
/* calculate memory registation limits */
14861486
static uint64_t calculate_total_mem (void)
14871487
{
1488-
#if OPAL_HAVE_HWLOC
14891488
hwloc_obj_t machine;
14901489

14911490
machine = hwloc_get_next_obj_by_type (opal_hwloc_topology, HWLOC_OBJ_MACHINE, NULL);
@@ -1494,9 +1493,6 @@ static uint64_t calculate_total_mem (void)
14941493
}
14951494

14961495
return machine->memory.total_memory;
1497-
#else
1498-
return 0;
1499-
#endif
15001496
}
15011497

15021498

@@ -2306,7 +2302,6 @@ static float get_ib_dev_distance(struct ibv_device *dev)
23062302
return distance;
23072303
}
23082304

2309-
#if OPAL_HAVE_HWLOC
23102305
float a, b;
23112306
int i;
23122307
hwloc_cpuset_t my_cpuset = NULL, ibv_cpuset = NULL;
@@ -2445,7 +2440,6 @@ static float get_ib_dev_distance(struct ibv_device *dev)
24452440
if (NULL != my_cpuset) {
24462441
hwloc_bitmap_free(my_cpuset);
24472442
}
2448-
#endif
24492443

24502444
return distance;
24512445
}
@@ -2465,13 +2459,11 @@ sort_devs_by_distance(struct ibv_device **ib_devs, int count)
24652459
"Checking distance from this process to device=%s", ibv_get_device_name(ib_devs[i]));
24662460
/* If we're not bound, just assume that the device is close. */
24672461
devs[i].distance = 0;
2468-
#if OPAL_HAVE_HWLOC
24692462
if (opal_process_info.cpuset) {
24702463
/* If this process is bound to one or more PUs, we can get
24712464
an accurate distance. */
24722465
devs[i].distance = get_ib_dev_distance(ib_devs[i]);
24732466
}
2474-
#endif
24752467
opal_output_verbose(5, opal_btl_base_framework.framework_output,
24762468
"Process is %s: distance to device is %f",
24772469
(opal_process_info.cpuset ? "bound" : "not bound"), devs[i].distance);

opal/mca/btl/sm/btl_sm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* All rights reserved.
1717
* Copyright (c) 2010-2012 IBM Corporation. All rights reserved.
1818
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
19-
* Copyright (c) 2013 Intel, Inc. All rights reserved.
19+
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
2020
* Copyright (c) 2014-2015 Research Organization for Information Science
2121
* and Technology (RIST). All rights reserved.
2222
* $COPYRIGHT$
@@ -226,7 +226,6 @@ sm_btl_first_time_init(mca_btl_sm_t *sm_btl,
226226
mca_btl_sm_component.mem_node = my_mem_node = 0;
227227
mca_btl_sm_component.num_mem_nodes = num_mem_nodes = 1;
228228

229-
#if OPAL_HAVE_HWLOC
230229
/* If we have hwloc support, then get accurate information */
231230
if (NULL != opal_hwloc_topology) {
232231
i = opal_hwloc_base_get_nbobjs_by_type(opal_hwloc_topology,
@@ -276,7 +275,6 @@ sm_btl_first_time_init(mca_btl_sm_t *sm_btl,
276275
}
277276
}
278277
}
279-
#endif
280278

281279
if (NULL == (res = calloc(1, sizeof(*res)))) {
282280
return OPAL_ERR_OUT_OF_RESOURCE;

opal/mca/btl/smcuda/btl_smcuda.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
1919
* Copyright (c) 2014 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
21+
* Copyright (c) 2015 Intel, Inc. All rights reserved.
2122
* $COPYRIGHT$
2223
*
2324
* Additional copyrights may follow
@@ -234,7 +235,6 @@ smcuda_btl_first_time_init(mca_btl_smcuda_t *smcuda_btl,
234235
mca_btl_smcuda_component.mem_node = my_mem_node = 0;
235236
mca_btl_smcuda_component.num_mem_nodes = num_mem_nodes = 1;
236237

237-
#if OPAL_HAVE_HWLOC
238238
/* If we have hwloc support, then get accurate information */
239239
if (NULL != opal_hwloc_topology) {
240240
i = opal_hwloc_base_get_nbobjs_by_type(opal_hwloc_topology,
@@ -284,7 +284,6 @@ smcuda_btl_first_time_init(mca_btl_smcuda_t *smcuda_btl,
284284
}
285285
}
286286
}
287-
#endif
288287

289288
if (NULL == (res = calloc(1, sizeof(*res)))) {
290289
return OPAL_ERR_OUT_OF_RESOURCE;

opal/mca/btl/usnic/Makefile.am

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Copyright (c) 2006 Sandia National Laboratories. All rights
1313
# reserved.
1414
# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
15+
# Copyright (c) 2015 Intel, Inc. All rights reserved.
1516
# $COPYRIGHT$
1617
#
1718
# Additional copyrights may follow
@@ -48,6 +49,7 @@ sources = \
4849
btl_usnic_frag.h \
4950
btl_usnic_graph.h \
5051
btl_usnic_graph.c \
52+
btl_usnic_hwloc.c \
5153
btl_usnic_hwloc.h \
5254
btl_usnic_map.c \
5355
btl_usnic_mca.c \
@@ -65,10 +67,6 @@ sources = \
6567
btl_usnic_test.h \
6668
$(test_sources)
6769

68-
if OPAL_HAVE_HWLOC
69-
sources += btl_usnic_hwloc.c
70-
endif
71-
7270
# Make the output library in this directory, and name it either
7371
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
7472
# (for static builds).

0 commit comments

Comments
 (0)