Skip to content

Commit a04f5f0

Browse files
authored
Merge pull request #6692 from vspetrov/v4.0.x
V4.0.x Coll/hcoll: don't init opal memhooks unless explicitely requested
2 parents 6c74d40 + 8f82c89 commit a04f5f0

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

ompi/mca/coll/hcoll/coll_hcoll_component.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,29 +209,10 @@ static int hcoll_open(void)
209209
{
210210
mca_coll_hcoll_component_t *cm;
211211
cm = &mca_coll_hcoll_component;
212-
213212
mca_coll_hcoll_output = opal_output_open(NULL);
214213
opal_output_set_verbosity(mca_coll_hcoll_output, cm->hcoll_verbose);
215-
216214
hcoll_rte_fns_setup();
217-
218215
cm->libhcoll_initialized = false;
219-
220-
(void)mca_base_framework_open(&opal_memory_base_framework, 0);
221-
222-
/* Register memory hooks */
223-
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) ==
224-
((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) &
225-
opal_mem_hooks_support_level()))
226-
{
227-
setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0);
228-
HCOL_VERBOSE(1, "Enabling on-demand memory mapping");
229-
cm->using_mem_hooks = 1;
230-
} else {
231-
HCOL_VERBOSE(1, "Disabling on-demand memory mapping");
232-
cm->using_mem_hooks = 0;
233-
}
234-
235216
return OMPI_SUCCESS;
236217
}
237218

ompi/mca/coll/hcoll/coll_hcoll_module.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,28 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority)
301301
HCOL_ERROR("Hcol library init failed");
302302
return NULL;
303303
}
304-
305304
#if HCOLL_API >= HCOLL_VERSION(3,2)
306-
if (cm->using_mem_hooks && cm->init_opts->mem_hook_needed) {
305+
if (cm->init_opts->mem_hook_needed) {
307306
#else
308-
if (cm->using_mem_hooks && hcoll_check_mem_release_cb_needed()) {
307+
if (hcoll_check_mem_release_cb_needed()) {
309308
#endif
310-
opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL);
309+
rc = mca_base_framework_open(&opal_memory_base_framework, 0);
310+
if (OPAL_SUCCESS != rc) {
311+
HCOL_VERBOSE(1, "failed to initialize memory base framework: %d, "
312+
"memory hooks will not be used", rc);
313+
} else {
314+
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) ==
315+
((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) &
316+
opal_mem_hooks_support_level())) {
317+
HCOL_VERBOSE(1, "using OPAL memory hooks as external events");
318+
cm->using_mem_hooks = 1;
319+
opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL);
320+
setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0);
321+
}
322+
}
311323
} else {
312324
cm->using_mem_hooks = 0;
313325
}
314-
315326
copy_fn.attr_communicator_copy_fn = (MPI_Comm_internal_copy_attr_function*) MPI_COMM_NULL_COPY_FN;
316327
del_fn.attr_communicator_delete_fn = hcoll_comm_attr_del_fn;
317328
err = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, &hcoll_comm_attr_keyval, NULL ,0, NULL);

0 commit comments

Comments
 (0)