1
1

Coll/hcoll: don't init opal memhooks unless explicitely requested by user

If user sets HCOLL_EXTERNAL_UCM_EVENTS=1 then we try init opal
    memory framework and register a mem release cb. Otherwise, rely on ucx.

Signed-off-by: Valentin Petrov <valentinp@mellanox.com>
Этот коммит содержится в:
Valentin Petrov 2019-05-20 11:17:44 +03:00
родитель c22326e59a
Коммит 8f82c899bc
2 изменённых файлов: 16 добавлений и 24 удалений

Просмотреть файл

@ -209,29 +209,10 @@ static int hcoll_open(void)
{
mca_coll_hcoll_component_t *cm;
cm = &mca_coll_hcoll_component;
mca_coll_hcoll_output = opal_output_open(NULL);
opal_output_set_verbosity(mca_coll_hcoll_output, cm->hcoll_verbose);
hcoll_rte_fns_setup();
cm->libhcoll_initialized = false;
(void)mca_base_framework_open(&opal_memory_base_framework, 0);
/* Register memory hooks */
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) ==
((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) &
opal_mem_hooks_support_level()))
{
setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0);
HCOL_VERBOSE(1, "Enabling on-demand memory mapping");
cm->using_mem_hooks = 1;
} else {
HCOL_VERBOSE(1, "Disabling on-demand memory mapping");
cm->using_mem_hooks = 0;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -301,17 +301,28 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority)
HCOL_ERROR("Hcol library init failed");
return NULL;
}
#if HCOLL_API >= HCOLL_VERSION(3,2)
if (cm->using_mem_hooks && cm->init_opts->mem_hook_needed) {
if (cm->init_opts->mem_hook_needed) {
#else
if (cm->using_mem_hooks && hcoll_check_mem_release_cb_needed()) {
if (hcoll_check_mem_release_cb_needed()) {
#endif
opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL);
rc = mca_base_framework_open(&opal_memory_base_framework, 0);
if (OPAL_SUCCESS != rc) {
HCOL_VERBOSE(1, "failed to initialize memory base framework: %d, "
"memory hooks will not be used", rc);
} else {
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) ==
((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) &
opal_mem_hooks_support_level())) {
HCOL_VERBOSE(1, "using OPAL memory hooks as external events");
cm->using_mem_hooks = 1;
opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL);
setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0);
}
}
} else {
cm->using_mem_hooks = 0;
}
copy_fn.attr_communicator_copy_fn = (MPI_Comm_internal_copy_attr_function*) MPI_COMM_NULL_COPY_FN;
del_fn.attr_communicator_delete_fn = hcoll_comm_attr_del_fn;
err = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, &hcoll_comm_attr_keyval, NULL ,0, NULL);