@@ -301,17 +301,28 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority)
301
301
HCOL_ERROR ("Hcol library init failed" );
302
302
return NULL ;
303
303
}
304
-
305
304
#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 ) {
307
306
#else
308
- if (cm -> using_mem_hooks && hcoll_check_mem_release_cb_needed ()) {
307
+ if (hcoll_check_mem_release_cb_needed ()) {
309
308
#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
+ }
311
323
} else {
312
324
cm -> using_mem_hooks = 0 ;
313
325
}
314
-
315
326
copy_fn .attr_communicator_copy_fn = (MPI_Comm_internal_copy_attr_function * ) MPI_COMM_NULL_COPY_FN ;
316
327
del_fn .attr_communicator_delete_fn = hcoll_comm_attr_del_fn ;
317
328
err = ompi_attr_create_keyval (COMM_ATTR , copy_fn , del_fn , & hcoll_comm_attr_keyval , NULL ,0 , NULL );
0 commit comments