|
16 | 16 | #include "opal/memoryhooks/memory.h"
|
17 | 17 |
|
18 | 18 | #include <ucm/api/ucm.h>
|
| 19 | +#include <ucs/sys/math.h> |
19 | 20 |
|
20 | 21 | /***********************************************************************/
|
21 | 22 |
|
@@ -91,23 +92,22 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void)
|
91 | 92 | opal_common_ucx.output = opal_output_open(NULL);
|
92 | 93 | opal_output_set_verbosity(opal_common_ucx.output, opal_common_ucx.verbose);
|
93 | 94 |
|
94 |
| - ret = mca_base_framework_open(&opal_memory_base_framework, 0); |
95 |
| - if (OPAL_SUCCESS != ret) { |
96 |
| - /* failed to initialize memory framework - just exit */ |
97 |
| - MCA_COMMON_UCX_VERBOSE(1, "failed to initialize memory base framework: %d, " |
98 |
| - "memory hooks will not be used", ret); |
99 |
| - return; |
100 |
| - } |
101 |
| - |
102 | 95 | /* Set memory hooks */
|
103 |
| - if (opal_common_ucx.opal_mem_hooks && |
104 |
| - (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == |
105 |
| - ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & |
106 |
| - opal_mem_hooks_support_level())) |
107 |
| - { |
108 |
| - MCA_COMMON_UCX_VERBOSE(1, "%s", "using OPAL memory hooks as external events"); |
109 |
| - ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); |
110 |
| - opal_mem_hooks_register_release(opal_common_ucx_mem_release_cb, NULL); |
| 96 | + if (opal_common_ucx.opal_mem_hooks) { |
| 97 | + ret = mca_base_framework_open(&opal_memory_base_framework, 0); |
| 98 | + if (OPAL_SUCCESS != ret) { |
| 99 | + /* failed to initialize memory framework - just exit */ |
| 100 | + MCA_COMMON_UCX_VERBOSE(1, "failed to initialize memory base framework: %d, " |
| 101 | + "memory hooks will not be used", ret); |
| 102 | + return; |
| 103 | + } |
| 104 | + |
| 105 | + if (ucs_test_all_flags(opal_mem_hooks_support_level(), |
| 106 | + OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)) { |
| 107 | + MCA_COMMON_UCX_VERBOSE(1, "%s", "using OPAL memory hooks as external events"); |
| 108 | + ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); |
| 109 | + opal_mem_hooks_register_release(opal_common_ucx_mem_release_cb, NULL); |
| 110 | + } |
111 | 111 | }
|
112 | 112 | }
|
113 | 113 |
|
|
0 commit comments