|
11 | 11 | * Copyright (c) 2004-2005 The Regents of the University of California. |
12 | 12 | * All rights reserved. |
13 | 13 | * Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved. |
14 | | - * Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved. |
| 14 | + * Copyright (c) 2006-2016 Mellanox Technologies. All rights reserved. |
15 | 15 | * Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights |
16 | 16 | * reserved. |
17 | 17 | * Copyright (c) 2006-2007 Voltaire All rights reserved. |
18 | 18 | * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. |
19 | 19 | * Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. |
20 | 20 | * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved |
21 | 21 | * Copyright (c) 2013 Intel, Inc. All rights reserved |
22 | | - * Copyright (c) 2014-2015 Research Organization for Information Science |
| 22 | + * Copyright (c) 2014-2016 Research Organization for Information Science |
23 | 23 | * and Technology (RIST). All rights reserved. |
24 | 24 | * Copyright (c) 2014 Bull SAS. All rights reserved. |
25 | 25 | * $COPYRIGHT$ |
|
42 | 42 | #include <fcntl.h> |
43 | 43 | #include <stdlib.h> |
44 | 44 | #include <stddef.h> |
45 | | -#if BTL_OPENIB_MALLOC_HOOKS_ENABLED |
46 | | -/* |
47 | | - * The include of malloc.h below breaks abstractions in OMPI (by |
48 | | - * directly including a header file from another component), but has |
49 | | - * been ruled "ok" because the openib component is only supported on |
50 | | - * Linux. |
51 | | - * |
52 | | - * The malloc hooks in newer glibc were deprecated, including stock |
53 | | - * malloc.h causes compilation warnings. Instead, we use the internal |
54 | | - * linux component malloc.h which does not cause these warnings. |
55 | | - * Internally, OMPI uses the built-in ptmalloc from the linux memory |
56 | | - * component anyway. |
57 | | - */ |
58 | | -#include "opal/mca/memory/linux/malloc.h" |
59 | | -#endif |
60 | 45 |
|
| 46 | +#include "opal/mca/memory/memory.h" |
61 | 47 | #include "opal/mca/event/event.h" |
62 | 48 | #include "opal/align.h" |
63 | 49 | #include "opal/util/output.h" |
@@ -129,7 +115,6 @@ static void btl_openib_handle_incoming_completion(mca_btl_base_module_t* btl, |
129 | 115 | * Local variables |
130 | 116 | */ |
131 | 117 | static mca_btl_openib_device_t *receive_queues_device = NULL; |
132 | | -static bool malloc_hook_set = false; |
133 | 118 | static int num_devices_intentionally_ignored = 0; |
134 | 119 |
|
135 | 120 | mca_btl_openib_component_t mca_btl_openib_component = { |
@@ -159,30 +144,6 @@ mca_btl_openib_component_t mca_btl_openib_component = { |
159 | 144 | } |
160 | 145 | }; |
161 | 146 |
|
162 | | -#if BTL_OPENIB_MALLOC_HOOKS_ENABLED |
163 | | -/* This is a memory allocator hook. The purpose of this is to make |
164 | | - * every malloc aligned since this speeds up IB HCA work. |
165 | | - * There two basic cases here: |
166 | | - * |
167 | | - * 1. Memory manager for Open MPI is enabled. Then memalign below will |
168 | | - * be overridden by __memalign_hook which is set to |
169 | | - * opal_memory_linux_memalign_hook. Thus, _malloc_hook is going to |
170 | | - * use opal_memory_linux_memalign_hook. |
171 | | - * |
172 | | - * 2. No memory manager support. The memalign below is just regular glibc |
173 | | - * memalign which will be called through __malloc_hook instead of malloc. |
174 | | - */ |
175 | | -static void *btl_openib_malloc_hook(size_t sz, const void* caller) |
176 | | -{ |
177 | | - if (sz < mca_btl_openib_component.memalign_threshold && |
178 | | - malloc_hook_set) { |
179 | | - return mca_btl_openib_component.previous_malloc_hook(sz, caller); |
180 | | - } else { |
181 | | - return memalign(mca_btl_openib_component.use_memalign, sz); |
182 | | - } |
183 | | -} |
184 | | -#endif |
185 | | - |
186 | 147 | static int btl_openib_component_register(void) |
187 | 148 | { |
188 | 149 | int ret; |
@@ -287,16 +248,6 @@ static int btl_openib_component_close(void) |
287 | 248 | if (NULL != mca_btl_openib_component.default_recv_qps) { |
288 | 249 | free(mca_btl_openib_component.default_recv_qps); |
289 | 250 | } |
290 | | - |
291 | | -#if BTL_OPENIB_MALLOC_HOOKS_ENABLED |
292 | | - /* Must check to see whether the malloc hook was set before |
293 | | - assigning it back because ompi_info will call _register() and |
294 | | - then _close() (which won't set the hook) */ |
295 | | - if (malloc_hook_set) { |
296 | | - __malloc_hook = mca_btl_openib_component.previous_malloc_hook; |
297 | | - malloc_hook_set = false; |
298 | | - } |
299 | | -#endif |
300 | 251 |
|
301 | 252 | /* close memory registration debugging output */ |
302 | 253 | opal_output_close (mca_btl_openib_component.memory_registration_verbose); |
@@ -2461,19 +2412,8 @@ btl_openib_component_init(int *num_btl_modules, |
2461 | 2412 | *num_btl_modules = 0; |
2462 | 2413 | num_devs = 0; |
2463 | 2414 |
|
2464 | | -#if BTL_OPENIB_MALLOC_HOOKS_ENABLED |
2465 | | - /* If we got this far, then setup the memory alloc hook (because |
2466 | | - we're most likely going to be using this component). The hook |
2467 | | - is to be set up as early as possible in this function since we |
2468 | | - want most of the allocated resources be aligned.*/ |
2469 | | - if (mca_btl_openib_component.use_memalign > 0 && |
2470 | | - (opal_mem_hooks_support_level() & |
2471 | | - (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_CHUNK_SUPPORT)) != 0) { |
2472 | | - mca_btl_openib_component.previous_malloc_hook = __malloc_hook; |
2473 | | - __malloc_hook = btl_openib_malloc_hook; |
2474 | | - malloc_hook_set = true; |
2475 | | - } |
2476 | | -#endif |
| 2415 | + opal_memory->memoryc_set_alignment(32, mca_btl_openib_module.super.btl_eager_limit); |
| 2416 | + |
2477 | 2417 | /* Currently refuse to run if MPI_THREAD_MULTIPLE is enabled */ |
2478 | 2418 | if (ompi_mpi_thread_multiple && !mca_btl_base_thread_multiple_override) { |
2479 | 2419 | opal_output_verbose(5, ompi_btl_base_framework.framework_output, |
@@ -2894,13 +2834,6 @@ btl_openib_component_init(int *num_btl_modules, |
2894 | 2834 |
|
2895 | 2835 | mca_btl_openib_component.ib_num_btls = 0; |
2896 | 2836 | btl_openib_modex_send(); |
2897 | | -#if BTL_OPENIB_MALLOC_HOOKS_ENABLED |
2898 | | - /*Unset malloc hook since the component won't start*/ |
2899 | | - if (malloc_hook_set) { |
2900 | | - __malloc_hook = mca_btl_openib_component.previous_malloc_hook; |
2901 | | - malloc_hook_set = false; |
2902 | | - } |
2903 | | -#endif |
2904 | 2837 | return NULL; |
2905 | 2838 | } |
2906 | 2839 |
|
|
0 commit comments