1
1
openmpi/opal/mca/memory/linux/rename.h

53 строки
2.1 KiB
C
Исходник Обычный вид История

Per http://www.open-mpi.org/community/lists/announce/2009/03/0029.php and https://svn.open-mpi.org/trac/ompi/ticket/1853, mallopt() hints do not always work -- it is possible for memory to be returned to the OS and therefore OMPI's registration cache becomes invalid. This commit removes all use of mallopt() and uses a different way to integrate ptmalloc2 than we have done in the past. In particular, we use almost exactly the same technique as MX: * Remove all uses of mallopt, to include the opal/memory mallopt component. * Name-shift all of OMPI's internal ptmalloc2 public symbols (e.g., malloc -> opal_memory_ptmalloc2_malloc). * At run-time, use the existing glibc allocator malloc hook function pointers to fully hijack the glibc allocator with our own name-shifted ptmalloc2. * Make the decision whether to hijack the glibc allocator ''at run time'' (vs. at link time, as previous ptmalloc2 integration attempts have done). Look at the OMPI_MCA_mpi_leave_pinned and OMPI_MCA_mpi_leave_pinned_pipeline environment variables and the existence of /sys/class/infiniband to determine if we should install the hooks or not. * As an added bonus, we can now tell if libopen-pal is linked statically or dynamically, and if we're linked statically, we assume that munmap intercept support doesn't work. See the opal/mca/memory/ptmalloc2/README-open-mpi.txt file for all the gory details about the implementation. Fixes trac:1853. This commit was SVN r20921. The following Trac tickets were found above: Ticket 1853 --> https://svn.open-mpi.org/trac/ompi/ticket/1853
2009-04-01 21:52:16 +04:00
/*
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/* Name-shift all the internal ptmalloc22 symbols to guarantee to not
conflict / confuse / override the internal glibc symbols. */
#define __default_morecore opal_memory_ptmalloc2_default_morecore
#define _int_malloc opal_memory_ptmalloc2_int_malloc
#define _int_free opal_memory_ptmalloc2_int_free
#define _int_realloc opal_memory_ptmalloc2_int_realloc
#define _int_memalign opal_memory_ptmalloc2_int_memalign
#define _int_valloc opal_memory_ptmalloc2_int_valloc
#define _int_pvalloc opal_memory_ptmalloc2_int_pvalloc
#define _int_icalloc opal_memory_ptmalloc2_int_icalloc
#define _int_icomalloc opal_memory_ptmalloc2_int_icomalloc
#define mTRIm opal_memory_ptmalloc2_mTRIm
#define mUSABLe opal_memory_ptmalloc2_mUSABLe
#define mALLOPt opal_memory_ptmalloc2_mALLOPt
#define mem2mem_check opal_memory_ptmalloc2_mem2mem_check
#define top_check opal_memory_ptmalloc2_top_check
#define munmap_chunk opal_memory_ptmalloc2_munmap_chunk
#define mremap_chunk opal_memory_ptmalloc2_mremap_chunk
#define malloc_check opal_memory_ptmalloc2_malloc_check
#define free_check opal_memory_ptmalloc2_free_check
#define realloc_check opal_memory_ptmalloc2_realloc_check
#define memalign_check opal_memory_ptmalloc2_memalign_check
#define malloc_starter opal_memory_ptmalloc2_malloc_starter
#define memalign_starter opal_memory_ptmalloc2_memalign_starter
#define free_starter opal_memory_ptmalloc2_free_starter
#define malloc_atfork opal_memory_ptmalloc2_malloc_atfork
#define free_atfork opal_memory_ptmalloc2_free_atfork
#define _int_get_arena opal_memory_ptmalloc2_int_get_arena
#define _int_get_arena_info opal_memory_ptmalloc2_int_get_arena_info
#define _int_get_global_info opal_memory_ptmalloc2_int_get_global_info
#define _int_new_arena opal_memory_ptmalloc2_int_new_arena
#define __malloc_check_init opal_memory_ptmalloc2_malloc_check_init
#define malloc_stats opal_memory_ptmalloc2_malloc_stats
#define posix_memalign opal_memory_ptmalloc2_posix_memalign